]> arthur.barton.de Git - bup.git/commitdiff
configure: support optional cc arguments
authorRob Browning <rlb@defaultvalue.org>
Sat, 30 Oct 2021 19:07:55 +0000 (14:07 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sat, 30 Oct 2021 19:12:41 +0000 (14:12 -0500)
I noticed in some unrelated reports that older compilers were
rejecting -Wno-unsed-command-line-argument, so add
bup-add-cflag-if-supported to configure and use it for that argument.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
GNUmakefile
config/config.vars.in
config/configure

index f3245f59c872f5f94ee06cf1a2ee8f7c6a4fb961..83d141da96f1e38741777b5003a17f94b28673d2 100644 (file)
@@ -40,9 +40,9 @@ LDFLAGS ?=
 TARGET_ARCH ?=
 
 bup_shared_cflags := -O2 -Wall -Werror -Wformat=2
-bup_shared_cflags := -Wno-unused-command-line-argument $(bup_shared_cflags)
 bup_shared_cflags := -Wno-unknown-pragmas -Wsign-compare $(bup_shared_cflags)
 bup_shared_cflags := -D_FILE_OFFSET_BITS=64 $(bup_shared_cflags)
+bup_shared_cflags := $(bup_config_cflags) $(bup_shared_cflags)
 
 bup_shared_ldflags :=
 
index 627f995281e557816530c76a9e6b35b281ef2be4..4101ed3896770e4d0d2d1d36968c27a6acd3e7a9 100644 (file)
@@ -2,6 +2,7 @@ CONFIGURE_FILES=@CONFIGURE_FILES@
 GENERATED_FILES=@GENERATED_FILES@
 
 CC = @CC@
+bup_config_cflags = @bup_config_cflags@
 bup_make=@bup_make@
 
 bup_python_config=@bup_python_config@
index 85495ae2507ae2b0bdd70e8ec90e33e0f1449f8c..b27a419669605c1b402da30d7ad36da2bf77c42d 100755 (executable)
@@ -35,6 +35,27 @@ bup_try_c_code()
     return $rc
 }
 
+bup_config_cflags=()
+
+bup-add-cflag-if-supported()
+{
+    local opt="$1"
+    if test -z "$opt"; then
+        AC_FAIL 'No option to check'
+    fi
+    TLOGN "checking for $AC_CC $opt support"
+    if bup_try_c_code \
+           "int main(int argc, char**argv) { return 0; }" \
+           "$opt";
+    then
+        bup_config_cflags+="$opt"
+        TLOG ' (found)'
+    else
+        TLOG ' (not found)'
+    fi
+}
+
+
 TARGET=bup
 
 argv=()
@@ -63,6 +84,8 @@ if ! AC_PROG_CC; then
     exit 1
 fi
 
+bup-add-cflag-if-supported -Wno-unused-command-line-argument
+
 for make_candidate in make gmake; do
     found_make="$(bup_find_prog "$make_candidate" "$MAKE")"
     if test "$found_make" \
@@ -331,6 +354,8 @@ AC_SUB bup_have_libacl "$bup_have_libacl"
 AC_CC="$orig_ac_cc"
 LIBS="$orig_libs"
 
+AC_SUB bup_config_cflags "$bup_config_cflags"
+
 AC_OUTPUT config.vars
 
 set -euo pipefail