diff options
| author | Mark Adler <madler@alumni.caltech.edu> | 2012-01-28 14:48:50 -0800 |
|---|---|---|
| committer | Mark Adler <madler@alumni.caltech.edu> | 2012-01-28 14:48:50 -0800 |
| commit | 520561c5771d3145308bed193b136b8cd12c6267 (patch) | |
| tree | 425e12d55206302ca291b30eaed21db9d88e50c4 | |
| parent | 32d8a5379eb91c7fd55304b567a07ad0e2524398 (diff) | |
| download | zlib-520561c5771d3145308bed193b136b8cd12c6267.tar.gz zlib-520561c5771d3145308bed193b136b8cd12c6267.tar.bz2 zlib-520561c5771d3145308bed193b136b8cd12c6267.zip | |
Add the generation of configure.log by ./configure.
| -rw-r--r-- | Makefile.in | 2 | ||||
| -rwxr-xr-x | configure | 259 |
2 files changed, 160 insertions, 101 deletions
diff --git a/Makefile.in b/Makefile.in index 0934cea..ea430bf 100644 --- a/Makefile.in +++ b/Makefile.in | |||
| @@ -250,7 +250,7 @@ clean: | |||
| 250 | 250 | ||
| 251 | maintainer-clean: distclean | 251 | maintainer-clean: distclean |
| 252 | distclean: clean zconf zconf.h.cmakein docs | 252 | distclean: clean zconf zconf.h.cmakein docs |
| 253 | rm -f Makefile zlib.pc | 253 | rm -f Makefile zlib.pc configure.log |
| 254 | -@rm -f .DS_Store | 254 | -@rm -f .DS_Store |
| 255 | -@printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile | 255 | -@printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile |
| 256 | -@printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile | 256 | -@printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile |
| @@ -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 | ||
| 16 | echo -------------------- >> configure.log | ||
| 17 | echo $0 $* >> configure.log | ||
| 18 | date >> configure.log | ||
| 19 | |||
| 16 | if [ -n "${CHOST}" ]; then | 20 | if [ -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` | |||
| 25 | VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h` | 29 | VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h` |
| 26 | if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then | 30 | if "${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 |
| 29 | else | 33 | else |
| 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 |
| 32 | fi | 36 | fi |
| 33 | ARFLAGS=${ARFLAGS-"rc"} | 37 | ARFLAGS=${ARFLAGS-"rc"} |
| 34 | if "${CROSS_PREFIX}ranlib" --version >/dev/null 2>/dev/null || test $? -lt 126; then | 38 | if "${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 |
| 37 | else | 41 | else |
| 38 | RANLIB=${RANLIB-"ranlib"} | 42 | RANLIB=${RANLIB-"ranlib"} |
| 39 | fi | 43 | fi |
| 40 | if "${CROSS_PREFIX}nm" --version >/dev/null 2>/dev/null || test $? -lt 126; then | 44 | if "${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 |
| 43 | else | 47 | else |
| 44 | NM=${NM-"nm"} | 48 | NM=${NM-"nm"} |
| 45 | fi | 49 | fi |
| @@ -68,10 +72,10 @@ while test $# -ge 1 | |||
| 68 | do | 72 | do |
| 69 | case "$1" in | 73 | case "$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 |
| 97 | done | 101 | done |
| 98 | 102 | ||
| 99 | test=ztest$$ | 103 | test=ztest$$ |
| 100 | 104 | ||
| 105 | show() | ||
| 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 | |||
| 101 | cat > $test.c <<EOF | 116 | cat > $test.c <<EOF |
| 102 | #error error | 117 | #error error |
| 103 | EOF | 118 | EOF |
| 104 | if ($CC -c $CFLAGS $test.c) 2>/dev/null; then | 119 | if ($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 | ||
| 109 | else | 126 | else |
| 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 | } |
| 114 | fi | 137 | fi |
| 115 | 138 | ||
| 139 | echo >> configure.log | ||
| 140 | |||
| 116 | cat > $test.c <<EOF | 141 | cat > $test.c <<EOF |
| 117 | extern int getchar(); | 142 | extern int getchar(); |
| 118 | int hello() {return getchar();} | 143 | int hello() {return getchar();} |
| 119 | EOF | 144 | EOF |
| 120 | 145 | ||
| 121 | test -z "$CC" && echo Checking for ${CROSS_PREFIX}gcc... | 146 | test -z "$CC" && echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log |
| 122 | cc=${CC-${CROSS_PREFIX}gcc} | 147 | cc=${CC-${CROSS_PREFIX}gcc} |
| 123 | cflags=${CFLAGS-"-O3"} | 148 | cflags=${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 ;; |
| 130 | esac | 155 | esac |
| 131 | 156 | ||
| 132 | if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then | 157 | show $cc -c $cflags $test.c |
| 158 | if 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"} | |||
| 262 | SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"} | 290 | SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"} |
| 263 | SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"} | 291 | SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"} |
| 264 | 292 | ||
| 293 | echo >> configure.log | ||
| 294 | |||
| 265 | if test $shared -eq 1; then | 295 | if 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 |
| 282 | fi | 308 | fi |
| @@ -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 |
| 291 | else | 317 | else |
| 292 | ALL="static shared" | 318 | ALL="static shared" |
| 293 | TEST="all teststatic testshared" | 319 | TEST="all teststatic testshared" |
| 294 | fi | 320 | fi |
| 295 | 321 | ||
| 322 | CPP=${CPP-"$CC -E"} | ||
| 323 | case $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 ;; | ||
| 333 | esac | ||
| 334 | |||
| 335 | echo >> configure.log | ||
| 336 | |||
| 296 | cat > $test.c <<EOF | 337 | cat > $test.c <<EOF |
| 297 | #include <sys/types.h> | 338 | #include <sys/types.h> |
| 298 | off64_t dummy = 0; | 339 | off64_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 |
| 307 | else | 348 | else |
| 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> |
| 311 | int main(void) { | 353 | int main(void) { |
| @@ -314,16 +356,18 @@ int main(void) { | |||
| 314 | } | 356 | } |
| 315 | EOF | 357 | EOF |
| 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 |
| 323 | fi | 365 | fi |
| 324 | 366 | ||
| 325 | cp -p zconf.h.in zconf.h | 367 | cp -p zconf.h.in zconf.h |
| 326 | 368 | ||
| 369 | echo >> configure.log | ||
| 370 | |||
| 327 | cat > $test.c <<EOF | 371 | cat > $test.c <<EOF |
| 328 | #include <unistd.h> | 372 | #include <unistd.h> |
| 329 | int main() { return 0; } | 373 | int main() { return 0; } |
| @@ -331,11 +375,13 @@ EOF | |||
| 331 | if try $CC -c $CFLAGS $test.c; then | 375 | if 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 |
| 335 | else | 379 | else |
| 336 | echo "Checking for unistd.h... No." | 380 | echo "Checking for unistd.h... No." | tee -a configure.log |
| 337 | fi | 381 | fi |
| 338 | 382 | ||
| 383 | echo >> configure.log | ||
| 384 | |||
| 339 | cat > $test.c <<EOF | 385 | cat > $test.c <<EOF |
| 340 | #include <stdarg.h> | 386 | #include <stdarg.h> |
| 341 | int main() { return 0; } | 387 | int main() { return 0; } |
| @@ -343,15 +389,16 @@ EOF | |||
| 343 | if try $CC -c $CFLAGS $test.c; then | 389 | if 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 |
| 347 | else | 393 | else |
| 348 | echo "Checking for stdarg.h... No." | 394 | echo "Checking for stdarg.h... No." | tee -a configure.log |
| 349 | fi | 395 | fi |
| 350 | 396 | ||
| 351 | if test $zprefix -eq 1; then | 397 | if 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 | ||
| 355 | fi | 402 | fi |
| 356 | 403 | ||
| 357 | if test $solo -eq 1; then | 404 | if 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" |
| 369 | fi | 416 | fi |
| 370 | 417 | ||
| 418 | echo >> configure.log | ||
| 419 | |||
| 371 | cat > $test.c <<EOF | 420 | cat > $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 | |||
| 376 | int main() | 424 | int 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 | } |
| 384 | EOF | 431 | EOF |
| 385 | 432 | ||
| 386 | if try $CC -c $CFLAGS $test.c; then | 433 | if 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 | |||
| 393 | int mytest(const char *fmt, ...) | 440 | int 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 | |||
| 404 | int main() | 449 | int main() |
| 405 | { | 450 | { |
| 406 | return (mytest("Hello%d\n", 1)); | 451 | return (mytest("Hello%d\n", 1)); |
| 407 | } | 452 | } |
| 408 | EOF | 453 | EOF |
| 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 | |||
| 416 | int mytest(const char *fmt, ...) | 461 | int 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 | |||
| 428 | int main() | 471 | int main() |
| 429 | { | 472 | { |
| 430 | return (mytest("Hello%d\n", 1)); | 473 | return (mytest("Hello%d\n", 1)); |
| @@ -432,39 +475,37 @@ int main() | |||
| 432 | EOF | 475 | EOF |
| 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 | |||
| 456 | int mytest(const char *fmt, ...) | 499 | int 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 | |||
| 468 | int main() | 509 | int main() |
| 469 | { | 510 | { |
| 470 | return (mytest("Hello%d\n", 1)); | 511 | return (mytest("Hello%d\n", 1)); |
| @@ -472,30 +513,28 @@ int main() | |||
| 472 | EOF | 513 | EOF |
| 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 |
| 485 | else | 526 | else |
| 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 | |||
| 491 | int mytest() | 532 | int 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 | |||
| 499 | int main() | 538 | int main() |
| 500 | { | 539 | { |
| 501 | return (mytest()); | 540 | return (mytest()); |
| @@ -503,18 +542,16 @@ int main() | |||
| 503 | EOF | 542 | EOF |
| 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 | |||
| 511 | int mytest() | 550 | int 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 | |||
| 518 | int main() | 555 | int main() |
| 519 | { | 556 | { |
| 520 | return (mytest()); | 557 | return (mytest()); |
| @@ -522,33 +559,31 @@ int main() | |||
| 522 | EOF | 559 | EOF |
| 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 | |||
| 545 | int mytest() | 582 | int 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 | |||
| 552 | int main() | 587 | int main() |
| 553 | { | 588 | { |
| 554 | return (mytest()); | 589 | return (mytest()); |
| @@ -556,19 +591,20 @@ int main() | |||
| 556 | EOF | 591 | EOF |
| 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 |
| 569 | fi | 604 | fi |
| 570 | 605 | ||
| 571 | if test "$gcc" -eq 1; then | 606 | if 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 | } |
| 583 | EOF | 619 | EOF |
| 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 |
| 591 | fi | 627 | fi |
| 592 | 628 | ||
| 593 | CPP=${CPP-"$CC -E"} | ||
| 594 | case $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 ;; | ||
| 602 | esac | ||
| 603 | |||
| 604 | rm -f $test.[co] $test $test$shared_ext $test.gcno | 629 | rm -f $test.[co] $test $test$shared_ext $test.gcno |
| 605 | 630 | ||
| 631 | # show the results in the log | ||
| 632 | echo >> configure.log | ||
| 633 | echo ALL = $ALL >> configure.log | ||
| 634 | echo AR = $AR >> configure.log | ||
| 635 | echo ARFLAGS = $ARFLAGS >> configure.log | ||
| 636 | echo CC = $CC >> configure.log | ||
| 637 | echo CFLAGS = $CFLAGS >> configure.log | ||
| 638 | echo CPP = $CPP >> configure.log | ||
| 639 | echo EXE = $EXE >> configure.log | ||
| 640 | echo LDCONFIG = $LDCONFIG >> configure.log | ||
| 641 | echo LDFLAGS = $LDFLAGS >> configure.log | ||
| 642 | echo LDSHARED = $LDSHARED >> configure.log | ||
| 643 | echo LDSHAREDLIBC = $LDSHAREDLIBC >> configure.log | ||
| 644 | echo OBJC = $OBJC >> configure.log | ||
| 645 | echo PIC_OBJC = $PIC_OBJC >> configure.log | ||
| 646 | echo RANLIB = $RANLIB >> configure.log | ||
| 647 | echo SFLAGS = $SFLAGS >> configure.log | ||
| 648 | echo SHAREDLIB = $SHAREDLIB >> configure.log | ||
| 649 | echo SHAREDLIBM = $SHAREDLIBM >> configure.log | ||
| 650 | echo SHAREDLIBV = $SHAREDLIBV >> configure.log | ||
| 651 | echo STATICLIB = $STATICLIB >> configure.log | ||
| 652 | echo TEST = $TEST >> configure.log | ||
| 653 | echo VER = $VER >> configure.log | ||
| 654 | echo exec_prefix = $exec_prefix >> configure.log | ||
| 655 | echo includedir = $includedir >> configure.log | ||
| 656 | echo libdir = $libdir >> configure.log | ||
| 657 | echo mandir = $mandir >> configure.log | ||
| 658 | echo prefix = $prefix >> configure.log | ||
| 659 | echo sharedlibdir = $sharedlibdir >> configure.log | ||
| 660 | echo uname = $uname >> configure.log | ||
| 661 | echo -------------------- >> configure.log | ||
| 662 | echo >> configure.log | ||
| 663 | echo >> configure.log | ||
| 664 | |||
| 606 | # udpate Makefile | 665 | # udpate Makefile |
| 607 | sed < Makefile.in " | 666 | sed < Makefile.in " |
| 608 | /^CC *=/s#=.*#=$CC# | 667 | /^CC *=/s#=.*#=$CC# |
