[6.0] 0c356af2b build: Revisit zlib C flags one more time

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Tue Oct 17 21:28:11 UTC 2023


commit 0c356af2bfd9c5f6eb667ca3ea7446c98b6ce4bd
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Mon Jan 30 13:54:13 2023 +0100

    build: Revisit zlib C flags one more time
    
    Trying to fix the build for clang 15 actually broke the build for GCC.
    
    The -Werror that was initially set after saving CFLAGS was meant to be
    part of NO_VIZ test. We turn warnings into errors later in the configure
    script so at this point we shouldn't care about it. If we really do, we
    can move this check below the line where -Werror is set.
    
    GCC chokes on -Wno-error=deprecated-non-prototype so instead we add it
    conditionally.
    
    To match the naming convention everywhere else, libvgz_extra_cflags was
    renamed to VGZ_CFLAGS.
    
    Refs 118fd10c9e81920e0c31906c2bf5c62a3f25cd5b
    
    Conflicts:
            configure.ac
            lib/libvgz/Makefile.am

diff --git a/configure.ac b/configure.ac
index 932691e65..b5e8b45ab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -245,12 +245,13 @@ AC_CHECK_FUNCS([pthread_mutex_isowned_np])
 LIBS="${save_LIBS}"
 
 # zlib-specific flags
-libvgz_extra_cflags="-Wno-error=strict-prototypes -Wno-unknown-warning-option"
+VGZ_CFLAGS="-Wno-error=strict-prototypes -Wno-unknown-warning-option"
 
 dnl https://github.com/madler/zlib/issues/633
-libvgz_extra_cflags="$libvgz_extra_cflags -Wno-error=deprecated-non-prototype"
+AX_CHECK_COMPILE_FLAG([-Wno-error=deprecated-non-prototype],
+	[VGZ_CFLAGS="$VGZ_CFLAGS -Wno-error=deprecated-non-prototype"])
 
-AC_SUBST(libvgz_extra_cflags)
+AC_SUBST(VGZ_CFLAGS)
 
 # Support for visibility attribute (zlib)
 AC_CACHE_CHECK([whether we have support for visibility attributes],
diff --git a/lib/libvgz/Makefile.am b/lib/libvgz/Makefile.am
index e6f7a1dbe..5eb0de6f8 100644
--- a/lib/libvgz/Makefile.am
+++ b/lib/libvgz/Makefile.am
@@ -3,7 +3,7 @@
 AM_CFLAGS = $(AM_LT_CFLAGS) \
 	-D_LARGEFILE64_SOURCE=1 \
 	-DZLIB_CONST \
-	$(libvgz_extra_cflags) \
+	$(VGZ_CFLAGS) \
 	@SAN_CFLAGS@
 
 AM_LDFLAGS = $(AM_LT_LDFLAGS)


More information about the varnish-commit mailing list