]> arthur.barton.de Git - bup.git/blobdiff - config/configure.inc
configure.inc: fix LDFLAGS validation
[bup.git] / config / configure.inc
index b25ca509efddb2b648e629849e57cb0e205324d0..ed3b5c4b0bbb16437e9e75082e7f749de2d989ef 100644 (file)
@@ -492,7 +492,7 @@ EOF
 
        if [ "$CFLAGS" ]; then
            test "$CFLAGS" && echo "validating CFLAGS=${CFLAGS}"
-           if $AC_CC $CFLAGS -o "$__ac_tmpdir/ngc$$.o" "$__ac_tmpdir/ngc$$.c" ; then
+           if $AC_CC $CFLAGS -o "$__ac_tmpdir/ngc$$" "$__ac_tmpdir/ngc$$.c" ; then
                AC_CFLAGS=${CFLAGS:-"-g"}
                test "$CFLAGS" && echo "CFLAGS=\"${CFLAGS}\" are okay"
            elif [ "$CFLAGS" ]; then
@@ -502,8 +502,9 @@ EOF
            AC_CFLAGS=-g
        fi
        if [ "$LDFLAGS" ]; then
-           test "$LDFLAGS" && echo "validating LDFLAGS=${LDFLAGS}"
-           if $AC_CC $LDFLAGS -o "$__ac_tmpdir/ngc$$" "$__ac_tmpdir/ngc$$.o"; then
+           echo "validating LDFLAGS=${LDFLAGS}"
+            $AC_CC $AC_CFLAGS -c -o "$__ac_tmpdir/ngc$$.o" "$__ac_tmpdir/ngc$$.c"
+            if $AC_CC $AC_CFLAGS $LDFLAGS -o "$__ac_tmpdir/ngc$$" "$__ac_tmpdir/ngc$$.o"; then
                AC_LDFLAGS=${LDFLAGS:-"-g"}
                test "$LDFLAGS" && TLOG "LDFLAGS=\"${LDFLAGS}\" are okay"
            elif [ "$LDFLAGS" ]; then
@@ -528,7 +529,7 @@ EOF
 # acLookFor actually looks for a program, without setting anything.
 #
 acLookFor () {
-    path=${AC_PATH:-$ac_default_path}
+    path="${AC_PATH:-$ac_default_path}"
     case "X$1" in
     X-[rx]) __mode=$1
            shift
