]> arthur.barton.de Git - bup.git/blobdiff - config/configure
Drop builtin_mul_overflow in favor of INT_MULTIPLY_OK
[bup.git] / config / configure
index 8b9263d3d6d2f13b1aa123619c15a8c1c36e6ad4..85495ae2507ae2b0bdd70e8ec90e33e0f1449f8c 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.
@@ -35,6 +37,20 @@ bup_try_c_code()
 
 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
@@ -103,6 +119,19 @@ else  # Earlier versions didn't support --embed
     bup_python_cflags_embed=$("$bup_python_config" --cflags) || exit $?
     bup_python_ldflags_embed=$("$bup_python_config" --ldflags) || exit $?
 fi
+
+bup_python_cflags="$bup_python_cflags -fPIC"
+
+case "$OSTYPE" in
+    darwin*)
+        # For at least 10.3+ (2003+)
+        bup_python_ldflags="$bup_python_ldflags -bundle -undefined dynamic_lookup"
+        ;;
+    *)
+        bup_python_ldflags="$bup_python_ldflags -shared"
+        ;;
+esac
+
 AC_SUB bup_python_config "$bup_python_config"
 AC_SUB bup_python_cflags "$bup_python_cflags"
 AC_SUB bup_python_ldflags "$bup_python_ldflags"
@@ -136,24 +165,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
 
@@ -223,12 +234,16 @@ if pkg-config readline; then
     # It looks like it's not uncommon for pkg-config to provide a -I
     # that doesn't support the documentation's specified #include
     # <readline/readline.h>.  See what's really going on.
-    if bup_try_c_code "#include <readline/readline.h> $readline_test_code" \
+    if bup_try_c_code "#include <stdio.h> // required by unpatched readline
+#include <readline/readline.h>
+$readline_test_code" \
                       "$bup_readline_cflags"
     then
         bup_have_readline=1
         bup_readline_includes_in_subdir=1
-    elif bup_try_c_code "#include <readline.h> $readline_test_code" \
+    elif bup_try_c_code "#include <stdio.h> // required by unpatched readline
+#include <readline.h>
+$readline_test_code" \
                         "$bup_readline_cflags"
     then
         bup_have_readline=1
@@ -324,6 +339,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