[Mesa-dev] [PATCH v2] configure.ac: Define HAVE_ZLIB if zlib is found

Emil Velikov emil.l.velikov at gmail.com
Fri Nov 10 22:50:30 UTC 2017


On 10 November 2017 at 22:18, Jordan Justen <jordan.l.justen at intel.com> wrote:
> v2:
>  * Keep zlib required for autotools & meson (Emil)
>
> Cc: Emil Velikov <emil.velikov at collabora.com>
> Cc: Dylan Baker <dylan at pnwbakers.com>
> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> ---
>  configure.ac | 8 +++++++-
>  meson.build  | 6 +++++-
>  2 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 411c4f6b3e0..5db39e5a68d 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -900,7 +900,13 @@ dnl See if posix_memalign is available
>  AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
>
>  dnl Check for zlib
> -PKG_CHECK_MODULES([ZLIB], [zlib >= $ZLIB_REQUIRED])
> +PKG_CHECK_MODULES([ZLIB], [zlib >= $ZLIB_REQUIRED],
> +                  [have_zlib=yes], [have_zlib=no])
> +if test "x$have_zlib" = xyes; then
> +    DEFINES="$DEFINES -DHAVE_ZLIB"
> +else
> +    AC_MSG_ERROR([Building mesa on this platform requires zlib])
> +fi
>
By default PKG_CHECK_MODULES will error out, when the dependency is missing.
Thus you only need a single line:
DEFINES="$DEFINES -DHAVE_ZLIB"

>  dnl Check for pthreads
>  AX_PTHREAD
> diff --git a/meson.build b/meson.build
> index 855c80ed658..d3ab3f6181d 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -661,8 +661,12 @@ if dep_libdrm.found()
>    endif
>  endif
>
> -# TODO: some of these may be conditional
>  dep_zlib = dependency('zlib', version : '>= 1.2.3')
The meson manpage does not say if 'required' defaults to true or false.
If the former I'd explicitly set it to true, with a small note above
wrt Windows.
"Needs Windows integration for zlib"

Alternatively, one could drop the dep_zlib.found check.

Please squash the following

--- a/Android.common.mk
+++ b/Android.common.mk
@@ -65,6 +65,7 @@ LOCAL_CFLAGS += \
       -DHAVE_PTHREAD=1 \
       -DHAVE_DLADDR \
       -DHAVE_DL_ITERATE_PHDR \
+       -DHAVE_ZLIB \
       -DMAJOR_IN_SYSMACROS \
       -fvisibility=hidden \
       -Wno-sign-compare


With the above the patch is
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>

-Emil


More information about the mesa-dev mailing list