@@ -540,8 +541,8 @@ acLookFor () {
     for program in $*; do
        IFS=":"
        for x in $path; do
-           if [ $__mode $x/$program -a -f $x/$program ]; then
-               echo $x/$program
+           if [ $__mode "$x/$program" -a -f "$x/$program" ]; then
+               echo "$x/$program"
                break 2
            fi
        done
@@ -576,7 +577,7 @@ MF_PATH_INCLUDE () {
        AC_MAK $SYM
        AC_DEFINE PATH_$__sym \""$DEST"\"
        AC_SUB $__sym "$DEST"
-       eval CF_$SYM=$DEST
+       eval CF_$SYM="'$DEST'"
        return 0
     else
        #AC_SUB $__sym ''
@@ -594,7 +595,7 @@ MF_PATH_INCLUDE () {
 # and fd 5 points to what used to be fd 1
 #
 AC_INIT () {
-    __ac_tmpdir=$(mktemp -d)
+    __ac_tmpdir=$(mktemp -d configure-XXXXXX)
     __config_files="config.cmd config.sub config.h config.mak config.log"
     __config_detritus="config.h.tmp"
     rm -f $__config_files $__config_detritus
@@ -793,7 +794,7 @@ AC_PROG_LN_S () {
 
     if [ "$DEST" ]; then
        rm -f "$__ac_tmpdir/b$$"
-       $DEST -s "$__ac_tmpdir/a$$" "$__ac_tmpdir/b$$"
+       "$DEST" -s "$__ac_tmpdir/a$$" "$__ac_tmpdir/b$$"
        if [ "`$AC_FIND_PROG $__ac_tmpdir/b$$ -type l -print`" ]; then
            TLOG " ($DEST)"
            echo "$DEST exists, and ln -s works"
@@ -823,7 +824,7 @@ AC_PROG_FIND () {
     if test -z "$AC_FIND_PROG"; then
        MF_PATH_INCLUDE FIND find
        rc=$?
-       AC_FIND_PROG=$DEST
+       AC_FIND_PROG="$DEST"
        return $rc
     fi
     return 0
@@ -838,7 +839,7 @@ AC_PROG_AWK () {
     if test -z "$AC_AWK_PROG"; then
        MF_PATH_INCLUDE AWK awk
        rc=$?
-       AC_AWK_PROG=$DEST
+       AC_AWK_PROG="$DEST"
        return $rc
     fi
     return 0
@@ -853,7 +854,7 @@ AC_PROG_SED () {
     if test -z "$AC_SED_PROG"; then
        MF_PATH_INCLUDE SED sed
        rc=$?
-       AC_SED_PROG=$DEST
+       AC_SED_PROG="$DEST"
        return $rc
     fi
     return 0
@@ -968,6 +969,7 @@ AC_OUTPUT () {
     AC_SUB 'GENERATED_FILES' "$*"
     AC_SUB 'CFLAGS'  "$AC_CFLAGS"
     AC_SUB 'FCFLAGS' "$AC_FCFLAGS"
+    AC_SUB 'CPPFLAGS' "$AC_CPPFLAGS"
     AC_SUB 'CXXFLAGS' "$AC_CXXFLAGS"
     AC_SUB 'LDFLAGS' "$AC_LDFLAGS"
     AC_SUB 'srcdir'  "$AC_SRCDIR"
@@ -990,7 +992,7 @@ AC_OUTPUT () {
        Q=\'
        cat - > config.cmd << EOF
 #! /bin/sh
-${CXX:+CXX=${Q}${CXX}${Q}} ${CXXFLAGS:+CXXFLAGS=${Q}${CXXFLAGS}${Q}} ${FC:+FC=${Q}${FC}${Q}} ${FCFLAGS:+FCFLAGS=${Q}${FCFLAGS}${Q}} ${CC:+CC=${Q}${CC}${Q}} ${CFLAGS:+CFLAGS=${Q}${CFLAGS}${Q}} $ac_progname $ac_configure_command
+${CXX:+CXX=${Q}${CXX}${Q}} ${CPPFLAGS:+CPPFLAGS=${Q}${CPPFLAGS}${Q}} ${CXXFLAGS:+CXXFLAGS=${Q}${CXXFLAGS}${Q}} ${FC:+FC=${Q}${FC}${Q}} ${FCFLAGS:+FCFLAGS=${Q}${FCFLAGS}${Q}} ${CC:+CC=${Q}${CC}${Q}} ${CFLAGS:+CFLAGS=${Q}${CFLAGS}${Q}} $ac_progname $ac_configure_command
 EOF
        chmod +x config.cmd
 
@@ -1145,7 +1147,7 @@ AC_PROG_INSTALL () {
        # BSD install or GNU install?  Let's find out...
        touch "$__ac_tmpdir/a$$"
 
-       $DEST "$__ac_tmpdir/a$$" "$__ac_tmpdir/b$$"
+       "$DEST" "$__ac_tmpdir/a$$" "$__ac_tmpdir/b$$"
 
        if test -r "$__ac_tmpdir/a$$"; then
            LOG " ($DEST)"
@@ -1245,7 +1247,7 @@ EOF
 #
 AC_PROG_CPP () {
     if [ "$AC_CPP_PROG" ]; then
-       DEST=$AC_CPP_PROG
+       DEST="$AC_CPP_PROG"
     else
        __ac_path="$AC_PATH"
        AC_PATH="/lib:/usr/lib:${__ac_path:-$ac_default_path}"
@@ -1257,11 +1259,11 @@ AC_PROG_CPP () {
     LOGN "Looking for cpp"
     if [ "$DEST" ]; then
        TLOGN " ($DEST)"
-       acCheckCPP $DEST "$CPPFLAGS" || \
-                acCheckCPP $DEST -traditional-cpp -E || \
-                acCheckCPP $DEST -E || \
-                acCheckCPP $DEST -traditional-cpp -pipe || \
-                acCheckCPP $DEST -pipe || fail=1
+       acCheckCPP "$DEST" "$CPPFLAGS" || \
+                acCheckCPP "$DEST" -traditional-cpp -E || \
+                acCheckCPP "$DEST" -E || \
+                acCheckCPP "$DEST" -traditional-cpp -pipe || \
+                acCheckCPP "$DEST" -pipe || fail=1
 
        if [ "$fail" ]; then
            AC_FAIL " (can't run cpp as a pipeline)"