aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2012-01-16 14:50:09 -0800
committerMark Adler <madler@alumni.caltech.edu>2012-01-16 16:44:40 -0800
commit2d55657c0341238eb9d6fd8d545bcd7efade5ed8 (patch)
tree7200cd60503934011cd1ed6bb0b2a44668de1623 /configure
parent5a5dd2c793df39a3e1765abc3dfcad0852bdf6cb (diff)
downloadzlib-2d55657c0341238eb9d6fd8d545bcd7efade5ed8.tar.gz
zlib-2d55657c0341238eb9d6fd8d545bcd7efade5ed8.tar.bz2
zlib-2d55657c0341238eb9d6fd8d545bcd7efade5ed8.zip
Have ./configure use the compiler return code for error indication.
Previously ./configure would use any output on stderr as an indication that the compilation failed. However if some compiler wrapper uses stderr for some other purpose, e.g. distcc for nodes going down, then ./configure would not properly configure the build. This problem was noted by Mike Frysinger. For backwards compatibility, ./configure will revert to the old way, i.e. checking for anything on stderr, if when it deliberately runs the compiler with an error, a zero exit status is returned.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure44
1 files changed, 30 insertions, 14 deletions
diff --git a/configure b/configure
index 5a5a488..84fa5a3 100755
--- a/configure
+++ b/configure
@@ -97,6 +97,22 @@ case "$1" in
97done 97done
98 98
99test=ztest$$ 99test=ztest$$
100
101cat > $test.c <<EOF
102#error error
103EOF
104if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
105 try()
106 {
107 test "`( $* ) 2>&1`" = ""
108 }
109else
110 try()
111 {
112 ( $* ) 2>/dev/null
113 }
114fi
115
100cat > $test.c <<EOF 116cat > $test.c <<EOF
101extern int getchar(); 117extern int getchar();
102int hello() {return getchar();} 118int hello() {return getchar();}
@@ -249,8 +265,8 @@ SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"}
249if test $shared -eq 1; then 265if test $shared -eq 1; then
250 echo Checking for shared library support... 266 echo Checking for shared library support...
251 # we must test in two steps (cc then ld), required at least on SunOS 4.x 267 # we must test in two steps (cc then ld), required at least on SunOS 4.x
252 if test "`($CC -w -c $SFLAGS $test.c) 2>&1`" = "" && 268 if try $CC -w -c $SFLAGS $test.c &&
253 test "`($LDSHARED $SFLAGS -o $test$shared_ext $test.o) 2>&1`" = ""; then 269 try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then
254 echo Building shared library $SHAREDLIBV with $CC. 270 echo Building shared library $SHAREDLIBV with $CC.
255 elif test -z "$old_cc" -a -z "$old_cflags"; then 271 elif test -z "$old_cc" -a -z "$old_cflags"; then
256 echo No shared library support. 272 echo No shared library support.
@@ -281,7 +297,7 @@ cat > $test.c <<EOF
281#include <sys/types.h> 297#include <sys/types.h>
282off64_t dummy = 0; 298off64_t dummy = 0;
283EOF 299EOF
284if test "`($CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c) 2>&1`" = ""; then 300if try $CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c; then
285 CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1" 301 CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1"
286 SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1" 302 SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1"
287 ALL="${ALL} all64" 303 ALL="${ALL} all64"
@@ -297,7 +313,7 @@ int main(void) {
297 return 0; 313 return 0;
298} 314}
299EOF 315EOF
300 if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then 316 if try $CC $CFLAGS -o $test $test.c; then
301 echo "Checking for fseeko... Yes." 317 echo "Checking for fseeko... Yes."
302 else 318 else
303 CFLAGS="${CFLAGS} -DNO_FSEEKO" 319 CFLAGS="${CFLAGS} -DNO_FSEEKO"
@@ -312,7 +328,7 @@ cat > $test.c <<EOF
312#include <unistd.h> 328#include <unistd.h>
313int main() { return 0; } 329int main() { return 0; }
314EOF 330EOF
315if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then 331if try $CC -c $CFLAGS $test.c; then
316 sed < zconf.h "/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be/ 1\1 was/" > zconf.temp.h 332 sed < zconf.h "/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
317 mv zconf.temp.h zconf.h 333 mv zconf.temp.h zconf.h
318 echo "Checking for unistd.h... Yes." 334 echo "Checking for unistd.h... Yes."
@@ -324,7 +340,7 @@ cat > $test.c <<EOF
324#include <stdarg.h> 340#include <stdarg.h>
325int main() { return 0; } 341int main() { return 0; }
326EOF 342EOF
327if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then 343if try $CC -c $CFLAGS $test.c; then
328 sed < zconf.h "/^#ifdef HAVE_STDARG_H.* may be/s/def HAVE_STDARG_H\(.*\) may be/ 1\1 was/" > zconf.temp.h 344 sed < zconf.h "/^#ifdef HAVE_STDARG_H.* may be/s/def HAVE_STDARG_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
329 mv zconf.temp.h zconf.h 345 mv zconf.temp.h zconf.h
330 echo "Checking for stdarg.h... Yes." 346 echo "Checking for stdarg.h... Yes."
@@ -367,7 +383,7 @@ int main()
367} 383}
368EOF 384EOF
369 385
370if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then 386if try $CC -c $CFLAGS $test.c; then
371 echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()." 387 echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()."
372 388
373 cat > $test.c <<EOF 389 cat > $test.c <<EOF
@@ -390,7 +406,7 @@ int main()
390 return (mytest("Hello%d\n", 1)); 406 return (mytest("Hello%d\n", 1));
391} 407}
392EOF 408EOF
393 if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then 409 if try $CC $CFLAGS -o $test $test.c; then
394 echo "Checking for vsnprintf() in stdio.h... Yes." 410 echo "Checking for vsnprintf() in stdio.h... Yes."
395 411
396 cat >$test.c <<EOF 412 cat >$test.c <<EOF
@@ -415,7 +431,7 @@ int main()
415} 431}
416EOF 432EOF
417 433
418 if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then 434 if try $CC -c $CFLAGS $test.c; then
419 echo "Checking for return value of vsnprintf()... Yes." 435 echo "Checking for return value of vsnprintf()... Yes."
420 else 436 else
421 CFLAGS="$CFLAGS -DHAS_vsnprintf_void" 437 CFLAGS="$CFLAGS -DHAS_vsnprintf_void"
@@ -455,7 +471,7 @@ int main()
455} 471}
456EOF 472EOF
457 473
458 if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then 474 if try $CC -c $CFLAGS $test.c; then
459 echo "Checking for return value of vsprintf()... Yes." 475 echo "Checking for return value of vsprintf()... Yes."
460 else 476 else
461 CFLAGS="$CFLAGS -DHAS_vsprintf_void" 477 CFLAGS="$CFLAGS -DHAS_vsprintf_void"
@@ -486,7 +502,7 @@ int main()
486} 502}
487EOF 503EOF
488 504
489 if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then 505 if try $CC $CFLAGS -o $test $test.c; then
490 echo "Checking for snprintf() in stdio.h... Yes." 506 echo "Checking for snprintf() in stdio.h... Yes."
491 507
492 cat >$test.c <<EOF 508 cat >$test.c <<EOF
@@ -505,7 +521,7 @@ int main()
505} 521}
506EOF 522EOF
507 523
508 if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then 524 if try $CC -c $CFLAGS $test.c; then
509 echo "Checking for return value of snprintf()... Yes." 525 echo "Checking for return value of snprintf()... Yes."
510 else 526 else
511 CFLAGS="$CFLAGS -DHAS_snprintf_void" 527 CFLAGS="$CFLAGS -DHAS_snprintf_void"
@@ -539,7 +555,7 @@ int main()
539} 555}
540EOF 556EOF
541 557
542 if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then 558 if try $CC -c $CFLAGS $test.c; then
543 echo "Checking for return value of sprintf()... Yes." 559 echo "Checking for return value of sprintf()... Yes."
544 else 560 else
545 CFLAGS="$CFLAGS -DHAS_sprintf_void" 561 CFLAGS="$CFLAGS -DHAS_sprintf_void"
@@ -565,7 +581,7 @@ int main()
565 return 0; 581 return 0;
566} 582}
567EOF 583EOF
568 if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then 584 if try $CC -c $CFLAGS $test.c; then
569 echo "Checking for attribute(visibility) support... Yes." 585 echo "Checking for attribute(visibility) support... Yes."
570 else 586 else
571 CFLAGS="$CFLAGS -DNO_VIZ" 587 CFLAGS="$CFLAGS -DNO_VIZ"