configure revision 1.1.1.4
11.1Schristos#!/bin/sh 21.1.1.2Schristos# configure script for zlib. 31.1Schristos# 41.1.1.2Schristos# Normally configure builds both a static and a shared library. 51.1.1.2Schristos# If you want to build just a static library, use: ./configure --static 61.1Schristos# 71.1Schristos# To impose specific compiler or flags or install directory, use for example: 81.1Schristos# prefix=$HOME CC=cc CFLAGS="-O4" ./configure 91.1Schristos# or for csh/tcsh users: 101.1Schristos# (setenv prefix $HOME; setenv CC cc; setenv CFLAGS "-O4"; ./configure) 111.1Schristos 121.1Schristos# Incorrect settings of CC or CFLAGS may prevent creating a shared library. 131.1Schristos# If you have problems, try without defining CC and CFLAGS before reporting 141.1Schristos# an error. 151.1Schristos 161.1.1.2Schristos# start off configure.log 171.1.1.2Schristosecho -------------------- >> configure.log 181.1.1.2Schristosecho $0 $* >> configure.log 191.1.1.2Schristosdate >> configure.log 201.1.1.2Schristos 211.1.1.2Schristos# get source directory 221.1.1.2SchristosSRCDIR=`dirname $0` 231.1.1.2Schristosif test $SRCDIR = "."; then 241.1.1.2Schristos ZINC="" 251.1.1.2Schristos ZINCOUT="-I." 261.1.1.2Schristos SRCDIR="" 271.1.1.2Schristoselse 281.1.1.4Schristos ZINC='-I. -include zconf.h' 291.1.1.2Schristos ZINCOUT='-I. -I$(SRCDIR)' 301.1.1.2Schristos SRCDIR="$SRCDIR/" 311.1.1.2Schristosfi 321.1.1.2Schristos 331.1.1.2Schristos# set command prefix for cross-compilation 341.1.1.2Schristosif [ -n "${CHOST}" ]; then 351.1.1.3Schristos uname=${CHOST} 361.1.1.3Schristos mname=${CHOST} 371.1.1.2Schristos CROSS_PREFIX="${CHOST}-" 381.1.1.3Schristoselse 391.1.1.3Schristos mname=`(uname -a || echo unknown) 2>/dev/null` 401.1.1.2Schristosfi 411.1.1.2Schristos 421.1.1.2Schristos# destination name for static library 431.1.1.2SchristosSTATICLIB=libz.a 441.1.1.2Schristos 451.1.1.2Schristos# extract zlib version numbers from zlib.h 461.1.1.2SchristosVER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}zlib.h` 471.1.1.4SchristosVER3=`echo ${VER}|sed -n -e 's/\([0-9]\{1,\}\(\\.[0-9]\{1,\}\)\{1,2\}\).*/\1/p'` 481.1.1.4SchristosVER1=`echo ${VER}|sed -n -e 's/\([0-9]\{1,\}\)\\..*/\1/p'` 491.1.1.2Schristos 501.1.1.2Schristos# establish commands for library building 511.1.1.2Schristosif "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then 521.1.1.2Schristos AR=${AR-"${CROSS_PREFIX}ar"} 531.1.1.2Schristos test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log 541.1.1.2Schristoselse 551.1.1.2Schristos AR=${AR-"ar"} 561.1.1.2Schristos test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log 571.1.1.2Schristosfi 581.1.1.2SchristosARFLAGS=${ARFLAGS-"rc"} 591.1.1.2Schristosif "${CROSS_PREFIX}ranlib" --version >/dev/null 2>/dev/null || test $? -lt 126; then 601.1.1.2Schristos RANLIB=${RANLIB-"${CROSS_PREFIX}ranlib"} 611.1.1.2Schristos test -n "${CROSS_PREFIX}" && echo Using ${RANLIB} | tee -a configure.log 621.1.1.2Schristoselse 631.1.1.2Schristos RANLIB=${RANLIB-"ranlib"} 641.1.1.2Schristosfi 651.1.1.2Schristosif "${CROSS_PREFIX}nm" --version >/dev/null 2>/dev/null || test $? -lt 126; then 661.1.1.2Schristos NM=${NM-"${CROSS_PREFIX}nm"} 671.1.1.2Schristos test -n "${CROSS_PREFIX}" && echo Using ${NM} | tee -a configure.log 681.1.1.2Schristoselse 691.1.1.2Schristos NM=${NM-"nm"} 701.1.1.2Schristosfi 711.1.1.2Schristos 721.1.1.2Schristos# set defaults before processing command line options 731.1.1.2SchristosLDCONFIG=${LDCONFIG-"ldconfig"} 741.1.1.2SchristosLDSHAREDLIBC="${LDSHAREDLIBC--lc}" 751.1.1.2SchristosARCHS= 761.1Schristosprefix=${prefix-/usr/local} 771.1Schristosexec_prefix=${exec_prefix-'${prefix}'} 781.1Schristoslibdir=${libdir-'${exec_prefix}/lib'} 791.1.1.2Schristossharedlibdir=${sharedlibdir-'${libdir}'} 801.1Schristosincludedir=${includedir-'${prefix}/include'} 811.1Schristosmandir=${mandir-'${prefix}/share/man'} 821.1Schristosshared_ext='.so' 831.1.1.2Schristosshared=1 841.1.1.2Schristossolo=0 851.1.1.2Schristoscover=0 861.1.1.2Schristoszprefix=0 871.1.1.2Schristoszconst=0 881.1.1.2Schristosbuild64=0 891.1Schristosgcc=0 901.1.1.2Schristoswarn=0 911.1.1.2Schristosdebug=0 921.1.1.4Schristosaddress=0 931.1.1.4Schristosmemory=0 941.1Schristosold_cc="$CC" 951.1Schristosold_cflags="$CFLAGS" 961.1.1.2SchristosOBJC='$(OBJZ) $(OBJG)' 971.1.1.2SchristosPIC_OBJC='$(PIC_OBJZ) $(PIC_OBJG)' 981.1.1.2Schristos 991.1.1.2Schristos# leave this script, optionally in a bad way 1001.1.1.2Schristosleave() 1011.1.1.2Schristos{ 1021.1.1.2Schristos if test "$*" != "0"; then 1031.1.1.2Schristos echo "** $0 aborting." | tee -a configure.log 1041.1.1.2Schristos fi 1051.1.1.4Schristos rm -rf $test.[co] $test $test$shared_ext $test.gcno $test.dSYM ./--version 1061.1.1.2Schristos echo -------------------- >> configure.log 1071.1.1.2Schristos echo >> configure.log 1081.1.1.2Schristos echo >> configure.log 1091.1.1.2Schristos exit $1 1101.1.1.2Schristos} 1111.1Schristos 1121.1.1.2Schristos# process command line options 1131.1Schristoswhile test $# -ge 1 1141.1Schristosdo 1151.1Schristoscase "$1" in 1161.1.1.2Schristos -h* | --help) 1171.1.1.2Schristos echo 'usage:' | tee -a configure.log 1181.1.1.2Schristos echo ' configure [--const] [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a configure.log 1191.1.1.2Schristos echo ' [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log 1201.1.1.2Schristos echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log 1211.1.1.2Schristos exit 0 ;; 1221.1.1.2Schristos -p*=* | --prefix=*) prefix=`echo $1 | sed 's/.*=//'`; shift ;; 1231.1.1.2Schristos -e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/.*=//'`; shift ;; 1241.1.1.2Schristos -l*=* | --libdir=*) libdir=`echo $1 | sed 's/.*=//'`; shift ;; 1251.1.1.2Schristos --sharedlibdir=*) sharedlibdir=`echo $1 | sed 's/.*=//'`; shift ;; 1261.1.1.2Schristos -i*=* | --includedir=*) includedir=`echo $1 | sed 's/.*=//'`;shift ;; 1271.1.1.2Schristos -u*=* | --uname=*) uname=`echo $1 | sed 's/.*=//'`;shift ;; 1281.1.1.2Schristos -p* | --prefix) prefix="$2"; shift; shift ;; 1291.1.1.2Schristos -e* | --eprefix) exec_prefix="$2"; shift; shift ;; 1301.1.1.2Schristos -l* | --libdir) libdir="$2"; shift; shift ;; 1311.1.1.2Schristos -i* | --includedir) includedir="$2"; shift; shift ;; 1321.1.1.2Schristos -s* | --shared | --enable-shared) shared=1; shift ;; 1331.1.1.2Schristos -t | --static) shared=0; shift ;; 1341.1.1.2Schristos --solo) solo=1; shift ;; 1351.1.1.2Schristos --cover) cover=1; shift ;; 1361.1.1.2Schristos -z* | --zprefix) zprefix=1; shift ;; 1371.1.1.2Schristos -6* | --64) build64=1; shift ;; 1381.1.1.2Schristos -a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;; 1391.1.1.2Schristos --sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;; 1401.1.1.2Schristos --localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;; 1411.1.1.2Schristos -c* | --const) zconst=1; shift ;; 1421.1.1.2Schristos -w* | --warn) warn=1; shift ;; 1431.1.1.2Schristos -d* | --debug) debug=1; shift ;; 1441.1.1.4Schristos --sanitize) address=1; shift ;; 1451.1.1.4Schristos --address) address=1; shift ;; 1461.1.1.4Schristos --memory) memory=1; shift ;; 1471.1.1.2Schristos *) 1481.1.1.2Schristos echo "unknown option: $1" | tee -a configure.log 1491.1.1.2Schristos echo "$0 --help for help" | tee -a configure.log 1501.1.1.2Schristos leave 1;; 1511.1Schristos esac 1521.1Schristosdone 1531.1Schristos 1541.1.1.2Schristos# temporary file name 1551.1Schristostest=ztest$$ 1561.1.1.2Schristos 1571.1.1.2Schristos# put arguments in log, also put test file in log if used in arguments 1581.1.1.2Schristosshow() 1591.1.1.2Schristos{ 1601.1.1.2Schristos case "$*" in 1611.1.1.2Schristos *$test.c*) 1621.1.1.2Schristos echo === $test.c === >> configure.log 1631.1.1.2Schristos cat $test.c >> configure.log 1641.1.1.2Schristos echo === >> configure.log;; 1651.1.1.2Schristos esac 1661.1.1.2Schristos echo $* >> configure.log 1671.1.1.2Schristos} 1681.1.1.2Schristos 1691.1.1.2Schristos# check for gcc vs. cc and set compile and link flags based on the system identified by uname 1701.1Schristoscat > $test.c <<EOF 1711.1Schristosextern int getchar(); 1721.1Schristosint hello() {return getchar();} 1731.1SchristosEOF 1741.1Schristos 1751.1.1.3Schristosif test -z "$CC"; then 1761.1.1.3Schristos echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log 1771.1.1.3Schristos if ${CROSS_PREFIX}gcc -v >/dev/null 2>&1; then 1781.1.1.3Schristos cc=${CROSS_PREFIX}gcc 1791.1.1.3Schristos else 1801.1.1.3Schristos cc=${CROSS_PREFIX}cc 1811.1.1.3Schristos fi 1821.1.1.3Schristoselse 1831.1.1.3Schristos cc=${CC} 1841.1.1.3Schristosfi 1851.1.1.3Schristos 1861.1Schristoscase "$cc" in 1871.1.1.2Schristos *gcc*) gcc=1 ;; 1881.1.1.2Schristos *clang*) gcc=1 ;; 1891.1.1.2Schristosesac 1901.1.1.2Schristoscase `$cc -v 2>&1` in 1911.1.1.2Schristos *gcc*) gcc=1 ;; 1921.1.1.2Schristos *clang*) gcc=1 ;; 1931.1Schristosesac 1941.1Schristos 1951.1.1.2Schristosshow $cc -c $test.c 1961.1.1.2Schristosif test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then 1971.1.1.2Schristos echo ... using gcc >> configure.log 1981.1Schristos CC="$cc" 1991.1.1.2Schristos CFLAGS="${CFLAGS--O3}" 2001.1.1.2Schristos SFLAGS="${CFLAGS--O3} -fPIC" 2011.1.1.2Schristos if test "$ARCHS"; then 2021.1.1.2Schristos CFLAGS="${CFLAGS} ${ARCHS}" 2031.1.1.2Schristos LDFLAGS="${LDFLAGS} ${ARCHS}" 2041.1.1.2Schristos fi 2051.1.1.2Schristos if test $build64 -eq 1; then 2061.1.1.2Schristos CFLAGS="${CFLAGS} -m64" 2071.1.1.2Schristos SFLAGS="${SFLAGS} -m64" 2081.1.1.2Schristos fi 2091.1.1.2Schristos if test "$warn" -eq 1; then 2101.1.1.2Schristos if test "$zconst" -eq 1; then 2111.1.1.3Schristos CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -DZLIB_CONST" 2121.1.1.2Schristos else 2131.1.1.3Schristos CFLAGS="${CFLAGS} -Wall -Wextra" 2141.1.1.2Schristos fi 2151.1.1.2Schristos fi 2161.1.1.4Schristos if test $address -eq 1; then 2171.1.1.4Schristos CFLAGS="${CFLAGS} -g -fsanitize=address -fno-omit-frame-pointer" 2181.1.1.4Schristos fi 2191.1.1.4Schristos if test $memory -eq 1; then 2201.1.1.4Schristos CFLAGS="${CFLAGS} -g -fsanitize=memory -fno-omit-frame-pointer" 2211.1.1.3Schristos fi 2221.1.1.2Schristos if test $debug -eq 1; then 2231.1.1.2Schristos CFLAGS="${CFLAGS} -DZLIB_DEBUG" 2241.1.1.2Schristos SFLAGS="${SFLAGS} -DZLIB_DEBUG" 2251.1.1.2Schristos fi 2261.1.1.2Schristos if test -z "$uname"; then 2271.1.1.2Schristos uname=`(uname -s || echo unknown) 2>/dev/null` 2281.1.1.2Schristos fi 2291.1.1.2Schristos case "$uname" in 2301.1.1.3Schristos Linux* | linux* | *-linux* | GNU | GNU/* | solaris*) 2311.1.1.3Schristos case "$mname" in 2321.1.1.3Schristos *sparc*) 2331.1.1.3Schristos LDFLAGS="${LDFLAGS} -Wl,--no-warn-rwx-segments" ;; 2341.1.1.3Schristos esac 2351.1.1.2Schristos LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"} ;; 2361.1.1.2Schristos *BSD | *bsd* | DragonFly) 2371.1.1.2Schristos LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"} 2381.1.1.2Schristos LDCONFIG="ldconfig -m" ;; 2391.1.1.3Schristos CYGWIN* | Cygwin* | cygwin* | *-cygwin* | OS/2*) 2401.1.1.2Schristos EXE='.exe' ;; 2411.1.1.3Schristos MINGW* | mingw* | *-mingw*) 2421.1.1.2Schristos rm -f $test.[co] $test $test$shared_ext 2431.1.1.3Schristos echo "If this doesn't work for you, try win32/Makefile.gcc." | tee -a configure.log 2441.1.1.2Schristos LDSHARED=${LDSHARED-"$cc -shared"} 2451.1.1.2Schristos LDSHAREDLIBC="" 2461.1.1.2Schristos EXE='.exe' ;; 2471.1.1.3Schristos QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4 2481.1.1.3Schristos # (alain.bonnefoy@icbt.com) 2491.1.1.3Schristos LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"} ;; 2501.1Schristos HP-UX*) 2511.1.1.3Schristos LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"} 2521.1.1.3Schristos case `(uname -m || echo unknown) 2>/dev/null` in 2531.1.1.3Schristos ia64) 2541.1.1.3Schristos shared_ext='.so' 2551.1.1.3Schristos SHAREDLIB='libz.so' ;; 2561.1.1.3Schristos *) 2571.1.1.3Schristos shared_ext='.sl' 2581.1.1.3Schristos SHAREDLIB='libz.sl' ;; 2591.1.1.3Schristos esac ;; 2601.1.1.3Schristos AIX*) 2611.1.1.3Schristos LDFLAGS="${LDFLAGS} -Wl,-brtl" ;; 2621.1.1.3Schristos Darwin* | darwin* | *-darwin*) 2631.1.1.3Schristos shared_ext='.dylib' 2641.1.1.3Schristos SHAREDLIB=libz$shared_ext 2651.1.1.3Schristos SHAREDLIBV=libz.$VER$shared_ext 2661.1.1.3Schristos SHAREDLIBM=libz.$VER1$shared_ext 2671.1.1.3Schristos LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"} 2681.1.1.4Schristos if "${CROSS_PREFIX}libtool" -V 2>&1 | grep Apple > /dev/null; then 2691.1.1.4Schristos AR="${CROSS_PREFIX}libtool" 2701.1.1.4Schristos elif libtool -V 2>&1 | grep Apple > /dev/null; then 2711.1.1.3Schristos AR="libtool" 2721.1.1.3Schristos else 2731.1.1.3Schristos AR="/usr/bin/libtool" 2741.1.1.3Schristos fi 2751.1.1.3Schristos ARFLAGS="-o" ;; 2761.1.1.3Schristos *) 2771.1.1.3Schristos LDSHARED=${LDSHARED-"$cc -shared"} ;; 2781.1Schristos esac 2791.1Schristoselse 2801.1Schristos # find system name and corresponding cc options 2811.1Schristos CC=${CC-cc} 2821.1.1.2Schristos gcc=0 2831.1.1.2Schristos echo ... using $CC >> configure.log 2841.1.1.2Schristos if test -z "$uname"; then 2851.1.1.2Schristos uname=`(uname -sr || echo unknown) 2>/dev/null` 2861.1.1.2Schristos fi 2871.1.1.2Schristos case "$uname" in 2881.1Schristos HP-UX*) SFLAGS=${CFLAGS-"-O +z"} 2891.1Schristos CFLAGS=${CFLAGS-"-O"} 2901.1Schristos# LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"} 2911.1Schristos LDSHARED=${LDSHARED-"ld -b"} 2921.1Schristos case `(uname -m || echo unknown) 2>/dev/null` in 2931.1Schristos ia64) 2941.1Schristos shared_ext='.so' 2951.1.1.2Schristos SHAREDLIB='libz.so' ;; 2961.1Schristos *) 2971.1Schristos shared_ext='.sl' 2981.1.1.2Schristos SHAREDLIB='libz.sl' ;; 2991.1.1.2Schristos esac ;; 3001.1Schristos IRIX*) SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."} 3011.1Schristos CFLAGS=${CFLAGS-"-ansi -O2"} 3021.1.1.2Schristos LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;; 3031.1Schristos OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"} 3041.1Schristos CFLAGS=${CFLAGS-"-O -std1"} 3051.1.1.2Schristos LDFLAGS="${LDFLAGS} -Wl,-rpath,." 3061.1.1.2Schristos LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"} ;; 3071.1Schristos OSF1*) SFLAGS=${CFLAGS-"-O -std1"} 3081.1Schristos CFLAGS=${CFLAGS-"-O -std1"} 3091.1.1.2Schristos LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;; 3101.1Schristos QNX*) SFLAGS=${CFLAGS-"-4 -O"} 3111.1Schristos CFLAGS=${CFLAGS-"-4 -O"} 3121.1Schristos LDSHARED=${LDSHARED-"cc"} 3131.1Schristos RANLIB=${RANLIB-"true"} 3141.1.1.2Schristos AR="cc" 3151.1.1.2Schristos ARFLAGS="-A" ;; 3161.1Schristos SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "} 3171.1Schristos CFLAGS=${CFLAGS-"-O3"} 3181.1.1.2Schristos LDSHARED=${LDSHARED-"cc -dy -KPIC -G"} ;; 3191.1.1.2Schristos SunOS\ 5* | solaris*) 3201.1.1.2Schristos LDSHARED=${LDSHARED-"cc -G -h libz$shared_ext.$VER1"} 3211.1.1.2Schristos SFLAGS=${CFLAGS-"-fast -KPIC"} 3221.1.1.2Schristos CFLAGS=${CFLAGS-"-fast"} 3231.1.1.2Schristos if test $build64 -eq 1; then 3241.1.1.2Schristos # old versions of SunPRO/Workshop/Studio don't support -m64, 3251.1.1.2Schristos # but newer ones do. Check for it. 3261.1.1.2Schristos flag64=`$CC -flags | egrep -- '^-m64'` 3271.1.1.2Schristos if test x"$flag64" != x"" ; then 3281.1.1.2Schristos CFLAGS="${CFLAGS} -m64" 3291.1.1.2Schristos SFLAGS="${SFLAGS} -m64" 3301.1.1.2Schristos else 3311.1.1.2Schristos case `(uname -m || echo unknown) 2>/dev/null` in 3321.1.1.2Schristos i86*) 3331.1.1.2Schristos SFLAGS="$SFLAGS -xarch=amd64" 3341.1.1.2Schristos CFLAGS="$CFLAGS -xarch=amd64" ;; 3351.1.1.2Schristos *) 3361.1.1.2Schristos SFLAGS="$SFLAGS -xarch=v9" 3371.1.1.2Schristos CFLAGS="$CFLAGS -xarch=v9" ;; 3381.1.1.2Schristos esac 3391.1.1.2Schristos fi 3401.1.1.2Schristos fi 3411.1.1.2Schristos if test -n "$ZINC"; then 3421.1.1.2Schristos ZINC='-I- -I. -I$(SRCDIR)' 3431.1.1.2Schristos fi 3441.1.1.2Schristos ;; 3451.1Schristos SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"} 3461.1Schristos CFLAGS=${CFLAGS-"-O2"} 3471.1.1.2Schristos LDSHARED=${LDSHARED-"ld"} ;; 3481.1.1.2Schristos SunStudio\ 9*) SFLAGS=${CFLAGS-"-fast -xcode=pic32 -xtarget=ultra3 -xarch=v9b"} 3491.1.1.2Schristos CFLAGS=${CFLAGS-"-fast -xtarget=ultra3 -xarch=v9b"} 3501.1.1.2Schristos LDSHARED=${LDSHARED-"cc -xarch=v9b"} ;; 3511.1Schristos UNIX_System_V\ 4.2.0) 3521.1Schristos SFLAGS=${CFLAGS-"-KPIC -O"} 3531.1Schristos CFLAGS=${CFLAGS-"-O"} 3541.1.1.2Schristos LDSHARED=${LDSHARED-"cc -G"} ;; 3551.1Schristos UNIX_SV\ 4.2MP) 3561.1Schristos SFLAGS=${CFLAGS-"-Kconform_pic -O"} 3571.1Schristos CFLAGS=${CFLAGS-"-O"} 3581.1.1.2Schristos LDSHARED=${LDSHARED-"cc -G"} ;; 3591.1Schristos OpenUNIX\ 5) 3601.1Schristos SFLAGS=${CFLAGS-"-KPIC -O"} 3611.1Schristos CFLAGS=${CFLAGS-"-O"} 3621.1.1.2Schristos LDSHARED=${LDSHARED-"cc -G"} ;; 3631.1Schristos AIX*) # Courtesy of dbakker@arrayasolutions.com 3641.1Schristos SFLAGS=${CFLAGS-"-O -qmaxmem=8192"} 3651.1Schristos CFLAGS=${CFLAGS-"-O -qmaxmem=8192"} 3661.1.1.2Schristos LDSHARED=${LDSHARED-"xlc -G"} ;; 3671.1.1.2Schristos # send working options for other systems to zlib@gzip.org 3681.1Schristos *) SFLAGS=${CFLAGS-"-O"} 3691.1Schristos CFLAGS=${CFLAGS-"-O"} 3701.1.1.2Schristos LDSHARED=${LDSHARED-"cc -shared"} ;; 3711.1Schristos esac 3721.1Schristosfi 3731.1Schristos 3741.1.1.2Schristos# destination names for shared library if not defined above 3751.1SchristosSHAREDLIB=${SHAREDLIB-"libz$shared_ext"} 3761.1SchristosSHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"} 3771.1SchristosSHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"} 3781.1Schristos 3791.1.1.2Schristosecho >> configure.log 3801.1.1.2Schristos 3811.1.1.2Schristos# define functions for testing compiler and library characteristics and logging the results 3821.1.1.2Schristos 3831.1.1.2Schristoscat > $test.c <<EOF 3841.1.1.2Schristos#error error 3851.1.1.2SchristosEOF 3861.1.1.2Schristosif ($CC -c $CFLAGS $test.c) 2>/dev/null; then 3871.1.1.2Schristos try() 3881.1.1.2Schristos { 3891.1.1.2Schristos show $* 3901.1.1.2Schristos test "`( $* ) 2>&1 | tee -a configure.log`" = "" 3911.1.1.2Schristos } 3921.1.1.2Schristos echo - using any output from compiler to indicate an error >> configure.log 3931.1.1.2Schristoselse 3941.1.1.2Schristos try() 3951.1.1.2Schristos { 3961.1.1.2Schristos show $* 3971.1.1.3Schristos got=`( $* ) 2>&1` 3981.1.1.2Schristos ret=$? 3991.1.1.3Schristos if test "$got" != ""; then 4001.1.1.3Schristos printf "%s\n" "$got" >> configure.log 4011.1.1.3Schristos fi 4021.1.1.2Schristos if test $ret -ne 0; then 4031.1.1.2Schristos echo "(exit code "$ret")" >> configure.log 4041.1.1.2Schristos fi 4051.1.1.2Schristos return $ret 4061.1.1.2Schristos } 4071.1.1.2Schristosfi 4081.1.1.2Schristos 4091.1.1.2Schristostryboth() 4101.1.1.2Schristos{ 4111.1.1.2Schristos show $* 4121.1.1.2Schristos got=`( $* ) 2>&1` 4131.1.1.2Schristos ret=$? 4141.1.1.3Schristos if test "$got" != ""; then 4151.1.1.3Schristos printf "%s\n" "$got" >> configure.log 4161.1.1.3Schristos fi 4171.1.1.2Schristos if test $ret -ne 0; then 4181.1.1.3Schristos echo "(exit code "$ret")" >> configure.log 4191.1.1.2Schristos return $ret 4201.1.1.2Schristos fi 4211.1.1.2Schristos test "$got" = "" 4221.1.1.2Schristos} 4231.1.1.2Schristos 4241.1.1.2Schristoscat > $test.c << EOF 4251.1.1.2Schristosint foo() { return 0; } 4261.1.1.2SchristosEOF 4271.1.1.2Schristosecho "Checking for obsessive-compulsive compiler options..." >> configure.log 4281.1.1.2Schristosif try $CC -c $CFLAGS $test.c; then 4291.1.1.2Schristos : 4301.1.1.2Schristoselse 4311.1.1.2Schristos echo "Compiler error reporting is too harsh for $0 (perhaps remove -Werror)." | tee -a configure.log 4321.1.1.2Schristos leave 1 4331.1.1.2Schristosfi 4341.1.1.2Schristos 4351.1.1.2Schristosecho >> configure.log 4361.1.1.2Schristos 4371.1.1.2Schristos# see if shared library build supported 4381.1.1.2Schristoscat > $test.c <<EOF 4391.1.1.2Schristosextern int getchar(); 4401.1.1.2Schristosint hello() {return getchar();} 4411.1.1.2SchristosEOF 4421.1Schristosif test $shared -eq 1; then 4431.1.1.2Schristos echo Checking for shared library support... | tee -a configure.log 4441.1Schristos # we must test in two steps (cc then ld), required at least on SunOS 4.x 4451.1.1.4Schristos if try $CC -c $SFLAGS $test.c && 4461.1.1.2Schristos try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then 4471.1.1.2Schristos echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log 4481.1Schristos elif test -z "$old_cc" -a -z "$old_cflags"; then 4491.1.1.2Schristos echo No shared library support. | tee -a configure.log 4501.1Schristos shared=0; 4511.1Schristos else 4521.1.1.2Schristos echo 'No shared library support; try without defining CC and CFLAGS' | tee -a configure.log 4531.1Schristos shared=0; 4541.1Schristos fi 4551.1Schristosfi 4561.1Schristosif test $shared -eq 0; then 4571.1Schristos LDSHARED="$CC" 4581.1.1.2Schristos ALL="static" 4591.1.1.2Schristos TEST="all teststatic" 4601.1.1.2Schristos SHAREDLIB="" 4611.1.1.2Schristos SHAREDLIBV="" 4621.1.1.2Schristos SHAREDLIBM="" 4631.1.1.2Schristos echo Building static library $STATICLIB version $VER with $CC. | tee -a configure.log 4641.1.1.2Schristoselse 4651.1.1.2Schristos ALL="static shared" 4661.1.1.2Schristos TEST="all teststatic testshared" 4671.1.1.2Schristosfi 4681.1.1.2Schristos 4691.1.1.2Schristosecho >> configure.log 4701.1.1.2Schristos 4711.1.1.2Schristos# check for size_t 4721.1.1.2Schristoscat > $test.c <<EOF 4731.1.1.2Schristos#include <stdio.h> 4741.1.1.2Schristos#include <stdlib.h> 4751.1.1.2Schristossize_t dummy = 0; 4761.1.1.2SchristosEOF 4771.1.1.2Schristosif try $CC -c $CFLAGS $test.c; then 4781.1.1.2Schristos echo "Checking for size_t... Yes." | tee -a configure.log 4791.1.1.2Schristoselse 4801.1.1.2Schristos echo "Checking for size_t... No." | tee -a configure.log 4811.1.1.3Schristos # find a size_t integer type 4821.1.1.3Schristos # check for long long 4831.1.1.3Schristos cat > $test.c << EOF 4841.1.1.2Schristoslong long dummy = 0; 4851.1.1.2SchristosEOF 4861.1.1.2Schristos if try $CC -c $CFLAGS $test.c; then 4871.1.1.2Schristos echo "Checking for long long... Yes." | tee -a configure.log 4881.1.1.2Schristos cat > $test.c <<EOF 4891.1.1.2Schristos#include <stdio.h> 4901.1.1.2Schristosint main(void) { 4911.1.1.2Schristos if (sizeof(void *) <= sizeof(int)) puts("int"); 4921.1.1.2Schristos else if (sizeof(void *) <= sizeof(long)) puts("long"); 4931.1.1.2Schristos else puts("z_longlong"); 4941.1.1.2Schristos return 0; 4951.1.1.2Schristos} 4961.1.1.2SchristosEOF 4971.1.1.2Schristos else 4981.1.1.2Schristos echo "Checking for long long... No." | tee -a configure.log 4991.1.1.2Schristos cat > $test.c <<EOF 5001.1.1.2Schristos#include <stdio.h> 5011.1.1.2Schristosint main(void) { 5021.1.1.2Schristos if (sizeof(void *) <= sizeof(int)) puts("int"); 5031.1.1.2Schristos else puts("long"); 5041.1.1.2Schristos return 0; 5051.1.1.2Schristos} 5061.1.1.2SchristosEOF 5071.1.1.2Schristos fi 5081.1.1.2Schristos if try $CC $CFLAGS -o $test $test.c; then 5091.1.1.2Schristos sizet=`./$test` 5101.1.1.2Schristos echo "Checking for a pointer-size integer type..." $sizet"." | tee -a configure.log 5111.1.1.3Schristos CFLAGS="${CFLAGS} -DNO_SIZE_T=${sizet}" 5121.1.1.3Schristos SFLAGS="${SFLAGS} -DNO_SIZE_T=${sizet}" 5131.1.1.2Schristos else 5141.1.1.3Schristos echo "Checking for a pointer-size integer type... not found." | tee -a configure.log 5151.1.1.2Schristos fi 5161.1.1.2Schristosfi 5171.1.1.2Schristos 5181.1.1.2Schristosecho >> configure.log 5191.1.1.2Schristos 5201.1.1.2Schristos# check for large file support, and if none, check for fseeko() 5211.1.1.2Schristoscat > $test.c <<EOF 5221.1.1.2Schristos#include <sys/types.h> 5231.1.1.2Schristosoff64_t dummy = 0; 5241.1.1.2SchristosEOF 5251.1.1.2Schristosif try $CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c; then 5261.1.1.2Schristos CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1" 5271.1.1.2Schristos SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1" 5281.1.1.2Schristos ALL="${ALL} all64" 5291.1.1.2Schristos TEST="${TEST} test64" 5301.1.1.2Schristos echo "Checking for off64_t... Yes." | tee -a configure.log 5311.1.1.2Schristos echo "Checking for fseeko... Yes." | tee -a configure.log 5321.1.1.2Schristoselse 5331.1.1.2Schristos echo "Checking for off64_t... No." | tee -a configure.log 5341.1.1.2Schristos echo >> configure.log 5351.1.1.2Schristos cat > $test.c <<EOF 5361.1.1.2Schristos#include <stdio.h> 5371.1.1.2Schristosint main(void) { 5381.1.1.2Schristos fseeko(NULL, 0, 0); 5391.1.1.2Schristos return 0; 5401.1.1.2Schristos} 5411.1.1.2SchristosEOF 5421.1.1.2Schristos if try $CC $CFLAGS -o $test $test.c; then 5431.1.1.2Schristos echo "Checking for fseeko... Yes." | tee -a configure.log 5441.1.1.2Schristos else 5451.1.1.2Schristos CFLAGS="${CFLAGS} -DNO_FSEEKO" 5461.1.1.2Schristos SFLAGS="${SFLAGS} -DNO_FSEEKO" 5471.1.1.2Schristos echo "Checking for fseeko... No." | tee -a configure.log 5481.1.1.2Schristos fi 5491.1.1.2Schristosfi 5501.1.1.2Schristos 5511.1.1.2Schristosecho >> configure.log 5521.1.1.2Schristos 5531.1.1.2Schristos# check for strerror() for use by gz* functions 5541.1.1.2Schristoscat > $test.c <<EOF 5551.1.1.2Schristos#include <string.h> 5561.1.1.2Schristos#include <errno.h> 5571.1.1.2Schristosint main() { return strlen(strerror(errno)); } 5581.1.1.2SchristosEOF 5591.1.1.2Schristosif try $CC $CFLAGS -o $test $test.c; then 5601.1.1.2Schristos echo "Checking for strerror... Yes." | tee -a configure.log 5611.1Schristoselse 5621.1.1.2Schristos CFLAGS="${CFLAGS} -DNO_STRERROR" 5631.1.1.2Schristos SFLAGS="${SFLAGS} -DNO_STRERROR" 5641.1.1.2Schristos echo "Checking for strerror... No." | tee -a configure.log 5651.1Schristosfi 5661.1Schristos 5671.1.1.2Schristos# copy clean zconf.h for subsequent edits 5681.1.1.2Schristoscp -p ${SRCDIR}zconf.h.in zconf.h 5691.1.1.2Schristos 5701.1.1.2Schristosecho >> configure.log 5711.1.1.2Schristos 5721.1.1.2Schristos# check for unistd.h and save result in zconf.h 5731.1Schristoscat > $test.c <<EOF 5741.1Schristos#include <unistd.h> 5751.1Schristosint main() { return 0; } 5761.1SchristosEOF 5771.1.1.2Schristosif try $CC -c $CFLAGS $test.c; then 5781.1.1.2Schristos sed < zconf.h "/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be/ 1\1 was/" > zconf.temp.h 5791.1.1.2Schristos mv zconf.temp.h zconf.h 5801.1.1.2Schristos echo "Checking for unistd.h... Yes." | tee -a configure.log 5811.1Schristoselse 5821.1.1.2Schristos echo "Checking for unistd.h... No." | tee -a configure.log 5831.1.1.2Schristosfi 5841.1.1.2Schristos 5851.1.1.2Schristosecho >> configure.log 5861.1.1.2Schristos 5871.1.1.2Schristos# check for stdarg.h and save result in zconf.h 5881.1.1.2Schristoscat > $test.c <<EOF 5891.1.1.2Schristos#include <stdarg.h> 5901.1.1.2Schristosint main() { return 0; } 5911.1.1.2SchristosEOF 5921.1.1.2Schristosif try $CC -c $CFLAGS $test.c; then 5931.1.1.2Schristos sed < zconf.h "/^#ifdef HAVE_STDARG_H.* may be/s/def HAVE_STDARG_H\(.*\) may be/ 1\1 was/" > zconf.temp.h 5941.1.1.2Schristos mv zconf.temp.h zconf.h 5951.1.1.2Schristos echo "Checking for stdarg.h... Yes." | tee -a configure.log 5961.1.1.2Schristoselse 5971.1.1.2Schristos echo "Checking for stdarg.h... No." | tee -a configure.log 5981.1.1.2Schristosfi 5991.1.1.2Schristos 6001.1.1.2Schristos# if the z_ prefix was requested, save that in zconf.h 6011.1.1.2Schristosif test $zprefix -eq 1; then 6021.1.1.2Schristos sed < zconf.h "/#ifdef Z_PREFIX.* may be/s/def Z_PREFIX\(.*\) may be/ 1\1 was/" > zconf.temp.h 6031.1.1.2Schristos mv zconf.temp.h zconf.h 6041.1.1.2Schristos echo >> configure.log 6051.1.1.2Schristos echo "Using z_ prefix on all symbols." | tee -a configure.log 6061.1.1.2Schristosfi 6071.1.1.2Schristos 6081.1.1.2Schristos# if --solo compilation was requested, save that in zconf.h and remove gz stuff from object lists 6091.1.1.2Schristosif test $solo -eq 1; then 6101.1.1.2Schristos sed '/#define ZCONF_H/a\ 6111.1.1.2Schristos#define Z_SOLO 6121.1.1.2Schristos 6131.1.1.2Schristos' < zconf.h > zconf.temp.h 6141.1.1.2Schristos mv zconf.temp.h zconf.h 6151.1.1.2SchristosOBJC='$(OBJZ)' 6161.1.1.2SchristosPIC_OBJC='$(PIC_OBJZ)' 6171.1.1.2Schristosfi 6181.1.1.2Schristos 6191.1.1.2Schristos# if code coverage testing was requested, use older gcc if defined, e.g. "gcc-4.2" on Mac OS X 6201.1.1.2Schristosif test $cover -eq 1; then 6211.1.1.2Schristos CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage" 6221.1.1.2Schristos if test -n "$GCC_CLASSIC"; then 6231.1.1.2Schristos CC=$GCC_CLASSIC 6241.1.1.2Schristos fi 6251.1Schristosfi 6261.1Schristos 6271.1.1.2Schristosecho >> configure.log 6281.1.1.2Schristos 6291.1.1.2Schristos# conduct a series of tests to resolve eight possible cases of using "vs" or "s" printf functions 6301.1.1.2Schristos# (using stdarg or not), with or without "n" (proving size of buffer), and with or without a 6311.1.1.2Schristos# return value. The most secure result is vsnprintf() with a return value. snprintf() with a 6321.1.1.2Schristos# return value is secure as well, but then gzprintf() will be limited to 20 arguments. 6331.1Schristoscat > $test.c <<EOF 6341.1Schristos#include <stdio.h> 6351.1Schristos#include <stdarg.h> 6361.1Schristos#include "zconf.h" 6371.1Schristosint main() 6381.1Schristos{ 6391.1Schristos#ifndef STDC 6401.1Schristos choke me 6411.1Schristos#endif 6421.1Schristos return 0; 6431.1Schristos} 6441.1SchristosEOF 6451.1.1.2Schristosif try $CC -c $CFLAGS $test.c; then 6461.1.1.2Schristos echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()." | tee -a configure.log 6471.1Schristos 6481.1.1.2Schristos echo >> configure.log 6491.1Schristos cat > $test.c <<EOF 6501.1Schristos#include <stdio.h> 6511.1Schristos#include <stdarg.h> 6521.1.1.2Schristosint mytest(const char *fmt, ...) 6531.1Schristos{ 6541.1Schristos char buf[20]; 6551.1Schristos va_list ap; 6561.1Schristos va_start(ap, fmt); 6571.1Schristos vsnprintf(buf, sizeof(buf), fmt, ap); 6581.1Schristos va_end(ap); 6591.1Schristos return 0; 6601.1Schristos} 6611.1Schristosint main() 6621.1Schristos{ 6631.1Schristos return (mytest("Hello%d\n", 1)); 6641.1Schristos} 6651.1SchristosEOF 6661.1.1.2Schristos if try $CC $CFLAGS -o $test $test.c; then 6671.1.1.2Schristos echo "Checking for vsnprintf() in stdio.h... Yes." | tee -a configure.log 6681.1Schristos 6691.1.1.2Schristos echo >> configure.log 6701.1Schristos cat >$test.c <<EOF 6711.1Schristos#include <stdio.h> 6721.1Schristos#include <stdarg.h> 6731.1.1.2Schristosint mytest(const char *fmt, ...) 6741.1Schristos{ 6751.1Schristos int n; 6761.1Schristos char buf[20]; 6771.1Schristos va_list ap; 6781.1Schristos va_start(ap, fmt); 6791.1Schristos n = vsnprintf(buf, sizeof(buf), fmt, ap); 6801.1Schristos va_end(ap); 6811.1Schristos return n; 6821.1Schristos} 6831.1Schristosint main() 6841.1Schristos{ 6851.1Schristos return (mytest("Hello%d\n", 1)); 6861.1Schristos} 6871.1SchristosEOF 6881.1Schristos 6891.1.1.2Schristos if try $CC -c $CFLAGS $test.c; then 6901.1.1.2Schristos echo "Checking for return value of vsnprintf()... Yes." | tee -a configure.log 6911.1Schristos else 6921.1Schristos CFLAGS="$CFLAGS -DHAS_vsnprintf_void" 6931.1.1.2Schristos SFLAGS="$SFLAGS -DHAS_vsnprintf_void" 6941.1.1.2Schristos echo "Checking for return value of vsnprintf()... No." | tee -a configure.log 6951.1.1.2Schristos echo " WARNING: apparently vsnprintf() does not return a value. zlib" | tee -a configure.log 6961.1.1.2Schristos echo " can build but will be open to possible string-format security" | tee -a configure.log 6971.1.1.2Schristos echo " vulnerabilities." | tee -a configure.log 6981.1Schristos fi 6991.1Schristos else 7001.1Schristos CFLAGS="$CFLAGS -DNO_vsnprintf" 7011.1.1.2Schristos SFLAGS="$SFLAGS -DNO_vsnprintf" 7021.1.1.2Schristos echo "Checking for vsnprintf() in stdio.h... No." | tee -a configure.log 7031.1.1.2Schristos echo " WARNING: vsnprintf() not found, falling back to vsprintf(). zlib" | tee -a configure.log 7041.1.1.2Schristos echo " can build but will be open to possible buffer-overflow security" | tee -a configure.log 7051.1.1.2Schristos echo " vulnerabilities." | tee -a configure.log 7061.1Schristos 7071.1.1.2Schristos echo >> configure.log 7081.1Schristos cat >$test.c <<EOF 7091.1Schristos#include <stdio.h> 7101.1Schristos#include <stdarg.h> 7111.1.1.2Schristosint mytest(const char *fmt, ...) 7121.1Schristos{ 7131.1Schristos int n; 7141.1Schristos char buf[20]; 7151.1Schristos va_list ap; 7161.1Schristos va_start(ap, fmt); 7171.1Schristos n = vsprintf(buf, fmt, ap); 7181.1Schristos va_end(ap); 7191.1Schristos return n; 7201.1Schristos} 7211.1Schristosint main() 7221.1Schristos{ 7231.1Schristos return (mytest("Hello%d\n", 1)); 7241.1Schristos} 7251.1SchristosEOF 7261.1Schristos 7271.1.1.2Schristos if try $CC -c $CFLAGS $test.c; then 7281.1.1.2Schristos echo "Checking for return value of vsprintf()... Yes." | tee -a configure.log 7291.1Schristos else 7301.1Schristos CFLAGS="$CFLAGS -DHAS_vsprintf_void" 7311.1.1.2Schristos SFLAGS="$SFLAGS -DHAS_vsprintf_void" 7321.1.1.2Schristos echo "Checking for return value of vsprintf()... No." | tee -a configure.log 7331.1.1.2Schristos echo " WARNING: apparently vsprintf() does not return a value. zlib" | tee -a configure.log 7341.1.1.2Schristos echo " can build but will be open to possible string-format security" | tee -a configure.log 7351.1.1.2Schristos echo " vulnerabilities." | tee -a configure.log 7361.1Schristos fi 7371.1Schristos fi 7381.1Schristoselse 7391.1.1.2Schristos echo "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()." | tee -a configure.log 7401.1Schristos 7411.1.1.2Schristos echo >> configure.log 7421.1Schristos cat >$test.c <<EOF 7431.1Schristos#include <stdio.h> 7441.1Schristosint mytest() 7451.1Schristos{ 7461.1Schristos char buf[20]; 7471.1Schristos snprintf(buf, sizeof(buf), "%s", "foo"); 7481.1Schristos return 0; 7491.1Schristos} 7501.1Schristosint main() 7511.1Schristos{ 7521.1Schristos return (mytest()); 7531.1Schristos} 7541.1SchristosEOF 7551.1Schristos 7561.1.1.2Schristos if try $CC $CFLAGS -o $test $test.c; then 7571.1.1.2Schristos echo "Checking for snprintf() in stdio.h... Yes." | tee -a configure.log 7581.1Schristos 7591.1.1.2Schristos echo >> configure.log 7601.1Schristos cat >$test.c <<EOF 7611.1Schristos#include <stdio.h> 7621.1Schristosint mytest() 7631.1Schristos{ 7641.1Schristos char buf[20]; 7651.1Schristos return snprintf(buf, sizeof(buf), "%s", "foo"); 7661.1Schristos} 7671.1Schristosint main() 7681.1Schristos{ 7691.1Schristos return (mytest()); 7701.1Schristos} 7711.1SchristosEOF 7721.1Schristos 7731.1.1.2Schristos if try $CC -c $CFLAGS $test.c; then 7741.1.1.2Schristos echo "Checking for return value of snprintf()... Yes." | tee -a configure.log 7751.1Schristos else 7761.1Schristos CFLAGS="$CFLAGS -DHAS_snprintf_void" 7771.1.1.2Schristos SFLAGS="$SFLAGS -DHAS_snprintf_void" 7781.1.1.2Schristos echo "Checking for return value of snprintf()... No." | tee -a configure.log 7791.1.1.2Schristos echo " WARNING: apparently snprintf() does not return a value. zlib" | tee -a configure.log 7801.1.1.2Schristos echo " can build but will be open to possible string-format security" | tee -a configure.log 7811.1.1.2Schristos echo " vulnerabilities." | tee -a configure.log 7821.1Schristos fi 7831.1Schristos else 7841.1Schristos CFLAGS="$CFLAGS -DNO_snprintf" 7851.1.1.2Schristos SFLAGS="$SFLAGS -DNO_snprintf" 7861.1.1.2Schristos echo "Checking for snprintf() in stdio.h... No." | tee -a configure.log 7871.1.1.2Schristos echo " WARNING: snprintf() not found, falling back to sprintf(). zlib" | tee -a configure.log 7881.1.1.2Schristos echo " can build but will be open to possible buffer-overflow security" | tee -a configure.log 7891.1.1.2Schristos echo " vulnerabilities." | tee -a configure.log 7901.1Schristos 7911.1.1.2Schristos echo >> configure.log 7921.1Schristos cat >$test.c <<EOF 7931.1Schristos#include <stdio.h> 7941.1Schristosint mytest() 7951.1Schristos{ 7961.1Schristos char buf[20]; 7971.1Schristos return sprintf(buf, "%s", "foo"); 7981.1Schristos} 7991.1Schristosint main() 8001.1Schristos{ 8011.1Schristos return (mytest()); 8021.1Schristos} 8031.1SchristosEOF 8041.1Schristos 8051.1.1.2Schristos if try $CC -c $CFLAGS $test.c; then 8061.1.1.2Schristos echo "Checking for return value of sprintf()... Yes." | tee -a configure.log 8071.1Schristos else 8081.1Schristos CFLAGS="$CFLAGS -DHAS_sprintf_void" 8091.1.1.2Schristos SFLAGS="$SFLAGS -DHAS_sprintf_void" 8101.1.1.2Schristos echo "Checking for return value of sprintf()... No." | tee -a configure.log 8111.1.1.2Schristos echo " WARNING: apparently sprintf() does not return a value. zlib" | tee -a configure.log 8121.1.1.2Schristos echo " can build but will be open to possible string-format security" | tee -a configure.log 8131.1.1.2Schristos echo " vulnerabilities." | tee -a configure.log 8141.1Schristos fi 8151.1Schristos fi 8161.1Schristosfi 8171.1Schristos 8181.1.1.2Schristos# see if we can hide zlib internal symbols that are linked between separate source files 8191.1.1.2Schristosif test "$gcc" -eq 1; then 8201.1.1.2Schristos echo >> configure.log 8211.1.1.2Schristos cat > $test.c <<EOF 8221.1.1.2Schristos#define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) 8231.1.1.2Schristosint ZLIB_INTERNAL foo; 8241.1.1.2Schristosint main() 8251.1.1.2Schristos{ 8261.1.1.2Schristos return 0; 8271.1Schristos} 8281.1SchristosEOF 8291.1.1.2Schristos if tryboth $CC -c $CFLAGS $test.c; then 8301.1.1.2Schristos CFLAGS="$CFLAGS -DHAVE_HIDDEN" 8311.1.1.2Schristos SFLAGS="$SFLAGS -DHAVE_HIDDEN" 8321.1.1.2Schristos echo "Checking for attribute(visibility) support... Yes." | tee -a configure.log 8331.1.1.2Schristos else 8341.1.1.2Schristos echo "Checking for attribute(visibility) support... No." | tee -a configure.log 8351.1.1.2Schristos fi 8361.1Schristosfi 8371.1Schristos 8381.1.1.2Schristos# show the results in the log 8391.1.1.2Schristosecho >> configure.log 8401.1.1.2Schristosecho ALL = $ALL >> configure.log 8411.1.1.2Schristosecho AR = $AR >> configure.log 8421.1.1.2Schristosecho ARFLAGS = $ARFLAGS >> configure.log 8431.1.1.2Schristosecho CC = $CC >> configure.log 8441.1.1.2Schristosecho CFLAGS = $CFLAGS >> configure.log 8451.1.1.2Schristosecho CPP = $CPP >> configure.log 8461.1.1.2Schristosecho EXE = $EXE >> configure.log 8471.1.1.2Schristosecho LDCONFIG = $LDCONFIG >> configure.log 8481.1.1.2Schristosecho LDFLAGS = $LDFLAGS >> configure.log 8491.1.1.2Schristosecho LDSHARED = $LDSHARED >> configure.log 8501.1.1.2Schristosecho LDSHAREDLIBC = $LDSHAREDLIBC >> configure.log 8511.1.1.2Schristosecho OBJC = $OBJC >> configure.log 8521.1.1.2Schristosecho PIC_OBJC = $PIC_OBJC >> configure.log 8531.1.1.2Schristosecho RANLIB = $RANLIB >> configure.log 8541.1.1.2Schristosecho SFLAGS = $SFLAGS >> configure.log 8551.1.1.2Schristosecho SHAREDLIB = $SHAREDLIB >> configure.log 8561.1.1.2Schristosecho SHAREDLIBM = $SHAREDLIBM >> configure.log 8571.1.1.2Schristosecho SHAREDLIBV = $SHAREDLIBV >> configure.log 8581.1.1.2Schristosecho STATICLIB = $STATICLIB >> configure.log 8591.1.1.2Schristosecho TEST = $TEST >> configure.log 8601.1.1.2Schristosecho VER = $VER >> configure.log 8611.1.1.2Schristosecho SRCDIR = $SRCDIR >> configure.log 8621.1.1.2Schristosecho exec_prefix = $exec_prefix >> configure.log 8631.1.1.2Schristosecho includedir = $includedir >> configure.log 8641.1.1.2Schristosecho libdir = $libdir >> configure.log 8651.1.1.2Schristosecho mandir = $mandir >> configure.log 8661.1.1.2Schristosecho prefix = $prefix >> configure.log 8671.1.1.2Schristosecho sharedlibdir = $sharedlibdir >> configure.log 8681.1.1.2Schristosecho uname = $uname >> configure.log 8691.1Schristos 8701.1.1.4Schristos# update Makefile with the configure results 8711.1.1.2Schristossed < ${SRCDIR}Makefile.in " 8721.1.1.2Schristos/^CC *=/s#=.*#=$CC# 8731.1.1.2Schristos/^CFLAGS *=/s#=.*#=$CFLAGS# 8741.1.1.2Schristos/^SFLAGS *=/s#=.*#=$SFLAGS# 8751.1.1.2Schristos/^LDFLAGS *=/s#=.*#=$LDFLAGS# 8761.1.1.2Schristos/^LDSHARED *=/s#=.*#=$LDSHARED# 8771.1.1.2Schristos/^CPP *=/s#=.*#=$CPP# 8781.1.1.2Schristos/^STATICLIB *=/s#=.*#=$STATICLIB# 8791.1.1.2Schristos/^SHAREDLIB *=/s#=.*#=$SHAREDLIB# 8801.1.1.2Schristos/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV# 8811.1.1.2Schristos/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM# 8821.1.1.2Schristos/^AR *=/s#=.*#=$AR# 8831.1.1.2Schristos/^ARFLAGS *=/s#=.*#=$ARFLAGS# 8841.1.1.2Schristos/^RANLIB *=/s#=.*#=$RANLIB# 8851.1.1.2Schristos/^LDCONFIG *=/s#=.*#=$LDCONFIG# 8861.1.1.2Schristos/^LDSHAREDLIBC *=/s#=.*#=$LDSHAREDLIBC# 8871.1.1.2Schristos/^EXE *=/s#=.*#=$EXE# 8881.1.1.2Schristos/^SRCDIR *=/s#=.*#=$SRCDIR# 8891.1.1.2Schristos/^ZINC *=/s#=.*#=$ZINC# 8901.1.1.2Schristos/^ZINCOUT *=/s#=.*#=$ZINCOUT# 8911.1.1.2Schristos/^prefix *=/s#=.*#=$prefix# 8921.1.1.2Schristos/^exec_prefix *=/s#=.*#=$exec_prefix# 8931.1.1.2Schristos/^libdir *=/s#=.*#=$libdir# 8941.1.1.2Schristos/^sharedlibdir *=/s#=.*#=$sharedlibdir# 8951.1.1.2Schristos/^includedir *=/s#=.*#=$includedir# 8961.1.1.2Schristos/^mandir *=/s#=.*#=$mandir# 8971.1.1.2Schristos/^OBJC *=/s#=.*#= $OBJC# 8981.1.1.2Schristos/^PIC_OBJC *=/s#=.*#= $PIC_OBJC# 8991.1.1.2Schristos/^all: */s#:.*#: $ALL# 9001.1.1.2Schristos/^test: */s#:.*#: $TEST# 9011.1.1.2Schristos" > Makefile 9021.1Schristos 9031.1.1.2Schristos# create zlib.pc with the configure results 9041.1.1.2Schristossed < ${SRCDIR}zlib.pc.in " 9051.1Schristos/^CC *=/s#=.*#=$CC# 9061.1Schristos/^CFLAGS *=/s#=.*#=$CFLAGS# 9071.1Schristos/^CPP *=/s#=.*#=$CPP# 9081.1Schristos/^LDSHARED *=/s#=.*#=$LDSHARED# 9091.1.1.2Schristos/^STATICLIB *=/s#=.*#=$STATICLIB# 9101.1Schristos/^SHAREDLIB *=/s#=.*#=$SHAREDLIB# 9111.1Schristos/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV# 9121.1Schristos/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM# 9131.1Schristos/^AR *=/s#=.*#=$AR# 9141.1.1.2Schristos/^ARFLAGS *=/s#=.*#=$ARFLAGS# 9151.1Schristos/^RANLIB *=/s#=.*#=$RANLIB# 9161.1Schristos/^EXE *=/s#=.*#=$EXE# 9171.1Schristos/^prefix *=/s#=.*#=$prefix# 9181.1Schristos/^exec_prefix *=/s#=.*#=$exec_prefix# 9191.1Schristos/^libdir *=/s#=.*#=$libdir# 9201.1.1.2Schristos/^sharedlibdir *=/s#=.*#=$sharedlibdir# 9211.1Schristos/^includedir *=/s#=.*#=$includedir# 9221.1Schristos/^mandir *=/s#=.*#=$mandir# 9231.1Schristos/^LDFLAGS *=/s#=.*#=$LDFLAGS# 9241.1.1.2Schristos" | sed -e " 9251.1.1.2Schristoss/\@VERSION\@/$VER/g; 9261.1.1.2Schristos" > zlib.pc 9271.1.1.2Schristos 9281.1.1.2Schristos# done 9291.1.1.2Schristosleave 0 930