Commit 2766d16a authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

build: Better handle zlib-specific C flags

There are two warnings that we enforce for our own code that zlib does
not. There's also the visibility attribute that we check at configure
time. And regarding the visibility attribute, zlib no longer relies on
a NO_VIZ macro and aligned with the autoconf naming convention and wants
HAVE_HIDDEN instead.

Conflicts:
	configure.ac
	lib/libvgz/Makefile.am
parent 149a536e
......@@ -244,29 +244,25 @@ AC_CHECK_FUNCS([pthread_setname_np])
AC_CHECK_FUNCS([pthread_mutex_isowned_np])
LIBS="${save_LIBS}"
# Support for visibility attribute
save_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} -Werror"
# zlib-specific flags
libvgz_extra_cflags="-Wno-error=strict-prototypes"
dnl https://github.com/madler/zlib/issues/633
libvgz_extra_cflags="$libvgz_extra_cflags -Wno-error=deprecated-non-prototype"
AC_SUBST(libvgz_extra_cflags)
# Support for visibility attribute (zlib)
AC_CACHE_CHECK([whether we have support for visibility attributes],
[ac_cv_have_viz],
[AC_RUN_IFELSE(
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33)
# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
#else
# define ZLIB_INTERNAL
#endif
int ZLIB_INTERNAL foo;
int __attribute__((visibility ("hidden"))) foo;
]],[])],
[ac_cv_have_viz=yes],
[ac_cv_have_viz=no])
[AC_DEFINE([HAVE_HIDDEN], [1],
[Define to 1 if visibility attribute hidden is available.])
])
])
if test "$ac_cv_have_viz" = no; then
libvgz_extra_cflags="-DNO_VIZ"
AC_SUBST(libvgz_extra_cflags)
fi
CFLAGS="${save_CFLAGS}"
if test "x$GCC" = "xyes"; then
libvgz_extra_cflags="${libvgz_extra_cflags} -Wno-unknown-warning-option -Wno-implicit-fallthrough"
......
#
AM_LDFLAGS = $(AM_LT_LDFLAGS)
AM_CFLAGS = $(AM_LT_CFLAGS) \
-D_LARGEFILE64_SOURCE=1 \
-DZLIB_CONST \
$(libvgz_extra_cflags) \
@SAN_CFLAGS@
noinst_LIBRARIES = libvgz.a
AM_LDFLAGS = $(AM_LT_LDFLAGS)
libvgz_a_CFLAGS = -D_LARGEFILE64_SOURCE=1 -DZLIB_CONST \
$(libvgz_extra_cflags) @SAN_CFLAGS@
noinst_LIBRARIES = libvgz.a
libvgz_a_SOURCES = \
adler32.c \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment