aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2012-01-28 14:48:50 -0800
committerMark Adler <madler@alumni.caltech.edu>2012-01-28 14:48:50 -0800
commit520561c5771d3145308bed193b136b8cd12c6267 (patch)
tree425e12d55206302ca291b30eaed21db9d88e50c4 /configure
parent32d8a5379eb91c7fd55304b567a07ad0e2524398 (diff)
downloadzlib-520561c5771d3145308bed193b136b8cd12c6267.tar.gz
zlib-520561c5771d3145308bed193b136b8cd12c6267.tar.bz2
zlib-520561c5771d3145308bed193b136b8cd12c6267.zip
Add the generation of configure.log by ./configure.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure259
1 files changed, 159 insertions, 100 deletions
diff --git a/configure b/configure
index 84fa5a3..e2e5a70 100755
--- a/configure
+++ b/configure
@@ -13,6 +13,10 @@
13# If you have problems, try without defining CC and CFLAGS before reporting 13# If you have problems, try without defining CC and CFLAGS before reporting
14# an error. 14# an error.
15 15
16echo -------------------- >> configure.log
17echo $0 $* >> configure.log
18date >> configure.log
19
16if [ -n "${CHOST}" ]; then 20if [ -n "${CHOST}" ]; then
17 uname="`echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/'`" 21 uname="`echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/'`"
18 CROSS_PREFIX="${CHOST}-" 22 CROSS_PREFIX="${CHOST}-"
@@ -25,21 +29,21 @@ VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h`
25VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h` 29VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h`
26if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then 30if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then
27 AR=${AR-"${CROSS_PREFIX}ar"} 31 AR=${AR-"${CROSS_PREFIX}ar"}
28 test -n "${CROSS_PREFIX}" && echo Using ${AR} 32 test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log
29else 33else
30 AR=${AR-"ar"} 34 AR=${AR-"ar"}
31 test -n "${CROSS_PREFIX}" && echo Using ${AR} 35 test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log
32fi 36fi
33ARFLAGS=${ARFLAGS-"rc"} 37ARFLAGS=${ARFLAGS-"rc"}
34if "${CROSS_PREFIX}ranlib" --version >/dev/null 2>/dev/null || test $? -lt 126; then 38if "${CROSS_PREFIX}ranlib" --version >/dev/null 2>/dev/null || test $? -lt 126; then
35 RANLIB=${RANLIB-"${CROSS_PREFIX}ranlib"} 39 RANLIB=${RANLIB-"${CROSS_PREFIX}ranlib"}
36 test -n "${CROSS_PREFIX}" && echo Using ${RANLIB} 40 test -n "${CROSS_PREFIX}" && echo Using ${RANLIB} | tee -a configure.log
37else 41else
38 RANLIB=${RANLIB-"ranlib"} 42 RANLIB=${RANLIB-"ranlib"}
39fi 43fi
40if "${CROSS_PREFIX}nm" --version >/dev/null 2>/dev/null || test $? -lt 126; then 44if "${CROSS_PREFIX}nm" --version >/dev/null 2>/dev/null || test $? -lt 126; then
41 NM=${NM-"${CROSS_PREFIX}nm"} 45 NM=${NM-"${CROSS_PREFIX}nm"}
42 test -n "${CROSS_PREFIX}" && echo Using ${NM} 46 test -n "${CROSS_PREFIX}" && echo Using ${NM} | tee -a configure.log
43else 47else
44 NM=${NM-"nm"} 48 NM=${NM-"nm"}
45fi 49fi
@@ -68,10 +72,10 @@ while test $# -ge 1
68do 72do
69case "$1" in 73case "$1" in
70 -h* | --help) 74 -h* | --help)
71 echo 'usage:' 75 echo 'usage:' | tee -a configure.log
72 echo ' configure [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' 76 echo ' configure [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a configure.log
73 echo ' [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' 77 echo ' [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log
74 echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' 78 echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log
75 exit 0 ;; 79 exit 0 ;;
76 -p*=* | --prefix=*) prefix=`echo $1 | sed 's/.*=//'`; shift ;; 80 -p*=* | --prefix=*) prefix=`echo $1 | sed 's/.*=//'`; shift ;;
77 -e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/.*=//'`; shift ;; 81 -e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/.*=//'`; shift ;;
@@ -90,35 +94,56 @@ case "$1" in
90 -z* | --zprefix) zprefix=1; shift ;; 94 -z* | --zprefix) zprefix=1; shift ;;
91 -6* | --64) build64=1; shift ;; 95 -6* | --64) build64=1; shift ;;
92 -a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;; 96 -a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;;
93 --sysconfdir=*) echo "ignored option: --sysconfdir"; shift ;; 97 --sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;;
94 --localstatedir=*) echo "ignored option: --localstatedir"; shift ;; 98 --localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;;
95 *) echo "unknown option: $1"; echo "$0 --help for help"; exit 1 ;; 99 *) echo "unknown option: $1"; echo "$0 --help for help" | tee -a configure.log; exit 1 ;;
96 esac 100 esac
97done 101done
98 102
99test=ztest$$ 103test=ztest$$
100 104
105show()
106{
107 case "$*" in
108 *$test.c*)
109 echo === $test.c === >> configure.log
110 cat $test.c >> configure.log
111 echo === >> configure.log;;
112 esac
113 echo $* >> configure.log
114}
115
101cat > $test.c <<EOF 116cat > $test.c <<EOF
102#error error 117#error error
103EOF 118EOF
104if ($CC -c $CFLAGS $test.c) 2>/dev/null; then 119if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
105 try() 120 try()
106 { 121 {
107 test "`( $* ) 2>&1`" = "" 122 show $*
123 test "`( $* ) 2>&1 | tee -a configure.log`" = ""
108 } 124 }
125 echo - using any output from compiler to indicate an error >> configure.log
109else 126else
110 try() 127 try()
111 { 128 {
112 ( $* ) 2>/dev/null 129 show $*
130 ( $* ) >> configure.log 2>&1
131 ret=$?
132 if test $ret -ne 0; then
133 echo "(exit code "$ret")" >> configure.log
134 fi
135 return $ret
113 } 136 }
114fi 137fi
115 138
139echo >> configure.log
140
116cat > $test.c <<EOF 141cat > $test.c <<EOF
117extern int getchar(); 142extern int getchar();
118int hello() {return getchar();} 143int hello() {return getchar();}
119EOF 144EOF
120 145
121test -z "$CC" && echo Checking for ${CROSS_PREFIX}gcc... 146test -z "$CC" && echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log
122cc=${CC-${CROSS_PREFIX}gcc} 147cc=${CC-${CROSS_PREFIX}gcc}
123cflags=${CFLAGS-"-O3"} 148cflags=${CFLAGS-"-O3"}
124# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure 149# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
@@ -129,7 +154,9 @@ case `$cc -v 2>&1` in
129 *gcc*) gcc=1 ;; 154 *gcc*) gcc=1 ;;
130esac 155esac
131 156
132if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then 157show $cc -c $cflags $test.c
158if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) >> configure.log 2>&1; then
159 echo ... using gcc >> configure.log
133 CC="$cc" 160 CC="$cc"
134 CFLAGS="${CFLAGS--O3} ${ARCHS}" 161 CFLAGS="${CFLAGS--O3} ${ARCHS}"
135 SFLAGS="${CFLAGS--O3} -fPIC" 162 SFLAGS="${CFLAGS--O3} -fPIC"
@@ -152,7 +179,7 @@ if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
152 MINGW* | mingw*) 179 MINGW* | mingw*)
153# temporary bypass 180# temporary bypass
154 rm -f $test.[co] $test $test$shared_ext 181 rm -f $test.[co] $test $test$shared_ext
155 echo "Please use win32/Makefile.gcc instead." 182 echo "Please use win32/Makefile.gcc instead." | tee -a configure.log
156 exit 1 183 exit 1
157 LDSHARED=${LDSHARED-"$cc -shared"} 184 LDSHARED=${LDSHARED-"$cc -shared"}
158 LDSHAREDLIBC="" 185 LDSHAREDLIBC=""
@@ -184,6 +211,7 @@ else
184 # find system name and corresponding cc options 211 # find system name and corresponding cc options
185 CC=${CC-cc} 212 CC=${CC-cc}
186 gcc=0 213 gcc=0
214 echo ... using $CC >> configure.log
187 if test -z "$uname"; then 215 if test -z "$uname"; then
188 uname=`(uname -sr || echo unknown) 2>/dev/null` 216 uname=`(uname -sr || echo unknown) 2>/dev/null`
189 fi 217 fi
@@ -262,21 +290,19 @@ SHAREDLIB=${SHAREDLIB-"libz$shared_ext"}
262SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"} 290SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"}
263SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"} 291SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"}
264 292
293echo >> configure.log
294
265if test $shared -eq 1; then 295if test $shared -eq 1; then
266 echo Checking for shared library support... 296 echo Checking for shared library support... | tee -a configure.log
267 # we must test in two steps (cc then ld), required at least on SunOS 4.x 297 # we must test in two steps (cc then ld), required at least on SunOS 4.x
268 if try $CC -w -c $SFLAGS $test.c && 298 if try $CC -w -c $SFLAGS $test.c &&
269 try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then 299 try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then
270 echo Building shared library $SHAREDLIBV with $CC. 300 echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log
271 elif test -z "$old_cc" -a -z "$old_cflags"; then 301 elif test -z "$old_cc" -a -z "$old_cflags"; then
272 echo No shared library support. 302 echo No shared library support. | tee -a configure.log
273 shared=0; 303 shared=0;
274 else 304 else
275 echo Tested $CC -w -c $SFLAGS $test.c 305 echo 'No shared library support; try without defining CC and CFLAGS' | tee -a configure.log
276 $CC -w -c $SFLAGS $test.c
277 echo Tested $LDSHARED $SFLAGS -o $test$shared_ext $test.o
278 $LDSHARED $SFLAGS -o $test$shared_ext $test.o
279 echo 'No shared library support; try without defining CC and CFLAGS'
280 shared=0; 306 shared=0;
281 fi 307 fi
282fi 308fi
@@ -287,12 +313,27 @@ if test $shared -eq 0; then
287 SHAREDLIB="" 313 SHAREDLIB=""
288 SHAREDLIBV="" 314 SHAREDLIBV=""
289 SHAREDLIBM="" 315 SHAREDLIBM=""
290 echo Building static library $STATICLIB version $VER with $CC. 316 echo Building static library $STATICLIB version $VER with $CC. | tee -a configure.log
291else 317else
292 ALL="static shared" 318 ALL="static shared"
293 TEST="all teststatic testshared" 319 TEST="all teststatic testshared"
294fi 320fi
295 321
322CPP=${CPP-"$CC -E"}
323case $CFLAGS in
324 *ASMV*)
325 echo >> configure.log
326 show "$NM $test.o | grep _hello"
327 if test "`$NM $test.o | grep _hello | tee -a configure.log`" = ""; then
328 CPP="$CPP -DNO_UNDERLINE"
329 echo Checking for underline in external names... No. | tee -a configure.log
330 else
331 echo Checking for underline in external names... Yes. | tee -a configure.log
332 fi ;;
333esac
334
335echo >> configure.log
336
296cat > $test.c <<EOF 337cat > $test.c <<EOF
297#include <sys/types.h> 338#include <sys/types.h>
298off64_t dummy = 0; 339off64_t dummy = 0;
@@ -302,10 +343,11 @@ if try $CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c; then
302 SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1" 343 SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1"
303 ALL="${ALL} all64" 344 ALL="${ALL} all64"
304 TEST="${TEST} test64" 345 TEST="${TEST} test64"
305 echo "Checking for off64_t... Yes." 346 echo "Checking for off64_t... Yes." | tee -a configure.log
306 echo "Checking for fseeko... Yes." 347 echo "Checking for fseeko... Yes." | tee -a configure.log
307else 348else
308 echo "Checking for off64_t... No." 349 echo "Checking for off64_t... No." | tee -a configure.log
350 echo >> configure.log
309 cat > $test.c <<EOF 351 cat > $test.c <<EOF
310#include <stdio.h> 352#include <stdio.h>
311int main(void) { 353int main(void) {
@@ -314,16 +356,18 @@ int main(void) {
314} 356}
315EOF 357EOF
316 if try $CC $CFLAGS -o $test $test.c; then 358 if try $CC $CFLAGS -o $test $test.c; then
317 echo "Checking for fseeko... Yes." 359 echo "Checking for fseeko... Yes." | tee -a configure.log
318 else 360 else
319 CFLAGS="${CFLAGS} -DNO_FSEEKO" 361 CFLAGS="${CFLAGS} -DNO_FSEEKO"
320 SFLAGS="${SFLAGS} -DNO_FSEEKO" 362 SFLAGS="${SFLAGS} -DNO_FSEEKO"
321 echo "Checking for fseeko... No." 363 echo "Checking for fseeko... No." | tee -a configure.log
322 fi 364 fi
323fi 365fi
324 366
325cp -p zconf.h.in zconf.h 367cp -p zconf.h.in zconf.h
326 368
369echo >> configure.log
370
327cat > $test.c <<EOF 371cat > $test.c <<EOF
328#include <unistd.h> 372#include <unistd.h>
329int main() { return 0; } 373int main() { return 0; }
@@ -331,11 +375,13 @@ EOF
331if try $CC -c $CFLAGS $test.c; then 375if try $CC -c $CFLAGS $test.c; then
332 sed < zconf.h "/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be/ 1\1 was/" > zconf.temp.h 376 sed < zconf.h "/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
333 mv zconf.temp.h zconf.h 377 mv zconf.temp.h zconf.h
334 echo "Checking for unistd.h... Yes." 378 echo "Checking for unistd.h... Yes." | tee -a configure.log
335else 379else
336 echo "Checking for unistd.h... No." 380 echo "Checking for unistd.h... No." | tee -a configure.log
337fi 381fi
338 382
383echo >> configure.log
384
339cat > $test.c <<EOF 385cat > $test.c <<EOF
340#include <stdarg.h> 386#include <stdarg.h>
341int main() { return 0; } 387int main() { return 0; }
@@ -343,15 +389,16 @@ EOF
343if try $CC -c $CFLAGS $test.c; then 389if try $CC -c $CFLAGS $test.c; then
344 sed < zconf.h "/^#ifdef HAVE_STDARG_H.* may be/s/def HAVE_STDARG_H\(.*\) may be/ 1\1 was/" > zconf.temp.h 390 sed < zconf.h "/^#ifdef HAVE_STDARG_H.* may be/s/def HAVE_STDARG_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
345 mv zconf.temp.h zconf.h 391 mv zconf.temp.h zconf.h
346 echo "Checking for stdarg.h... Yes." 392 echo "Checking for stdarg.h... Yes." | tee -a configure.log
347else 393else
348 echo "Checking for stdarg.h... No." 394 echo "Checking for stdarg.h... No." | tee -a configure.log
349fi 395fi
350 396
351if test $zprefix -eq 1; then 397if test $zprefix -eq 1; then
352 sed < zconf.h "/#ifdef Z_PREFIX.* may be/s/def Z_PREFIX\(.*\) may be/ 1\1 was/" > zconf.temp.h 398 sed < zconf.h "/#ifdef Z_PREFIX.* may be/s/def Z_PREFIX\(.*\) may be/ 1\1 was/" > zconf.temp.h
353 mv zconf.temp.h zconf.h 399 mv zconf.temp.h zconf.h
354 echo "Using z_ prefix on all symbols." 400 echo >> configure.log
401 echo "Using z_ prefix on all symbols." | tee -a configure.log
355fi 402fi
356 403
357if test $solo -eq 1; then 404if test $solo -eq 1; then
@@ -368,63 +415,59 @@ if test $cover -eq 1; then
368 CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage" 415 CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage"
369fi 416fi
370 417
418echo >> configure.log
419
371cat > $test.c <<EOF 420cat > $test.c <<EOF
372#include <stdio.h> 421#include <stdio.h>
373#include <stdarg.h> 422#include <stdarg.h>
374#include "zconf.h" 423#include "zconf.h"
375
376int main() 424int main()
377{ 425{
378#ifndef STDC 426#ifndef STDC
379 choke me 427 choke me
380#endif 428#endif
381
382 return 0; 429 return 0;
383} 430}
384EOF 431EOF
385 432
386if try $CC -c $CFLAGS $test.c; then 433if try $CC -c $CFLAGS $test.c; then
387 echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()." 434 echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()." | tee -a configure.log
388 435
436 echo >> configure.log
389 cat > $test.c <<EOF 437 cat > $test.c <<EOF
390#include <stdio.h> 438#include <stdio.h>
391#include <stdarg.h> 439#include <stdarg.h>
392
393int mytest(const char *fmt, ...) 440int mytest(const char *fmt, ...)
394{ 441{
395 char buf[20]; 442 char buf[20];
396 va_list ap; 443 va_list ap;
397
398 va_start(ap, fmt); 444 va_start(ap, fmt);
399 vsnprintf(buf, sizeof(buf), fmt, ap); 445 vsnprintf(buf, sizeof(buf), fmt, ap);
400 va_end(ap); 446 va_end(ap);
401 return 0; 447 return 0;
402} 448}
403
404int main() 449int main()
405{ 450{
406 return (mytest("Hello%d\n", 1)); 451 return (mytest("Hello%d\n", 1));
407} 452}
408EOF 453EOF
409 if try $CC $CFLAGS -o $test $test.c; then 454 if try $CC $CFLAGS -o $test $test.c; then
410 echo "Checking for vsnprintf() in stdio.h... Yes." 455 echo "Checking for vsnprintf() in stdio.h... Yes." | tee -a configure.log
411 456
457 echo >> configure.log
412 cat >$test.c <<EOF 458 cat >$test.c <<EOF
413#include <stdio.h> 459#include <stdio.h>
414#include <stdarg.h> 460#include <stdarg.h>
415
416int mytest(const char *fmt, ...) 461int mytest(const char *fmt, ...)
417{ 462{
418 int n; 463 int n;
419 char buf[20]; 464 char buf[20];
420 va_list ap; 465 va_list ap;
421
422 va_start(ap, fmt); 466 va_start(ap, fmt);
423 n = vsnprintf(buf, sizeof(buf), fmt, ap); 467 n = vsnprintf(buf, sizeof(buf), fmt, ap);
424 va_end(ap); 468 va_end(ap);
425 return n; 469 return n;
426} 470}
427
428int main() 471int main()
429{ 472{
430 return (mytest("Hello%d\n", 1)); 473 return (mytest("Hello%d\n", 1));
@@ -432,39 +475,37 @@ int main()
432EOF 475EOF
433 476
434 if try $CC -c $CFLAGS $test.c; then 477 if try $CC -c $CFLAGS $test.c; then
435 echo "Checking for return value of vsnprintf()... Yes." 478 echo "Checking for return value of vsnprintf()... Yes." | tee -a configure.log
436 else 479 else
437 CFLAGS="$CFLAGS -DHAS_vsnprintf_void" 480 CFLAGS="$CFLAGS -DHAS_vsnprintf_void"
438 SFLAGS="$SFLAGS -DHAS_vsnprintf_void" 481 SFLAGS="$SFLAGS -DHAS_vsnprintf_void"
439 echo "Checking for return value of vsnprintf()... No." 482 echo "Checking for return value of vsnprintf()... No." | tee -a configure.log
440 echo " WARNING: apparently vsnprintf() does not return a value. zlib" 483 echo " WARNING: apparently vsnprintf() does not return a value. zlib" | tee -a configure.log
441 echo " can build but will be open to possible string-format security" 484 echo " can build but will be open to possible string-format security" | tee -a configure.log
442 echo " vulnerabilities." 485 echo " vulnerabilities." | tee -a configure.log
443 fi 486 fi
444 else 487 else
445 CFLAGS="$CFLAGS -DNO_vsnprintf" 488 CFLAGS="$CFLAGS -DNO_vsnprintf"
446 SFLAGS="$SFLAGS -DNO_vsnprintf" 489 SFLAGS="$SFLAGS -DNO_vsnprintf"
447 echo "Checking for vsnprintf() in stdio.h... No." 490 echo "Checking for vsnprintf() in stdio.h... No." | tee -a configure.log
448 echo " WARNING: vsnprintf() not found, falling back to vsprintf(). zlib" 491 echo " WARNING: vsnprintf() not found, falling back to vsprintf(). zlib" | tee -a configure.log
449 echo " can build but will be open to possible buffer-overflow security" 492 echo " can build but will be open to possible buffer-overflow security" | tee -a configure.log
450 echo " vulnerabilities." 493 echo " vulnerabilities." | tee -a configure.log
451 494
495 echo >> configure.log
452 cat >$test.c <<EOF 496 cat >$test.c <<EOF
453#include <stdio.h> 497#include <stdio.h>
454#include <stdarg.h> 498#include <stdarg.h>
455
456int mytest(const char *fmt, ...) 499int mytest(const char *fmt, ...)
457{ 500{
458 int n; 501 int n;
459 char buf[20]; 502 char buf[20];
460 va_list ap; 503 va_list ap;
461
462 va_start(ap, fmt); 504 va_start(ap, fmt);
463 n = vsprintf(buf, fmt, ap); 505 n = vsprintf(buf, fmt, ap);
464 va_end(ap); 506 va_end(ap);
465 return n; 507 return n;
466} 508}
467
468int main() 509int main()
469{ 510{
470 return (mytest("Hello%d\n", 1)); 511 return (mytest("Hello%d\n", 1));
@@ -472,30 +513,28 @@ int main()
472EOF 513EOF
473 514
474 if try $CC -c $CFLAGS $test.c; then 515 if try $CC -c $CFLAGS $test.c; then
475 echo "Checking for return value of vsprintf()... Yes." 516 echo "Checking for return value of vsprintf()... Yes." | tee -a configure.log
476 else 517 else
477 CFLAGS="$CFLAGS -DHAS_vsprintf_void" 518 CFLAGS="$CFLAGS -DHAS_vsprintf_void"
478 SFLAGS="$SFLAGS -DHAS_vsprintf_void" 519 SFLAGS="$SFLAGS -DHAS_vsprintf_void"
479 echo "Checking for return value of vsprintf()... No." 520 echo "Checking for return value of vsprintf()... No." | tee -a configure.log
480 echo " WARNING: apparently vsprintf() does not return a value. zlib" 521 echo " WARNING: apparently vsprintf() does not return a value. zlib" | tee -a configure.log
481 echo " can build but will be open to possible string-format security" 522 echo " can build but will be open to possible string-format security" | tee -a configure.log
482 echo " vulnerabilities." 523 echo " vulnerabilities." | tee -a configure.log
483 fi 524 fi
484 fi 525 fi
485else 526else
486 echo "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()." 527 echo "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()." | tee -a configure.log
487 528
529 echo >> configure.log
488 cat >$test.c <<EOF 530 cat >$test.c <<EOF
489#include <stdio.h> 531#include <stdio.h>
490
491int mytest() 532int mytest()
492{ 533{
493 char buf[20]; 534 char buf[20];
494
495 snprintf(buf, sizeof(buf), "%s", "foo"); 535 snprintf(buf, sizeof(buf), "%s", "foo");
496 return 0; 536 return 0;
497} 537}
498
499int main() 538int main()
500{ 539{
501 return (mytest()); 540 return (mytest());
@@ -503,18 +542,16 @@ int main()
503EOF 542EOF
504 543
505 if try $CC $CFLAGS -o $test $test.c; then 544 if try $CC $CFLAGS -o $test $test.c; then
506 echo "Checking for snprintf() in stdio.h... Yes." 545 echo "Checking for snprintf() in stdio.h... Yes." | tee -a configure.log
507 546
547 echo >> configure.log
508 cat >$test.c <<EOF 548 cat >$test.c <<EOF
509#include <stdio.h> 549#include <stdio.h>
510
511int mytest() 550int mytest()
512{ 551{
513 char buf[20]; 552 char buf[20];
514
515 return snprintf(buf, sizeof(buf), "%s", "foo"); 553 return snprintf(buf, sizeof(buf), "%s", "foo");
516} 554}
517
518int main() 555int main()
519{ 556{
520 return (mytest()); 557 return (mytest());
@@ -522,33 +559,31 @@ int main()
522EOF 559EOF
523 560
524 if try $CC -c $CFLAGS $test.c; then 561 if try $CC -c $CFLAGS $test.c; then
525 echo "Checking for return value of snprintf()... Yes." 562 echo "Checking for return value of snprintf()... Yes." | tee -a configure.log
526 else 563 else
527 CFLAGS="$CFLAGS -DHAS_snprintf_void" 564 CFLAGS="$CFLAGS -DHAS_snprintf_void"
528 SFLAGS="$SFLAGS -DHAS_snprintf_void" 565 SFLAGS="$SFLAGS -DHAS_snprintf_void"
529 echo "Checking for return value of snprintf()... No." 566 echo "Checking for return value of snprintf()... No." | tee -a configure.log
530 echo " WARNING: apparently snprintf() does not return a value. zlib" 567 echo " WARNING: apparently snprintf() does not return a value. zlib" | tee -a configure.log
531 echo " can build but will be open to possible string-format security" 568 echo " can build but will be open to possible string-format security" | tee -a configure.log
532 echo " vulnerabilities." 569 echo " vulnerabilities." | tee -a configure.log
533 fi 570 fi
534 else 571 else
535 CFLAGS="$CFLAGS -DNO_snprintf" 572 CFLAGS="$CFLAGS -DNO_snprintf"
536 SFLAGS="$SFLAGS -DNO_snprintf" 573 SFLAGS="$SFLAGS -DNO_snprintf"
537 echo "Checking for snprintf() in stdio.h... No." 574 echo "Checking for snprintf() in stdio.h... No." | tee -a configure.log
538 echo " WARNING: snprintf() not found, falling back to sprintf(). zlib" 575 echo " WARNING: snprintf() not found, falling back to sprintf(). zlib" | tee -a configure.log
539 echo " can build but will be open to possible buffer-overflow security" 576 echo " can build but will be open to possible buffer-overflow security" | tee -a configure.log
540 echo " vulnerabilities." 577 echo " vulnerabilities." | tee -a configure.log
541 578
579 echo >> configure.log
542 cat >$test.c <<EOF 580 cat >$test.c <<EOF
543#include <stdio.h> 581#include <stdio.h>
544
545int mytest() 582int mytest()
546{ 583{
547 char buf[20]; 584 char buf[20];
548
549 return sprintf(buf, "%s", "foo"); 585 return sprintf(buf, "%s", "foo");
550} 586}
551
552int main() 587int main()
553{ 588{
554 return (mytest()); 589 return (mytest());
@@ -556,19 +591,20 @@ int main()
556EOF 591EOF
557 592
558 if try $CC -c $CFLAGS $test.c; then 593 if try $CC -c $CFLAGS $test.c; then
559 echo "Checking for return value of sprintf()... Yes." 594 echo "Checking for return value of sprintf()... Yes." | tee -a configure.log
560 else 595 else
561 CFLAGS="$CFLAGS -DHAS_sprintf_void" 596 CFLAGS="$CFLAGS -DHAS_sprintf_void"
562 SFLAGS="$SFLAGS -DHAS_sprintf_void" 597 SFLAGS="$SFLAGS -DHAS_sprintf_void"
563 echo "Checking for return value of sprintf()... No." 598 echo "Checking for return value of sprintf()... No." | tee -a configure.log
564 echo " WARNING: apparently sprintf() does not return a value. zlib" 599 echo " WARNING: apparently sprintf() does not return a value. zlib" | tee -a configure.log
565 echo " can build but will be open to possible string-format security" 600 echo " can build but will be open to possible string-format security" | tee -a configure.log
566 echo " vulnerabilities." 601 echo " vulnerabilities." | tee -a configure.log
567 fi 602 fi
568 fi 603 fi
569fi 604fi
570 605
571if test "$gcc" -eq 1; then 606if test "$gcc" -eq 1; then
607 echo >> configure.log
572 cat > $test.c <<EOF 608 cat > $test.c <<EOF
573#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) 609#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33)
574# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) 610# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
@@ -582,27 +618,50 @@ int main()
582} 618}
583EOF 619EOF
584 if try $CC -c $CFLAGS $test.c; then 620 if try $CC -c $CFLAGS $test.c; then
585 echo "Checking for attribute(visibility) support... Yes." 621 echo "Checking for attribute(visibility) support... Yes." | tee -a configure.log
586 else 622 else
587 CFLAGS="$CFLAGS -DNO_VIZ" 623 CFLAGS="$CFLAGS -DNO_VIZ"
588 SFLAGS="$SFLAGS -DNO_VIZ" 624 SFLAGS="$SFLAGS -DNO_VIZ"
589 echo "Checking for attribute(visibility) support... No." 625 echo "Checking for attribute(visibility) support... No." | tee -a configure.log
590 fi 626 fi
591fi 627fi
592 628
593CPP=${CPP-"$CC -E"}
594case $CFLAGS in
595 *ASMV*)
596 if test "`$NM $test.o | grep _hello`" = ""; then
597 CPP="$CPP -DNO_UNDERLINE"
598 echo Checking for underline in external names... No.
599 else
600 echo Checking for underline in external names... Yes.
601 fi ;;
602esac
603
604rm -f $test.[co] $test $test$shared_ext $test.gcno 629rm -f $test.[co] $test $test$shared_ext $test.gcno
605 630
631# show the results in the log
632echo >> configure.log
633echo ALL = $ALL >> configure.log
634echo AR = $AR >> configure.log
635echo ARFLAGS = $ARFLAGS >> configure.log
636echo CC = $CC >> configure.log
637echo CFLAGS = $CFLAGS >> configure.log
638echo CPP = $CPP >> configure.log
639echo EXE = $EXE >> configure.log
640echo LDCONFIG = $LDCONFIG >> configure.log
641echo LDFLAGS = $LDFLAGS >> configure.log
642echo LDSHARED = $LDSHARED >> configure.log
643echo LDSHAREDLIBC = $LDSHAREDLIBC >> configure.log
644echo OBJC = $OBJC >> configure.log
645echo PIC_OBJC = $PIC_OBJC >> configure.log
646echo RANLIB = $RANLIB >> configure.log
647echo SFLAGS = $SFLAGS >> configure.log
648echo SHAREDLIB = $SHAREDLIB >> configure.log
649echo SHAREDLIBM = $SHAREDLIBM >> configure.log
650echo SHAREDLIBV = $SHAREDLIBV >> configure.log
651echo STATICLIB = $STATICLIB >> configure.log
652echo TEST = $TEST >> configure.log
653echo VER = $VER >> configure.log
654echo exec_prefix = $exec_prefix >> configure.log
655echo includedir = $includedir >> configure.log
656echo libdir = $libdir >> configure.log
657echo mandir = $mandir >> configure.log
658echo prefix = $prefix >> configure.log
659echo sharedlibdir = $sharedlibdir >> configure.log
660echo uname = $uname >> configure.log
661echo -------------------- >> configure.log
662echo >> configure.log
663echo >> configure.log
664
606# udpate Makefile 665# udpate Makefile
607sed < Makefile.in " 666sed < Makefile.in "
608/^CC *=/s#=.*#=$CC# 667/^CC *=/s#=.*#=$CC#