]> arthur.barton.de Git - bup.git/blobdiff - config/configure
cirrus: adjust for new python-config based builds
[bup.git] / config / configure
index f37cd904c6cc022cf4bb66c20ee86899f38ee93f..31a43e105a243a03aed1d08feb7d2214f80a2a1b 100755 (executable)
@@ -38,7 +38,7 @@ TARGET=bup
 . ./configure.inc
 
 # FIXME: real tmpdir
-rm -rf config.var config.var.tmp config.vars
+rm -rf finished config/bin config.var config.var.tmp config.vars
 
 AC_INIT $TARGET
 
@@ -47,17 +47,17 @@ if ! AC_PROG_CC; then
     exit 1
 fi
 
-MAKE="$(bup_find_prog make "$MAKE")"
-if test -z "$MAKE"; then
-    MAKE="$(bup_find_prog gmake "$GMAKE")"
-fi
-
-if test -z "$MAKE"; then
-    AC_FAIL "ERROR: unable to find make"
-fi
+for make_candidate in make gmake; do
+    found_make="$(bup_find_prog "$make_candidate" "$MAKE")"
+    if test "$found_make" \
+            && ("$found_make" --version | grep "GNU Make"); then
+        MAKE="$found_make"
+        break;
+    fi
+done
 
-if ! ($MAKE --version | grep "GNU Make"); then
-    AC_FAIL "ERROR: $MAKE is not GNU Make"
+if ! test "$MAKE"; then
+    AC_FAIL "ERROR: unable to find GNU make as make or gmake"
 fi
 
 MAKE_VERSION=`$MAKE --version | grep "GNU Make" | awk '{print $3}'`
@@ -103,6 +103,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"
@@ -223,12 +236,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
@@ -316,10 +333,8 @@ AC_SUB bup_have_libacl "$bup_have_libacl"
 AC_CC="$orig_ac_cc"
 LIBS="$orig_libs"
 
-
 AC_OUTPUT config.vars
 
-
 set -euo pipefail
 
 # FIXME: real tmpdir
@@ -328,6 +343,12 @@ echo -n "$MAKE" > config.var.tmp/bup-make
 echo -n "$bup_python_config" > config.var.tmp/bup-python-config
 mv config.var.tmp config.var
 
+if test -e bin; then rm -r bin; fi
+mkdir -p bin
+(cd bin && ln -s "$MAKE" make)
+
+touch finished
+
 printf "
 found: python-config (%q)
 found: git (%q, ($("$bup_git" --version))