[6.0] 2766d16aa build: Better handle zlib-specific C flags
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Tue Oct 17 21:28:11 UTC 2023
commit 2766d16aacde26e9cb4e262939d0a27c33a1e0e2
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Mon Jan 30 11:27:57 2023 +0100
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
diff --git a/configure.ac b/configure.ac
index ca100e06c..3baa78565 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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"
diff --git a/lib/libvgz/Makefile.am b/lib/libvgz/Makefile.am
index db9a48bdc..e6f7a1dbe 100644
--- a/lib/libvgz/Makefile.am
+++ b/lib/libvgz/Makefile.am
@@ -1,11 +1,14 @@
#
-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 \
More information about the varnish-commit
mailing list