]> arthur.barton.de Git - bup.git/blobdiff - config/configure
git/packwriter: open(..) prohibited in __del__
[bup.git] / config / configure
index 31a43e105a243a03aed1d08feb7d2214f80a2a1b..b27a419669605c1b402da30d7ad36da2bf77c42d 100755 (executable)
@@ -1,5 +1,7 @@
 #!/usr/bin/env bash
 
+ac_help="--with-pylint[=yes|no|maybe]  require and run pylint (maybe)"
+
 bup_find_prog()
 {
     # Prints prog path to stdout or nothing.
@@ -33,8 +35,43 @@ 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=()
+with_pylint=maybe
+while test $# -gt 0; do
+    case "$1" in
+        --with-pylint=yes) with_pylint=yes; shift;;
+        --with-pylint=maybe) with_pylint=maybe; shift;;
+        --with-pylint=no) with_pylint=no; shift;;
+        *) argv+=("$1"); shift;;
+    esac
+done
+
+# Set $@ to the adjusted args
+set - "${argv[@]}"
+
 . ./configure.inc
 
 # FIXME: real tmpdir
@@ -47,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" \
@@ -149,24 +188,6 @@ fi
 AC_CHECK_FUNCS utimes
 AC_CHECK_FUNCS lutimes
 
-builtin_mul_overflow_code="
-#include <stddef.h>
-int main(int argc, char **argv)
-{
-    size_t n = 0, size = 0, total;
-    __builtin_mul_overflow(n, size, &total);
-    return 0;
-}
-"
-
-TLOGN "checking for __builtin_mul_overflow"
-if bup_try_c_code "$builtin_mul_overflow_code"; then
-    AC_DEFINE BUP_HAVE_BUILTIN_MUL_OVERFLOW 1
-    TLOG ' (found)'
-else
-    TLOG ' (not found)'
-fi
-
 
 AC_CHECK_FUNCS mincore
 
@@ -333,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
@@ -341,6 +364,7 @@ set -euo pipefail
 mkdir -p config.var.tmp
 echo -n "$MAKE" > config.var.tmp/bup-make
 echo -n "$bup_python_config" > config.var.tmp/bup-python-config
+echo -n "$with_pylint" > config.var.tmp/with-pylint
 mv config.var.tmp config.var
 
 if test -e bin; then rm -r bin; fi