diff configure @ 1849:d34f50b7b9fd

Add configure --enable-werror argument This should be used instead of putting -Werror in CFLAGS before configure, as -Werror interferes with conftests. Update github actions to use that.
author Matt Johnston <matt@ucc.asn.au>
date Tue, 19 Oct 2021 12:16:20 +0800
parents df7bfd2f7d45
children 2b3a8026a6ce
line wrap: on
line diff
--- a/configure	Tue Oct 19 11:50:12 2021 +0800
+++ b/configure	Tue Oct 19 12:16:20 2021 +0800
@@ -697,6 +697,7 @@
 enable_option_checking
 enable_static
 enable_harden
+enable_werror
 enable_largefile
 with_zlib
 enable_zlib
@@ -1354,6 +1355,7 @@
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
   --enable-static         Build static binaries
   --disable-harden        Don't set hardened build flags
+  --enable-werror         Set -Werror when building
   --disable-largefile     omit support for large files
   --disable-zlib          Don't include zlib support
   --enable-pam            Try to include PAM support
@@ -2378,6 +2380,7 @@
 fi
 
 ORIGCFLAGS="$CFLAGS"
+LATE_CFLAGS=""
 # Checks for programs.
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -3506,6 +3509,20 @@
 
 fi
 
+# Check whether --enable-werror was given.
+if test "${enable_werror+set}" = set; then :
+  enableval=$enable_werror;
+		if test "x$enableval" = "xyes"; then
+			# -Werror shouldn't be set when configure runs tests.
+			# We add it to the Makefile's CFLAGS
+			LATE_CFLAGS+="$LATE_CFLAGS -Werror"
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: Enabling -Werror" >&5
+$as_echo "$as_me: Enabling -Werror" >&6;}
+		fi
+
+fi
+
+
 # large file support is useful for scp
 # Check whether --enable-largefile was given.
 if test "${enable_largefile+set}" = set; then :
@@ -7440,6 +7457,9 @@
 LIBTOM_FILES="libtomcrypt/Makefile libtommath/Makefile"
 fi
 
+# flags that should be set in Makefile but not for configure tests
+CFLAGS="$CFLAGS $LATE_CFLAGS"
+
 ac_config_headers="$ac_config_headers config.h"
 
 ac_config_files="$ac_config_files Makefile $LIBTOM_FILES test/Makefile"