diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2011-12-12 17:34:26 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2011-12-13 10:16:10 +0000 |
commit | 5b718b5db4f848e68761adad23c4919b5076fa0a (patch) | |
tree | 21a4e3028b13ccf4585ebf989c404ae0c6f93af6 | |
parent | 00acb9d73ee5eab5f2f1e99d6185b3e4a676f366 (diff) | |
download | zlib-5b718b5db4f848e68761adad23c4919b5076fa0a.tar.gz |
Make configure test exit code rather than output
distcc will print a message if it can't connect to a distributed compiler.
configure was checking if a command succeeded by if it output anything.
This was confusing configure into thinking that it couldn't build shared
libraries.
The previous fix to stop it trying to copy a shared library that was not
built is still a bug, but we were meant to build shared libraries.
-rwxr-xr-x | configure | 74 | ||||
-rw-r--r-- | zlib.morph | 6 |
2 files changed, 40 insertions, 40 deletions
@@ -53,10 +53,10 @@ sharedlibdir=${sharedlibdir-'${libdir}'} includedir=${includedir-'${prefix}/include'} mandir=${mandir-'${prefix}/share/man'} shared_ext='.so' -shared=1 -zprefix=0 -build64=0 -gcc=0 +shared=true +zprefix=false +build64=false +gcc=false old_cc="$CC" old_cflags="$CFLAGS" @@ -79,10 +79,10 @@ case "$1" in -e* | --eprefix) exec_prefix="$2"; shift; shift ;; -l* | --libdir) libdir="$2"; shift; shift ;; -i* | --includedir) includedir="$2"; shift; shift ;; - -s* | --shared | --enable-shared) shared=1; shift ;; - -t | --static) shared=0; shift ;; - -z* | --zprefix) zprefix=1; shift ;; - -6* | --64) build64=1; shift ;; + -s* | --shared | --enable-shared) shared=true; shift ;; + -t | --static) shared=false; shift ;; + -z* | --zprefix) zprefix=true; shift ;; + -6* | --64) build64=true; shift ;; --sysconfdir=*) echo "ignored option: --sysconfdir"; shift ;; --localstatedir=*) echo "ignored option: --localstatedir"; shift ;; *) echo "unknown option: $1"; echo "$0 --help for help"; exit 1 ;; @@ -100,14 +100,14 @@ cc=${CC-${CROSS_PREFIX}gcc} cflags=${CFLAGS-"-O3"} # to force the asm version use: CFLAGS="-O3 -DASMV" ./configure case "$cc" in - *gcc*) gcc=1 ;; + *gcc*) gcc=true ;; esac -if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then +if $gcc && ($cc -c $cflags $test.c) 2>/dev/null; then CC="$cc" SFLAGS="${CFLAGS--O3} -fPIC" CFLAGS="${CFLAGS--O3}" - if test $build64 -eq 1; then + if $build64; then CFLAGS="${CFLAGS} -m64" SFLAGS="${SFLAGS} -m64" fi @@ -152,7 +152,7 @@ if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then else # find system name and corresponding cc options CC=${CC-cc} - gcc=0 + gcc=false if test -z "$uname"; then uname=`(uname -sr || echo unknown) 2>/dev/null` fi @@ -229,25 +229,28 @@ SHAREDLIB=${SHAREDLIB-"libz$shared_ext"} SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"} SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"} -if test $shared -eq 1; then +if $shared; then echo Checking for shared library support... # we must test in two steps (cc then ld), required at least on SunOS 4.x - if test "`($CC -w -c $SFLAGS $test.c) 2>&1`" = "" && - test "`($LDSHARED $SFLAGS -o $test$shared_ext $test.o) 2>&1`" = ""; then + if ($CC -w -c $SFLAGS $test.c) 2>&1 >/dev/null && + ($LDSHARED $SFLAGS -o $test$shared_ext $test.o) 2>&1 >/dev/null; then echo Building shared library $SHAREDLIBV with $CC. elif test -z "$old_cc" -a -z "$old_cflags"; then echo No shared library support. - shared=0; + shared=false; else echo Tested $CC -w -c $SFLAGS $test.c $CC -w -c $SFLAGS $test.c echo Tested $LDSHARED $SFLAGS -o $test$shared_ext $test.o $LDSHARED $SFLAGS -o $test$shared_ext $test.o echo 'No shared library support; try without defining CC and CFLAGS' - shared=0; + shared=false; fi fi -if test $shared -eq 0; then +if $shared; then + ALL="static shared" + TEST="all teststatic testshared" +else LDSHARED="$CC" ALL="static" TEST="all teststatic" @@ -255,16 +258,13 @@ if test $shared -eq 0; then SHAREDLIBV="" SHAREDLIBM="" echo Building static library $STATICLIB version $VER with $CC. -else - ALL="static shared" - TEST="all teststatic testshared" fi cat > $test.c <<EOF #include <sys/types.h> off64_t dummy = 0; EOF -if test "`($CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c) 2>&1`" = ""; then +if ($CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c) 2>&1 >/dev/null; then CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1" SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1" ALL="${ALL} all64" @@ -280,7 +280,7 @@ int main(void) { return 0; } EOF - if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then + if ($CC $CFLAGS -o $test $test.c) 2>&1 >/dev/null; then echo "Checking for fseeko... Yes." else CFLAGS="${CFLAGS} -DNO_FSEEKO" @@ -295,7 +295,7 @@ cat > $test.c <<EOF #include <unistd.h> int main() { return 0; } EOF -if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then +if ($CC -c $CFLAGS $test.c) 2>&1 >/dev/null; then sed < zconf.h "/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be/ 1\1 was/" > zconf.temp.h mv zconf.temp.h zconf.h echo "Checking for unistd.h... Yes." @@ -303,7 +303,7 @@ else echo "Checking for unistd.h... No." fi -if test $zprefix -eq 1; then +if $zprefix; then sed < zconf.h "/#ifdef Z_PREFIX.* may be/s/def Z_PREFIX\(.*\) may be/ 1\1 was/" > zconf.temp.h mv zconf.temp.h zconf.h echo "Using z_ prefix on all symbols." @@ -324,7 +324,7 @@ int main() } EOF -if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then +if ($CC -c $CFLAGS $test.c) 2>&1 >/dev/null; then echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()." cat > $test.c <<EOF @@ -348,7 +348,7 @@ int main() } EOF - if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then + if ($CC $CFLAGS -o $test $test.c) 2>&1 >/dev/null; then echo "Checking for vsnprintf() in stdio.h... Yes." cat >$test.c <<EOF @@ -373,7 +373,7 @@ int main() } EOF - if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then + if ($CC -c $CFLAGS $test.c) 2>&1 >/dev/null; then echo "Checking for return value of vsnprintf()... Yes." else CFLAGS="$CFLAGS -DHAS_vsnprintf_void" @@ -413,7 +413,7 @@ int main() } EOF - if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then + if ($CC -c $CFLAGS $test.c) 2>&1 >/dev/null; then echo "Checking for return value of vsprintf()... Yes." else CFLAGS="$CFLAGS -DHAS_vsprintf_void" @@ -444,7 +444,7 @@ int main() } EOF - if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then + if ($CC $CFLAGS -o $test $test.c) 2>&1 >/dev/null; then echo "Checking for snprintf() in stdio.h... Yes." cat >$test.c <<EOF @@ -463,7 +463,7 @@ int main() } EOF - if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then + if ($CC -c $CFLAGS $test.c) 2>&1 >/dev/null; then echo "Checking for return value of snprintf()... Yes." else CFLAGS="$CFLAGS -DHAS_snprintf_void" @@ -497,7 +497,7 @@ int main() } EOF - if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then + if ($CC -c $CFLAGS $test.c) 2>&1 >/dev/null; then echo "Checking for return value of sprintf()... Yes." else CFLAGS="$CFLAGS -DHAS_sprintf_void" @@ -510,7 +510,7 @@ EOF fi fi -if test "$gcc" -eq 1; then +if $gcc; then cat > $test.c <<EOF #if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) # define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) @@ -523,7 +523,7 @@ int main() return 0; } EOF - if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then + if ($CC -c $CFLAGS $test.c) 2>&1 >/dev/null; then echo "Checking for attribute(visibility) support... Yes." else CFLAGS="$CFLAGS -DNO_VIZ" @@ -535,11 +535,11 @@ fi CPP=${CPP-"$CC -E"} case $CFLAGS in *ASMV*) - if test "`$NM $test.o | grep _hello`" = ""; then + if $NM $test.o | grep _hello 2>&1 >/dev/null; then + echo Checking for underline in external names... Yes. + else CPP="$CPP -DNO_UNDERLINE" echo Checking for underline in external names... No. - else - echo Checking for underline in external names... Yes. fi ;; esac @@ -3,13 +3,13 @@ "kind": "chunk", "max-jobs": "1", "configure-commands": [ - "LD_LIBRARY_PATH=/tools/lib:$LD_LIBRARY_PATH PATH=/tools/bin:$PATH prefix=/usr CC='gcc -B/usr/lib -B/usr/lib64' ./configure" + "LD_LIBRARY_PATH=\"/tools/lib:$LD_LIBRARY_PATH\" PATH=\"/tools/bin:$PATH\" prefix=/usr CC='gcc -B/usr/lib -B/usr/lib64' ./configure" ], "build-commands": [ - "LD_LIBRARY_PATH=/tools/lib:$LD_LIBRARY_PATH PATH=/tools/bin:$PATH make -j1 libs" + "LD_LIBRARY_PATH=\"/tools/lib:$LD_LIBRARY_PATH\" PATH=\"/tools/bin:$PATH\" make -j1 libs" ], "install-commands": [ - "LD_LIBRARY_PATH=/tools/lib:$LD_LIBRARY_PATH PATH=/tools/bin:$PATH make install-libs", + "LD_LIBRARY_PATH=\"/tools/lib:$LD_LIBRARY_PATH\" PATH=\"/tools/bin:$PATH\" make install-libs", "ldconfig -f /etc/ld.so.conf -C /etc/ld.so.cache" ] } |