Home | History | Annotate | Line # | Download | only in zlib
      1      1.1  christos #!/bin/sh
      2  1.1.1.2  christos # configure script for zlib.
      3      1.1  christos #
      4  1.1.1.2  christos # Normally configure builds both a static and a shared library.
      5  1.1.1.2  christos # If you want to build just a static library, use: ./configure --static
      6      1.1  christos #
      7      1.1  christos # To impose specific compiler or flags or install directory, use for example:
      8      1.1  christos #    prefix=$HOME CC=cc CFLAGS="-O4" ./configure
      9      1.1  christos # or for csh/tcsh users:
     10      1.1  christos #    (setenv prefix $HOME; setenv CC cc; setenv CFLAGS "-O4"; ./configure)
     11      1.1  christos 
     12      1.1  christos # Incorrect settings of CC or CFLAGS may prevent creating a shared library.
     13      1.1  christos # If you have problems, try without defining CC and CFLAGS before reporting
     14      1.1  christos # an error.
     15      1.1  christos 
     16  1.1.1.2  christos # start off configure.log
     17  1.1.1.2  christos echo -------------------- >> configure.log
     18  1.1.1.2  christos echo $0 $* >> configure.log
     19  1.1.1.2  christos date >> configure.log
     20  1.1.1.2  christos 
     21  1.1.1.2  christos # get source directory
     22  1.1.1.2  christos SRCDIR=`dirname $0`
     23  1.1.1.2  christos if test $SRCDIR = "."; then
     24  1.1.1.2  christos     ZINC=""
     25  1.1.1.2  christos     ZINCOUT="-I."
     26  1.1.1.2  christos     SRCDIR=""
     27  1.1.1.2  christos else
     28  1.1.1.4  christos     ZINC='-I. -include zconf.h'
     29  1.1.1.2  christos     ZINCOUT='-I. -I$(SRCDIR)'
     30  1.1.1.2  christos     SRCDIR="$SRCDIR/"
     31  1.1.1.2  christos fi
     32  1.1.1.2  christos 
     33  1.1.1.2  christos # set command prefix for cross-compilation
     34  1.1.1.2  christos if [ -n "${CHOST}" ]; then
     35  1.1.1.3  christos     uname=${CHOST}
     36  1.1.1.3  christos     mname=${CHOST}
     37  1.1.1.2  christos     CROSS_PREFIX="${CHOST}-"
     38  1.1.1.3  christos else
     39  1.1.1.3  christos     mname=`(uname -a || echo unknown) 2>/dev/null`
     40  1.1.1.2  christos fi
     41  1.1.1.2  christos 
     42  1.1.1.2  christos # destination name for static library
     43  1.1.1.2  christos STATICLIB=libz.a
     44  1.1.1.2  christos 
     45  1.1.1.2  christos # extract zlib version numbers from zlib.h
     46  1.1.1.2  christos VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}zlib.h`
     47  1.1.1.4  christos VER3=`echo ${VER}|sed -n -e 's/\([0-9]\{1,\}\(\\.[0-9]\{1,\}\)\{1,2\}\).*/\1/p'`
     48  1.1.1.4  christos VER1=`echo ${VER}|sed -n -e 's/\([0-9]\{1,\}\)\\..*/\1/p'`
     49  1.1.1.2  christos 
     50  1.1.1.2  christos # establish commands for library building
     51  1.1.1.2  christos if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then
     52  1.1.1.2  christos     AR=${AR-"${CROSS_PREFIX}ar"}
     53  1.1.1.2  christos     test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log
     54  1.1.1.2  christos else
     55  1.1.1.2  christos     AR=${AR-"ar"}
     56  1.1.1.2  christos     test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log
     57  1.1.1.2  christos fi
     58  1.1.1.2  christos ARFLAGS=${ARFLAGS-"rc"}
     59  1.1.1.2  christos if "${CROSS_PREFIX}ranlib" --version >/dev/null 2>/dev/null || test $? -lt 126; then
     60  1.1.1.2  christos     RANLIB=${RANLIB-"${CROSS_PREFIX}ranlib"}
     61  1.1.1.2  christos     test -n "${CROSS_PREFIX}" && echo Using ${RANLIB} | tee -a configure.log
     62  1.1.1.2  christos else
     63  1.1.1.2  christos     RANLIB=${RANLIB-"ranlib"}
     64  1.1.1.2  christos fi
     65  1.1.1.2  christos if "${CROSS_PREFIX}nm" --version >/dev/null 2>/dev/null || test $? -lt 126; then
     66  1.1.1.2  christos     NM=${NM-"${CROSS_PREFIX}nm"}
     67  1.1.1.2  christos     test -n "${CROSS_PREFIX}" && echo Using ${NM} | tee -a configure.log
     68  1.1.1.2  christos else
     69  1.1.1.2  christos     NM=${NM-"nm"}
     70  1.1.1.2  christos fi
     71  1.1.1.2  christos 
     72  1.1.1.2  christos # set defaults before processing command line options
     73  1.1.1.2  christos LDCONFIG=${LDCONFIG-"ldconfig"}
     74  1.1.1.2  christos LDSHAREDLIBC="${LDSHAREDLIBC--lc}"
     75  1.1.1.2  christos ARCHS=
     76      1.1  christos prefix=${prefix-/usr/local}
     77      1.1  christos exec_prefix=${exec_prefix-'${prefix}'}
     78      1.1  christos libdir=${libdir-'${exec_prefix}/lib'}
     79  1.1.1.2  christos sharedlibdir=${sharedlibdir-'${libdir}'}
     80      1.1  christos includedir=${includedir-'${prefix}/include'}
     81      1.1  christos mandir=${mandir-'${prefix}/share/man'}
     82      1.1  christos shared_ext='.so'
     83  1.1.1.2  christos shared=1
     84  1.1.1.2  christos solo=0
     85  1.1.1.2  christos cover=0
     86  1.1.1.2  christos zprefix=0
     87  1.1.1.2  christos zconst=0
     88  1.1.1.2  christos build64=0
     89      1.1  christos gcc=0
     90  1.1.1.5  christos clang=0
     91  1.1.1.2  christos warn=0
     92  1.1.1.2  christos debug=0
     93  1.1.1.4  christos address=0
     94  1.1.1.4  christos memory=0
     95  1.1.1.5  christos undefined=0
     96  1.1.1.5  christos insecure=0
     97  1.1.1.5  christos unknown=0
     98  1.1.1.5  christos enable_crcvx=1
     99      1.1  christos old_cc="$CC"
    100      1.1  christos old_cflags="$CFLAGS"
    101  1.1.1.2  christos OBJC='$(OBJZ) $(OBJG)'
    102  1.1.1.2  christos PIC_OBJC='$(PIC_OBJZ) $(PIC_OBJG)'
    103  1.1.1.2  christos 
    104  1.1.1.2  christos # leave this script, optionally in a bad way
    105  1.1.1.2  christos leave()
    106  1.1.1.2  christos {
    107  1.1.1.2  christos   if test "$*" != "0"; then
    108  1.1.1.2  christos     echo "** $0 aborting." | tee -a configure.log
    109  1.1.1.2  christos   fi
    110  1.1.1.4  christos   rm -rf $test.[co] $test $test$shared_ext $test.gcno $test.dSYM ./--version
    111  1.1.1.2  christos   echo -------------------- >> configure.log
    112  1.1.1.2  christos   echo >> configure.log
    113  1.1.1.2  christos   echo >> configure.log
    114  1.1.1.2  christos   exit $1
    115  1.1.1.2  christos }
    116      1.1  christos 
    117  1.1.1.2  christos # process command line options
    118      1.1  christos while test $# -ge 1
    119      1.1  christos do
    120      1.1  christos case "$1" in
    121  1.1.1.2  christos     -h* | --help)
    122  1.1.1.2  christos       echo 'usage:' | tee -a configure.log
    123  1.1.1.2  christos       echo '  configure [--const] [--zprefix] [--prefix=PREFIX]  [--eprefix=EXPREFIX]' | tee -a configure.log
    124  1.1.1.5  christos       echo '    [--insecure] [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log
    125  1.1.1.5  christos       echo '    [--includedir=INCLUDEDIR] [--mandir=MANDIR]' | tee -a configure.log
    126  1.1.1.5  christos       echo '    [--archs="-arch i386 -arch x86_64"] [--disable-crcvx]' | tee -a configure.log
    127  1.1.1.2  christos         exit 0 ;;
    128  1.1.1.5  christos     -p*=* | --prefix=*) prefix=`echo $1 | sed 's/[^=]*=//'`; shift ;;
    129  1.1.1.5  christos     -e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/[^=]*=//'`; shift ;;
    130  1.1.1.5  christos     -l*=* | --libdir=*) libdir=`echo $1 | sed 's/[^=]*=//'`; shift ;;
    131  1.1.1.5  christos     --sharedlibdir=*) sharedlibdir=`echo $1 | sed 's/[^=]*=//'`; shift ;;
    132  1.1.1.5  christos     -i*=* | --includedir=*) includedir=`echo $1 | sed 's/[^=]*=//'`;shift ;;
    133  1.1.1.5  christos     -m*=* | --mandir=*) mandir=`echo $1 | sed 's/[^=]*=//'`;shift ;;
    134  1.1.1.5  christos     -u*=* | --uname=*) uname=`echo $1 | sed 's/[^=]*=//'`;shift ;;
    135  1.1.1.2  christos     -p* | --prefix) prefix="$2"; shift; shift ;;
    136  1.1.1.2  christos     -e* | --eprefix) exec_prefix="$2"; shift; shift ;;
    137  1.1.1.2  christos     -l* | --libdir) libdir="$2"; shift; shift ;;
    138  1.1.1.5  christos     --sharedlibdir) sharedlibdir="$2"; shift; shift ;;
    139  1.1.1.2  christos     -i* | --includedir) includedir="$2"; shift; shift ;;
    140  1.1.1.5  christos     -m* | --mandir) mandir="$2"; shift; shift ;;
    141  1.1.1.5  christos     -u* | --uname) uname="$2"; shift; shift ;;
    142  1.1.1.2  christos     -s* | --shared | --enable-shared) shared=1; shift ;;
    143  1.1.1.5  christos     -t | --static | --disable-shared) shared=0; shift ;;
    144  1.1.1.2  christos     --solo) solo=1; shift ;;
    145  1.1.1.2  christos     --cover) cover=1; shift ;;
    146  1.1.1.2  christos     -z* | --zprefix) zprefix=1; shift ;;
    147  1.1.1.2  christos     -6* | --64) build64=1; shift ;;
    148  1.1.1.5  christos     -a*=* | --archs=*) ARCHS=`echo $1 | sed 's/[^=]*=//'`; shift ;;
    149  1.1.1.5  christos     -a* | --archs) ARCHS="$2"; shift; shift ;;
    150  1.1.1.2  christos     --sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;;
    151  1.1.1.2  christos     --localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;;
    152  1.1.1.2  christos     -c* | --const) zconst=1; shift ;;
    153  1.1.1.5  christos     -w* | --warn) warn=$((warn + 1)); shift ;;
    154  1.1.1.2  christos     -d* | --debug) debug=1; shift ;;
    155  1.1.1.4  christos     --sanitize) address=1; shift ;;
    156  1.1.1.4  christos     --address) address=1; shift ;;
    157  1.1.1.4  christos     --memory) memory=1; shift ;;
    158  1.1.1.5  christos     --undefined) undefined=1; shift ;;
    159  1.1.1.5  christos     --insecure) insecure=1; shift ;;
    160  1.1.1.5  christos     --disable-crcvx) enable_crcvx=0; shift ;;
    161  1.1.1.5  christos     *) unknown=1; echo "unknown option ignored: $1" | tee -a configure.log; shift;;
    162      1.1  christos     esac
    163      1.1  christos done
    164  1.1.1.5  christos if test $unknown -eq 1; then
    165  1.1.1.5  christos   echo "$0 --help for help" | tee -a configure.log
    166  1.1.1.5  christos fi
    167      1.1  christos 
    168  1.1.1.2  christos # temporary file name
    169      1.1  christos test=ztest$$
    170  1.1.1.2  christos 
    171  1.1.1.2  christos # put arguments in log, also put test file in log if used in arguments
    172  1.1.1.2  christos show()
    173  1.1.1.2  christos {
    174  1.1.1.2  christos   case "$*" in
    175  1.1.1.2  christos     *$test.c*)
    176  1.1.1.2  christos       echo === $test.c === >> configure.log
    177  1.1.1.2  christos       cat $test.c >> configure.log
    178  1.1.1.2  christos       echo === >> configure.log;;
    179  1.1.1.2  christos   esac
    180  1.1.1.2  christos   echo $* >> configure.log
    181  1.1.1.2  christos }
    182  1.1.1.2  christos 
    183  1.1.1.2  christos # check for gcc vs. cc and set compile and link flags based on the system identified by uname
    184      1.1  christos cat > $test.c <<EOF
    185      1.1  christos extern int getchar();
    186      1.1  christos int hello() {return getchar();}
    187      1.1  christos EOF
    188      1.1  christos 
    189  1.1.1.3  christos if test -z "$CC"; then
    190  1.1.1.3  christos   echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log
    191  1.1.1.3  christos   if ${CROSS_PREFIX}gcc -v >/dev/null 2>&1; then
    192  1.1.1.3  christos     cc=${CROSS_PREFIX}gcc
    193  1.1.1.3  christos   else
    194  1.1.1.3  christos     cc=${CROSS_PREFIX}cc
    195  1.1.1.3  christos   fi
    196  1.1.1.3  christos else
    197  1.1.1.3  christos   cc=${CC}
    198  1.1.1.3  christos fi
    199  1.1.1.3  christos 
    200      1.1  christos case "$cc" in
    201  1.1.1.5  christos   *gcc*) gcc=1
    202  1.1.1.5  christos     GCOV="gcov" ;;
    203  1.1.1.5  christos   *clang*) gcc=1
    204  1.1.1.5  christos     clang=1 ;;
    205  1.1.1.2  christos esac
    206  1.1.1.2  christos case `$cc -v 2>&1` in
    207  1.1.1.5  christos   *gcc*) gcc=1
    208  1.1.1.5  christos     GCOV="gcov" ;;
    209  1.1.1.5  christos   *clang*) gcc=1
    210  1.1.1.5  christos     clang=1 ;;
    211      1.1  christos esac
    212      1.1  christos 
    213  1.1.1.5  christos if test $cover -eq 1; then
    214  1.1.1.5  christos   if test "$clang" -eq 1; then
    215  1.1.1.5  christos     if test "$cc" = "clang"; then
    216  1.1.1.5  christos 	  if command -v llvm-cov >/dev/null 2>&1; then
    217  1.1.1.5  christos 	    GCOV="llvm-cov"
    218  1.1.1.5  christos 	    LLVM_GCOV_FLAG="gcov"
    219  1.1.1.5  christos 	    GCOV="llvm-cov"
    220  1.1.1.5  christos 	    LLVM_GCOV_FLAG="gcov"
    221  1.1.1.5  christos 	    echo "Using ${GCOV} for coverage"
    222  1.1.1.5  christos 	  else
    223  1.1.1.5  christos 	    cover=0
    224  1.1.1.5  christos 	    GCOV=""
    225  1.1.1.5  christos 	    LLVM_GCOV_FLAG=""
    226  1.1.1.5  christos 	    echo "Deactivating cover as no suitable gcov can be found"
    227  1.1.1.5  christos 	  fi
    228  1.1.1.5  christos     else
    229  1.1.1.5  christos 	  clangV=`echo "$cc" | sed -e 's/^.*-//'`
    230  1.1.1.5  christos 	  if command -v llvm-cov-${clangV} >/dev/null 2>&1; then
    231  1.1.1.5  christos 	    GCOV="llvm-cov-${clangV}"
    232  1.1.1.5  christos 	    LLVM_GCOV_FLAG="gcov"
    233  1.1.1.5  christos 	    echo "Using ${GCOV} for coverage"
    234  1.1.1.5  christos 	  else
    235  1.1.1.5  christos 	    cover=0
    236  1.1.1.5  christos 	    GCOV=""
    237  1.1.1.5  christos 	    LLVM_GCOV_FLAG=""
    238  1.1.1.5  christos 	    echo "Deactivating cover as no suitable gcov can be found"
    239  1.1.1.5  christos 	  fi
    240  1.1.1.5  christos     fi
    241  1.1.1.5  christos   fi
    242  1.1.1.5  christos fi
    243  1.1.1.5  christos 
    244  1.1.1.2  christos show $cc -c $test.c
    245  1.1.1.2  christos if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then
    246  1.1.1.2  christos   echo ... using gcc >> configure.log
    247      1.1  christos   CC="$cc"
    248  1.1.1.5  christos   CFLAGS="${CFLAGS--O3} -fPIC"
    249  1.1.1.5  christos   SFLAGS="${CFLAGS--O3}"
    250  1.1.1.2  christos   if test "$ARCHS"; then
    251  1.1.1.2  christos     CFLAGS="${CFLAGS} ${ARCHS}"
    252  1.1.1.5  christos     SFLAGS="${SFLAGS} ${ARCHS}"
    253  1.1.1.2  christos     LDFLAGS="${LDFLAGS} ${ARCHS}"
    254  1.1.1.2  christos   fi
    255  1.1.1.2  christos   if test $build64 -eq 1; then
    256  1.1.1.2  christos     CFLAGS="${CFLAGS} -m64"
    257  1.1.1.2  christos     SFLAGS="${SFLAGS} -m64"
    258  1.1.1.2  christos   fi
    259  1.1.1.5  christos   if test "$warn" -ge 1; then
    260  1.1.1.5  christos     CFLAGS="${CFLAGS} -Wall -Wextra"
    261  1.1.1.5  christos     if test "$warn" -ge 2; then
    262  1.1.1.5  christos       CFLAGS="${CFLAGS} -Wconversion -Wshadow -Wundef"
    263  1.1.1.2  christos     fi
    264  1.1.1.2  christos   fi
    265  1.1.1.5  christos   if test "$zconst" -eq 1; then
    266  1.1.1.5  christos     if test "$warn" -ge 1; then
    267  1.1.1.5  christos       CFLAGS="${CFLAGS} -Wcast-qual"
    268  1.1.1.5  christos     fi
    269  1.1.1.5  christos     CFLAGS="${CFLAGS} -DZLIB_CONST"
    270  1.1.1.5  christos   fi
    271  1.1.1.4  christos   if test $address -eq 1; then
    272  1.1.1.4  christos     CFLAGS="${CFLAGS} -g -fsanitize=address -fno-omit-frame-pointer"
    273  1.1.1.4  christos   fi
    274  1.1.1.4  christos   if test $memory -eq 1; then
    275  1.1.1.4  christos     CFLAGS="${CFLAGS} -g -fsanitize=memory -fno-omit-frame-pointer"
    276  1.1.1.3  christos   fi
    277  1.1.1.5  christos   if test $undefined -eq 1; then
    278  1.1.1.5  christos     CFLAGS="${CFLAGS} -g -fsanitize=undefined -fno-omit-frame-pointer"
    279  1.1.1.5  christos   fi
    280  1.1.1.5  christos   if test $insecure -eq 1; then
    281  1.1.1.5  christos     CFLAGS="${CFLAGS} -DZLIB_INSECURE"
    282  1.1.1.5  christos     SFLAGS="${SFLAGS} -DZLIB_INSECURE"
    283  1.1.1.5  christos   fi
    284  1.1.1.2  christos   if test $debug -eq 1; then
    285  1.1.1.2  christos     CFLAGS="${CFLAGS} -DZLIB_DEBUG"
    286  1.1.1.2  christos     SFLAGS="${SFLAGS} -DZLIB_DEBUG"
    287  1.1.1.2  christos   fi
    288  1.1.1.2  christos   if test -z "$uname"; then
    289  1.1.1.2  christos     uname=`(uname -s || echo unknown) 2>/dev/null`
    290  1.1.1.2  christos   fi
    291  1.1.1.2  christos   case "$uname" in
    292  1.1.1.5  christos   Linux* | linux* | *-linux* | GNU | GNU/* | solaris* | Haiku)
    293  1.1.1.3  christos         case "$mname" in
    294  1.1.1.3  christos         *sparc*)
    295  1.1.1.3  christos             LDFLAGS="${LDFLAGS} -Wl,--no-warn-rwx-segments" ;;
    296  1.1.1.3  christos         esac
    297  1.1.1.2  christos         LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"} ;;
    298  1.1.1.2  christos   *BSD | *bsd* | DragonFly)
    299  1.1.1.2  christos         LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"}
    300  1.1.1.2  christos         LDCONFIG="ldconfig -m" ;;
    301  1.1.1.3  christos   CYGWIN* | Cygwin* | cygwin* | *-cygwin* | OS/2*)
    302  1.1.1.2  christos         EXE='.exe' ;;
    303  1.1.1.3  christos   MINGW* | mingw* | *-mingw*)
    304  1.1.1.2  christos         rm -f $test.[co] $test $test$shared_ext
    305  1.1.1.3  christos         echo "If this doesn't work for you, try win32/Makefile.gcc." | tee -a configure.log
    306  1.1.1.2  christos         LDSHARED=${LDSHARED-"$cc -shared"}
    307  1.1.1.2  christos         LDSHAREDLIBC=""
    308  1.1.1.2  christos         EXE='.exe' ;;
    309  1.1.1.3  christos   QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4
    310  1.1.1.3  christos         # (alain.bonnefoy (at] icbt.com)
    311  1.1.1.3  christos         LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"} ;;
    312      1.1  christos   HP-UX*)
    313  1.1.1.3  christos         LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"}
    314  1.1.1.3  christos         case `(uname -m || echo unknown) 2>/dev/null` in
    315  1.1.1.3  christos         ia64)
    316  1.1.1.3  christos             shared_ext='.so'
    317  1.1.1.3  christos             SHAREDLIB='libz.so' ;;
    318  1.1.1.3  christos         *)
    319  1.1.1.3  christos             shared_ext='.sl'
    320  1.1.1.3  christos             SHAREDLIB='libz.sl' ;;
    321  1.1.1.3  christos         esac ;;
    322  1.1.1.3  christos   AIX*)
    323  1.1.1.5  christos         LDSHARED=${LDSHARED-"$cc -shared"}
    324  1.1.1.3  christos         LDFLAGS="${LDFLAGS} -Wl,-brtl" ;;
    325  1.1.1.3  christos   Darwin* | darwin* | *-darwin*)
    326  1.1.1.3  christos         shared_ext='.dylib'
    327  1.1.1.3  christos         SHAREDLIB=libz$shared_ext
    328  1.1.1.3  christos         SHAREDLIBV=libz.$VER$shared_ext
    329  1.1.1.3  christos         SHAREDLIBM=libz.$VER1$shared_ext
    330  1.1.1.3  christos         LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"}
    331  1.1.1.4  christos         if "${CROSS_PREFIX}libtool" -V 2>&1 | grep Apple > /dev/null; then
    332  1.1.1.4  christos             AR="${CROSS_PREFIX}libtool"
    333  1.1.1.4  christos         elif libtool -V 2>&1 | grep Apple > /dev/null; then
    334  1.1.1.3  christos             AR="libtool"
    335  1.1.1.3  christos         else
    336  1.1.1.3  christos             AR="/usr/bin/libtool"
    337  1.1.1.3  christos         fi
    338  1.1.1.3  christos         ARFLAGS="-o" ;;
    339  1.1.1.3  christos   *)
    340  1.1.1.3  christos         LDSHARED=${LDSHARED-"$cc -shared"} ;;
    341      1.1  christos   esac
    342      1.1  christos else
    343      1.1  christos   # find system name and corresponding cc options
    344      1.1  christos   CC=${CC-cc}
    345  1.1.1.2  christos   gcc=0
    346  1.1.1.2  christos   echo ... using $CC >> configure.log
    347  1.1.1.2  christos   if test -z "$uname"; then
    348  1.1.1.2  christos     uname=`(uname -sr || echo unknown) 2>/dev/null`
    349  1.1.1.2  christos   fi
    350  1.1.1.2  christos   case "$uname" in
    351      1.1  christos   HP-UX*)    SFLAGS=${CFLAGS-"-O +z"}
    352      1.1  christos              CFLAGS=${CFLAGS-"-O"}
    353      1.1  christos #            LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"}
    354      1.1  christos              LDSHARED=${LDSHARED-"ld -b"}
    355      1.1  christos          case `(uname -m || echo unknown) 2>/dev/null` in
    356      1.1  christos          ia64)
    357      1.1  christos              shared_ext='.so'
    358  1.1.1.2  christos              SHAREDLIB='libz.so' ;;
    359      1.1  christos          *)
    360      1.1  christos              shared_ext='.sl'
    361  1.1.1.2  christos              SHAREDLIB='libz.sl' ;;
    362  1.1.1.2  christos          esac ;;
    363      1.1  christos   IRIX*)     SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."}
    364      1.1  christos              CFLAGS=${CFLAGS-"-ansi -O2"}
    365  1.1.1.2  christos              LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;;
    366      1.1  christos   OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"}
    367      1.1  christos              CFLAGS=${CFLAGS-"-O -std1"}
    368  1.1.1.2  christos              LDFLAGS="${LDFLAGS} -Wl,-rpath,."
    369  1.1.1.2  christos              LDSHARED=${LDSHARED-"cc -shared  -Wl,-soname,libz.so -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"} ;;
    370      1.1  christos   OSF1*)     SFLAGS=${CFLAGS-"-O -std1"}
    371      1.1  christos              CFLAGS=${CFLAGS-"-O -std1"}
    372  1.1.1.2  christos              LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;;
    373      1.1  christos   QNX*)      SFLAGS=${CFLAGS-"-4 -O"}
    374      1.1  christos              CFLAGS=${CFLAGS-"-4 -O"}
    375      1.1  christos              LDSHARED=${LDSHARED-"cc"}
    376      1.1  christos              RANLIB=${RANLIB-"true"}
    377  1.1.1.2  christos              AR="cc"
    378  1.1.1.2  christos              ARFLAGS="-A" ;;
    379      1.1  christos   SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "}
    380      1.1  christos              CFLAGS=${CFLAGS-"-O3"}
    381  1.1.1.2  christos              LDSHARED=${LDSHARED-"cc -dy -KPIC -G"} ;;
    382  1.1.1.2  christos   SunOS\ 5* | solaris*)
    383  1.1.1.2  christos          LDSHARED=${LDSHARED-"cc -G -h libz$shared_ext.$VER1"}
    384  1.1.1.2  christos          SFLAGS=${CFLAGS-"-fast -KPIC"}
    385  1.1.1.2  christos          CFLAGS=${CFLAGS-"-fast"}
    386  1.1.1.2  christos          if test $build64 -eq 1; then
    387  1.1.1.2  christos              # old versions of SunPRO/Workshop/Studio don't support -m64,
    388  1.1.1.2  christos              # but newer ones do.  Check for it.
    389  1.1.1.2  christos              flag64=`$CC -flags | egrep -- '^-m64'`
    390  1.1.1.2  christos              if test x"$flag64" != x"" ; then
    391  1.1.1.2  christos                  CFLAGS="${CFLAGS} -m64"
    392  1.1.1.2  christos                  SFLAGS="${SFLAGS} -m64"
    393  1.1.1.2  christos              else
    394  1.1.1.2  christos                  case `(uname -m || echo unknown) 2>/dev/null` in
    395  1.1.1.2  christos                    i86*)
    396  1.1.1.2  christos                      SFLAGS="$SFLAGS -xarch=amd64"
    397  1.1.1.2  christos                      CFLAGS="$CFLAGS -xarch=amd64" ;;
    398  1.1.1.2  christos                    *)
    399  1.1.1.2  christos                      SFLAGS="$SFLAGS -xarch=v9"
    400  1.1.1.2  christos                      CFLAGS="$CFLAGS -xarch=v9" ;;
    401  1.1.1.2  christos                  esac
    402  1.1.1.2  christos              fi
    403  1.1.1.2  christos          fi
    404  1.1.1.2  christos          if test -n "$ZINC"; then
    405  1.1.1.2  christos              ZINC='-I- -I. -I$(SRCDIR)'
    406  1.1.1.2  christos          fi
    407  1.1.1.2  christos          ;;
    408      1.1  christos   SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"}
    409      1.1  christos              CFLAGS=${CFLAGS-"-O2"}
    410  1.1.1.2  christos              LDSHARED=${LDSHARED-"ld"} ;;
    411  1.1.1.2  christos   SunStudio\ 9*) SFLAGS=${CFLAGS-"-fast -xcode=pic32 -xtarget=ultra3 -xarch=v9b"}
    412  1.1.1.2  christos              CFLAGS=${CFLAGS-"-fast -xtarget=ultra3 -xarch=v9b"}
    413  1.1.1.2  christos              LDSHARED=${LDSHARED-"cc -xarch=v9b"} ;;
    414      1.1  christos   UNIX_System_V\ 4.2.0)
    415      1.1  christos              SFLAGS=${CFLAGS-"-KPIC -O"}
    416      1.1  christos              CFLAGS=${CFLAGS-"-O"}
    417  1.1.1.2  christos              LDSHARED=${LDSHARED-"cc -G"} ;;
    418      1.1  christos   UNIX_SV\ 4.2MP)
    419      1.1  christos              SFLAGS=${CFLAGS-"-Kconform_pic -O"}
    420      1.1  christos              CFLAGS=${CFLAGS-"-O"}
    421  1.1.1.2  christos              LDSHARED=${LDSHARED-"cc -G"} ;;
    422      1.1  christos   OpenUNIX\ 5)
    423      1.1  christos              SFLAGS=${CFLAGS-"-KPIC -O"}
    424      1.1  christos              CFLAGS=${CFLAGS-"-O"}
    425  1.1.1.2  christos              LDSHARED=${LDSHARED-"cc -G"} ;;
    426      1.1  christos   AIX*)  # Courtesy of dbakker (at] arrayasolutions.com
    427      1.1  christos              SFLAGS=${CFLAGS-"-O -qmaxmem=8192"}
    428      1.1  christos              CFLAGS=${CFLAGS-"-O -qmaxmem=8192"}
    429  1.1.1.5  christos              LDSHARED=${LDSHARED-"xlc -G"}
    430  1.1.1.5  christos              if test $build64 -eq 1; then
    431  1.1.1.5  christos                  CFLAGS="${CFLAGS} -q64"
    432  1.1.1.5  christos                  SFLAGS="${SFLAGS} -q64"
    433  1.1.1.5  christos                  ARFLAGS="-X64 ${ARFLAGS}"
    434  1.1.1.5  christos              fi ;;
    435  1.1.1.2  christos   # send working options for other systems to zlib (at] gzip.org
    436      1.1  christos   *)         SFLAGS=${CFLAGS-"-O"}
    437      1.1  christos              CFLAGS=${CFLAGS-"-O"}
    438  1.1.1.2  christos              LDSHARED=${LDSHARED-"cc -shared"} ;;
    439      1.1  christos   esac
    440      1.1  christos fi
    441      1.1  christos 
    442  1.1.1.2  christos # destination names for shared library if not defined above
    443      1.1  christos SHAREDLIB=${SHAREDLIB-"libz$shared_ext"}
    444      1.1  christos SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"}
    445      1.1  christos SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"}
    446      1.1  christos 
    447  1.1.1.2  christos echo >> configure.log
    448  1.1.1.2  christos 
    449  1.1.1.2  christos # define functions for testing compiler and library characteristics and logging the results
    450  1.1.1.2  christos 
    451  1.1.1.2  christos cat > $test.c <<EOF
    452  1.1.1.2  christos #error error
    453  1.1.1.2  christos EOF
    454  1.1.1.2  christos if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
    455  1.1.1.2  christos   try()
    456  1.1.1.2  christos   {
    457  1.1.1.2  christos     show $*
    458  1.1.1.2  christos     test "`( $* ) 2>&1 | tee -a configure.log`" = ""
    459  1.1.1.2  christos   }
    460  1.1.1.2  christos   echo - using any output from compiler to indicate an error >> configure.log
    461  1.1.1.2  christos else
    462  1.1.1.2  christos   try()
    463  1.1.1.2  christos   {
    464  1.1.1.2  christos     show $*
    465  1.1.1.3  christos     got=`( $* ) 2>&1`
    466  1.1.1.2  christos     ret=$?
    467  1.1.1.3  christos     if test "$got" != ""; then
    468  1.1.1.3  christos       printf "%s\n" "$got" >> configure.log
    469  1.1.1.3  christos     fi
    470  1.1.1.2  christos     if test $ret -ne 0; then
    471  1.1.1.2  christos       echo "(exit code "$ret")" >> configure.log
    472  1.1.1.2  christos     fi
    473  1.1.1.2  christos     return $ret
    474  1.1.1.2  christos   }
    475  1.1.1.2  christos fi
    476  1.1.1.2  christos 
    477  1.1.1.2  christos tryboth()
    478  1.1.1.2  christos {
    479  1.1.1.2  christos   show $*
    480  1.1.1.2  christos   got=`( $* ) 2>&1`
    481  1.1.1.2  christos   ret=$?
    482  1.1.1.3  christos   if test "$got" != ""; then
    483  1.1.1.3  christos     printf "%s\n" "$got" >> configure.log
    484  1.1.1.3  christos   fi
    485  1.1.1.2  christos   if test $ret -ne 0; then
    486  1.1.1.3  christos     echo "(exit code "$ret")" >> configure.log
    487  1.1.1.2  christos     return $ret
    488  1.1.1.2  christos   fi
    489  1.1.1.2  christos   test "$got" = ""
    490  1.1.1.2  christos }
    491  1.1.1.2  christos 
    492  1.1.1.2  christos cat > $test.c << EOF
    493  1.1.1.2  christos int foo() { return 0; }
    494  1.1.1.2  christos EOF
    495  1.1.1.5  christos echo "Checking for compiler..." >> configure.log
    496  1.1.1.5  christos if try $CC -c $test.c; then
    497  1.1.1.5  christos   :
    498  1.1.1.5  christos else
    499  1.1.1.5  christos   echo "Missing or broken C compiler." | tee -a configure.log
    500  1.1.1.5  christos   leave 1
    501  1.1.1.5  christos fi
    502  1.1.1.2  christos echo "Checking for obsessive-compulsive compiler options..." >> configure.log
    503  1.1.1.2  christos if try $CC -c $CFLAGS $test.c; then
    504  1.1.1.2  christos   :
    505  1.1.1.2  christos else
    506  1.1.1.2  christos   echo "Compiler error reporting is too harsh for $0 (perhaps remove -Werror)." | tee -a configure.log
    507  1.1.1.2  christos   leave 1
    508  1.1.1.2  christos fi
    509  1.1.1.2  christos 
    510  1.1.1.2  christos echo >> configure.log
    511  1.1.1.2  christos 
    512  1.1.1.2  christos # see if shared library build supported
    513  1.1.1.2  christos cat > $test.c <<EOF
    514  1.1.1.2  christos extern int getchar();
    515  1.1.1.2  christos int hello() {return getchar();}
    516  1.1.1.2  christos EOF
    517      1.1  christos if test $shared -eq 1; then
    518  1.1.1.2  christos   echo Checking for shared library support... | tee -a configure.log
    519      1.1  christos   # we must test in two steps (cc then ld), required at least on SunOS 4.x
    520  1.1.1.4  christos   if try $CC -c $SFLAGS $test.c &&
    521  1.1.1.5  christos      try $LDSHARED $SFLAGS $LDFLAGS -o $test$shared_ext $test.o; then
    522  1.1.1.2  christos     echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log
    523      1.1  christos   elif test -z "$old_cc" -a -z "$old_cflags"; then
    524  1.1.1.2  christos     echo No shared library support. | tee -a configure.log
    525      1.1  christos     shared=0;
    526      1.1  christos   else
    527  1.1.1.2  christos     echo 'No shared library support; try without defining CC and CFLAGS' | tee -a configure.log
    528      1.1  christos     shared=0;
    529      1.1  christos   fi
    530      1.1  christos fi
    531      1.1  christos if test $shared -eq 0; then
    532      1.1  christos   LDSHARED="$CC"
    533  1.1.1.2  christos   ALL="static"
    534  1.1.1.2  christos   TEST="all teststatic"
    535  1.1.1.2  christos   SHAREDLIB=""
    536  1.1.1.2  christos   SHAREDLIBV=""
    537  1.1.1.2  christos   SHAREDLIBM=""
    538  1.1.1.2  christos   echo Building static library $STATICLIB version $VER with $CC. | tee -a configure.log
    539  1.1.1.2  christos else
    540  1.1.1.2  christos   ALL="static shared"
    541  1.1.1.2  christos   TEST="all teststatic testshared"
    542  1.1.1.2  christos fi
    543  1.1.1.2  christos 
    544  1.1.1.2  christos echo >> configure.log
    545  1.1.1.2  christos 
    546  1.1.1.2  christos # check for size_t
    547  1.1.1.2  christos cat > $test.c <<EOF
    548  1.1.1.2  christos #include <stdio.h>
    549  1.1.1.2  christos #include <stdlib.h>
    550  1.1.1.2  christos size_t dummy = 0;
    551  1.1.1.2  christos EOF
    552  1.1.1.2  christos if try $CC -c $CFLAGS $test.c; then
    553  1.1.1.2  christos   echo "Checking for size_t... Yes." | tee -a configure.log
    554  1.1.1.2  christos else
    555  1.1.1.2  christos   echo "Checking for size_t... No." | tee -a configure.log
    556  1.1.1.3  christos   # find a size_t integer type
    557  1.1.1.3  christos   # check for long long
    558  1.1.1.3  christos   cat > $test.c << EOF
    559  1.1.1.2  christos long long dummy = 0;
    560  1.1.1.2  christos EOF
    561  1.1.1.2  christos   if try $CC -c $CFLAGS $test.c; then
    562  1.1.1.2  christos     echo "Checking for long long... Yes." | tee -a configure.log
    563  1.1.1.2  christos     cat > $test.c <<EOF
    564  1.1.1.2  christos #include <stdio.h>
    565  1.1.1.2  christos int main(void) {
    566  1.1.1.2  christos     if (sizeof(void *) <= sizeof(int)) puts("int");
    567  1.1.1.2  christos     else if (sizeof(void *) <= sizeof(long)) puts("long");
    568  1.1.1.2  christos     else puts("z_longlong");
    569  1.1.1.2  christos     return 0;
    570  1.1.1.2  christos }
    571  1.1.1.2  christos EOF
    572  1.1.1.2  christos   else
    573  1.1.1.2  christos     echo "Checking for long long... No." | tee -a configure.log
    574  1.1.1.2  christos     cat > $test.c <<EOF
    575  1.1.1.2  christos #include <stdio.h>
    576  1.1.1.2  christos int main(void) {
    577  1.1.1.2  christos     if (sizeof(void *) <= sizeof(int)) puts("int");
    578  1.1.1.2  christos     else puts("long");
    579  1.1.1.2  christos     return 0;
    580  1.1.1.2  christos }
    581  1.1.1.2  christos EOF
    582  1.1.1.2  christos   fi
    583  1.1.1.5  christos   if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then
    584  1.1.1.2  christos     sizet=`./$test`
    585  1.1.1.2  christos     echo "Checking for a pointer-size integer type..." $sizet"." | tee -a configure.log
    586  1.1.1.3  christos     CFLAGS="${CFLAGS} -DNO_SIZE_T=${sizet}"
    587  1.1.1.3  christos     SFLAGS="${SFLAGS} -DNO_SIZE_T=${sizet}"
    588  1.1.1.2  christos   else
    589  1.1.1.3  christos     echo "Checking for a pointer-size integer type... not found." | tee -a configure.log
    590  1.1.1.2  christos   fi
    591  1.1.1.2  christos fi
    592  1.1.1.2  christos 
    593  1.1.1.2  christos echo >> configure.log
    594  1.1.1.2  christos 
    595  1.1.1.2  christos # check for large file support, and if none, check for fseeko()
    596  1.1.1.2  christos cat > $test.c <<EOF
    597  1.1.1.2  christos #include <sys/types.h>
    598  1.1.1.2  christos off64_t dummy = 0;
    599  1.1.1.2  christos EOF
    600  1.1.1.2  christos if try $CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c; then
    601  1.1.1.2  christos   CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1"
    602  1.1.1.2  christos   SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1"
    603  1.1.1.2  christos   ALL="${ALL} all64"
    604  1.1.1.2  christos   TEST="${TEST} test64"
    605  1.1.1.2  christos   echo "Checking for off64_t... Yes." | tee -a configure.log
    606  1.1.1.2  christos   echo "Checking for fseeko... Yes." | tee -a configure.log
    607  1.1.1.2  christos else
    608  1.1.1.2  christos   echo "Checking for off64_t... No." | tee -a configure.log
    609  1.1.1.2  christos   echo >> configure.log
    610  1.1.1.2  christos   cat > $test.c <<EOF
    611  1.1.1.2  christos #include <stdio.h>
    612  1.1.1.2  christos int main(void) {
    613  1.1.1.2  christos   fseeko(NULL, 0, 0);
    614  1.1.1.2  christos   return 0;
    615  1.1.1.2  christos }
    616  1.1.1.2  christos EOF
    617  1.1.1.5  christos   if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then
    618  1.1.1.2  christos     echo "Checking for fseeko... Yes." | tee -a configure.log
    619  1.1.1.2  christos   else
    620  1.1.1.2  christos     CFLAGS="${CFLAGS} -DNO_FSEEKO"
    621  1.1.1.2  christos     SFLAGS="${SFLAGS} -DNO_FSEEKO"
    622  1.1.1.2  christos     echo "Checking for fseeko... No." | tee -a configure.log
    623  1.1.1.2  christos   fi
    624  1.1.1.2  christos fi
    625  1.1.1.2  christos 
    626  1.1.1.2  christos echo >> configure.log
    627  1.1.1.2  christos 
    628  1.1.1.2  christos # check for strerror() for use by gz* functions
    629  1.1.1.2  christos cat > $test.c <<EOF
    630  1.1.1.2  christos #include <string.h>
    631  1.1.1.2  christos #include <errno.h>
    632  1.1.1.2  christos int main() { return strlen(strerror(errno)); }
    633  1.1.1.2  christos EOF
    634  1.1.1.5  christos if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then
    635  1.1.1.2  christos   echo "Checking for strerror... Yes." | tee -a configure.log
    636      1.1  christos else
    637  1.1.1.2  christos   CFLAGS="${CFLAGS} -DNO_STRERROR"
    638  1.1.1.2  christos   SFLAGS="${SFLAGS} -DNO_STRERROR"
    639  1.1.1.2  christos   echo "Checking for strerror... No." | tee -a configure.log
    640      1.1  christos fi
    641      1.1  christos 
    642  1.1.1.2  christos # copy clean zconf.h for subsequent edits
    643  1.1.1.2  christos cp -p ${SRCDIR}zconf.h.in zconf.h
    644  1.1.1.2  christos 
    645  1.1.1.2  christos echo >> configure.log
    646  1.1.1.2  christos 
    647  1.1.1.2  christos # check for unistd.h and save result in zconf.h
    648      1.1  christos cat > $test.c <<EOF
    649      1.1  christos #include <unistd.h>
    650      1.1  christos int main() { return 0; }
    651      1.1  christos EOF
    652  1.1.1.2  christos if try $CC -c $CFLAGS $test.c; then
    653  1.1.1.5  christos   sed < zconf.h "/^#if HAVE_UNISTD_H-0.* may be/s/ HAVE_UNISTD_H-0\(.*\) may be/ 1\1 was/" > zconf.temp.h
    654  1.1.1.2  christos   mv zconf.temp.h zconf.h
    655  1.1.1.2  christos   echo "Checking for unistd.h... Yes." | tee -a configure.log
    656      1.1  christos else
    657  1.1.1.2  christos   echo "Checking for unistd.h... No." | tee -a configure.log
    658  1.1.1.2  christos fi
    659  1.1.1.2  christos 
    660  1.1.1.2  christos echo >> configure.log
    661  1.1.1.2  christos 
    662  1.1.1.2  christos # check for stdarg.h and save result in zconf.h
    663  1.1.1.2  christos cat > $test.c <<EOF
    664  1.1.1.2  christos #include <stdarg.h>
    665  1.1.1.2  christos int main() { return 0; }
    666  1.1.1.2  christos EOF
    667  1.1.1.2  christos if try $CC -c $CFLAGS $test.c; then
    668  1.1.1.5  christos   sed < zconf.h "/^#if HAVE_STDARG_H-0.* may be/s/ HAVE_STDARG_H-0\(.*\) may be/ 1\1 was/" > zconf.temp.h
    669  1.1.1.2  christos   mv zconf.temp.h zconf.h
    670  1.1.1.2  christos   echo "Checking for stdarg.h... Yes." | tee -a configure.log
    671  1.1.1.2  christos else
    672  1.1.1.2  christos   echo "Checking for stdarg.h... No." | tee -a configure.log
    673  1.1.1.2  christos fi
    674  1.1.1.2  christos 
    675  1.1.1.2  christos # if the z_ prefix was requested, save that in zconf.h
    676  1.1.1.2  christos if test $zprefix -eq 1; then
    677  1.1.1.2  christos   sed < zconf.h "/#ifdef Z_PREFIX.* may be/s/def Z_PREFIX\(.*\) may be/ 1\1 was/" > zconf.temp.h
    678  1.1.1.2  christos   mv zconf.temp.h zconf.h
    679  1.1.1.2  christos   echo >> configure.log
    680  1.1.1.2  christos   echo "Using z_ prefix on all symbols." | tee -a configure.log
    681  1.1.1.2  christos fi
    682  1.1.1.2  christos 
    683  1.1.1.2  christos # if --solo compilation was requested, save that in zconf.h and remove gz stuff from object lists
    684  1.1.1.2  christos if test $solo -eq 1; then
    685  1.1.1.2  christos   sed '/#define ZCONF_H/a\
    686  1.1.1.2  christos #define Z_SOLO
    687  1.1.1.2  christos 
    688  1.1.1.2  christos ' < zconf.h > zconf.temp.h
    689  1.1.1.2  christos   mv zconf.temp.h zconf.h
    690  1.1.1.2  christos OBJC='$(OBJZ)'
    691  1.1.1.2  christos PIC_OBJC='$(PIC_OBJZ)'
    692  1.1.1.2  christos fi
    693  1.1.1.2  christos 
    694  1.1.1.2  christos # if code coverage testing was requested, use older gcc if defined, e.g. "gcc-4.2" on Mac OS X
    695  1.1.1.2  christos if test $cover -eq 1; then
    696  1.1.1.2  christos   if test -n "$GCC_CLASSIC"; then
    697  1.1.1.2  christos     CC=$GCC_CLASSIC
    698  1.1.1.2  christos   fi
    699      1.1  christos fi
    700      1.1  christos 
    701  1.1.1.2  christos echo >> configure.log
    702  1.1.1.2  christos 
    703  1.1.1.2  christos # conduct a series of tests to resolve eight possible cases of using "vs" or "s" printf functions
    704  1.1.1.2  christos # (using stdarg or not), with or without "n" (proving size of buffer), and with or without a
    705  1.1.1.2  christos # return value.  The most secure result is vsnprintf() with a return value.  snprintf() with a
    706  1.1.1.2  christos # return value is secure as well, but then gzprintf() will be limited to 20 arguments.
    707      1.1  christos cat > $test.c <<EOF
    708      1.1  christos #include <stdio.h>
    709      1.1  christos #include <stdarg.h>
    710      1.1  christos #include "zconf.h"
    711      1.1  christos int main()
    712      1.1  christos {
    713      1.1  christos #ifndef STDC
    714      1.1  christos   choke me
    715      1.1  christos #endif
    716      1.1  christos   return 0;
    717      1.1  christos }
    718      1.1  christos EOF
    719  1.1.1.2  christos if try $CC -c $CFLAGS $test.c; then
    720  1.1.1.2  christos   echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()." | tee -a configure.log
    721      1.1  christos 
    722  1.1.1.2  christos   echo >> configure.log
    723      1.1  christos   cat > $test.c <<EOF
    724      1.1  christos #include <stdio.h>
    725      1.1  christos #include <stdarg.h>
    726  1.1.1.2  christos int mytest(const char *fmt, ...)
    727      1.1  christos {
    728      1.1  christos   char buf[20];
    729      1.1  christos   va_list ap;
    730      1.1  christos   va_start(ap, fmt);
    731      1.1  christos   vsnprintf(buf, sizeof(buf), fmt, ap);
    732      1.1  christos   va_end(ap);
    733      1.1  christos   return 0;
    734      1.1  christos }
    735      1.1  christos int main()
    736      1.1  christos {
    737      1.1  christos   return (mytest("Hello%d\n", 1));
    738      1.1  christos }
    739      1.1  christos EOF
    740  1.1.1.5  christos   if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then
    741  1.1.1.2  christos     echo "Checking for vsnprintf() in stdio.h... Yes." | tee -a configure.log
    742      1.1  christos 
    743  1.1.1.2  christos     echo >> configure.log
    744      1.1  christos     cat >$test.c <<EOF
    745      1.1  christos #include <stdio.h>
    746      1.1  christos #include <stdarg.h>
    747  1.1.1.2  christos int mytest(const char *fmt, ...)
    748      1.1  christos {
    749      1.1  christos   int n;
    750      1.1  christos   char buf[20];
    751      1.1  christos   va_list ap;
    752      1.1  christos   va_start(ap, fmt);
    753      1.1  christos   n = vsnprintf(buf, sizeof(buf), fmt, ap);
    754      1.1  christos   va_end(ap);
    755      1.1  christos   return n;
    756      1.1  christos }
    757      1.1  christos int main()
    758      1.1  christos {
    759      1.1  christos   return (mytest("Hello%d\n", 1));
    760      1.1  christos }
    761      1.1  christos EOF
    762      1.1  christos 
    763  1.1.1.2  christos     if try $CC -c $CFLAGS $test.c; then
    764  1.1.1.2  christos       echo "Checking for return value of vsnprintf()... Yes." | tee -a configure.log
    765      1.1  christos     else
    766      1.1  christos       CFLAGS="$CFLAGS -DHAS_vsnprintf_void"
    767  1.1.1.2  christos       SFLAGS="$SFLAGS -DHAS_vsnprintf_void"
    768  1.1.1.2  christos       echo "Checking for return value of vsnprintf()... No." | tee -a configure.log
    769  1.1.1.2  christos       echo "  WARNING: apparently vsnprintf() does not return a value. zlib" | tee -a configure.log
    770  1.1.1.2  christos       echo "  can build but will be open to possible string-format security" | tee -a configure.log
    771  1.1.1.2  christos       echo "  vulnerabilities." | tee -a configure.log
    772      1.1  christos     fi
    773      1.1  christos   else
    774      1.1  christos     CFLAGS="$CFLAGS -DNO_vsnprintf"
    775  1.1.1.2  christos     SFLAGS="$SFLAGS -DNO_vsnprintf"
    776  1.1.1.2  christos     echo "Checking for vsnprintf() in stdio.h... No." | tee -a configure.log
    777  1.1.1.2  christos     echo "  WARNING: vsnprintf() not found, falling back to vsprintf(). zlib" | tee -a configure.log
    778  1.1.1.2  christos     echo "  can build but will be open to possible buffer-overflow security" | tee -a configure.log
    779  1.1.1.2  christos     echo "  vulnerabilities." | tee -a configure.log
    780  1.1.1.5  christos     if test $insecure -ne 1; then
    781  1.1.1.5  christos       echo "  The --insecure option must be provided to ./configure in order to" | tee -a configure.log
    782  1.1.1.5  christos       echo "  compile using the insecure vsprintf() function." | tee -a configure.log
    783  1.1.1.5  christos     fi
    784  1.1.1.2  christos     echo >> configure.log
    785      1.1  christos     cat >$test.c <<EOF
    786      1.1  christos #include <stdio.h>
    787      1.1  christos #include <stdarg.h>
    788  1.1.1.2  christos int mytest(const char *fmt, ...)
    789      1.1  christos {
    790      1.1  christos   int n;
    791      1.1  christos   char buf[20];
    792      1.1  christos   va_list ap;
    793      1.1  christos   va_start(ap, fmt);
    794      1.1  christos   n = vsprintf(buf, fmt, ap);
    795      1.1  christos   va_end(ap);
    796      1.1  christos   return n;
    797      1.1  christos }
    798      1.1  christos int main()
    799      1.1  christos {
    800      1.1  christos   return (mytest("Hello%d\n", 1));
    801      1.1  christos }
    802      1.1  christos EOF
    803      1.1  christos 
    804  1.1.1.2  christos     if try $CC -c $CFLAGS $test.c; then
    805  1.1.1.2  christos       echo "Checking for return value of vsprintf()... Yes." | tee -a configure.log
    806      1.1  christos     else
    807      1.1  christos       CFLAGS="$CFLAGS -DHAS_vsprintf_void"
    808  1.1.1.2  christos       SFLAGS="$SFLAGS -DHAS_vsprintf_void"
    809  1.1.1.2  christos       echo "Checking for return value of vsprintf()... No." | tee -a configure.log
    810  1.1.1.2  christos       echo "  WARNING: apparently vsprintf() does not return a value. zlib" | tee -a configure.log
    811  1.1.1.2  christos       echo "  can build but will be open to possible string-format security" | tee -a configure.log
    812  1.1.1.2  christos       echo "  vulnerabilities." | tee -a configure.log
    813      1.1  christos     fi
    814      1.1  christos   fi
    815      1.1  christos else
    816  1.1.1.2  christos   echo "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()." | tee -a configure.log
    817      1.1  christos 
    818  1.1.1.2  christos   echo >> configure.log
    819      1.1  christos   cat >$test.c <<EOF
    820      1.1  christos #include <stdio.h>
    821      1.1  christos int mytest()
    822      1.1  christos {
    823      1.1  christos   char buf[20];
    824      1.1  christos   snprintf(buf, sizeof(buf), "%s", "foo");
    825      1.1  christos   return 0;
    826      1.1  christos }
    827      1.1  christos int main()
    828      1.1  christos {
    829      1.1  christos   return (mytest());
    830      1.1  christos }
    831      1.1  christos EOF
    832      1.1  christos 
    833  1.1.1.5  christos   if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then
    834  1.1.1.2  christos     echo "Checking for snprintf() in stdio.h... Yes." | tee -a configure.log
    835      1.1  christos 
    836  1.1.1.2  christos     echo >> configure.log
    837      1.1  christos     cat >$test.c <<EOF
    838      1.1  christos #include <stdio.h>
    839      1.1  christos int mytest()
    840      1.1  christos {
    841      1.1  christos   char buf[20];
    842      1.1  christos   return snprintf(buf, sizeof(buf), "%s", "foo");
    843      1.1  christos }
    844      1.1  christos int main()
    845      1.1  christos {
    846      1.1  christos   return (mytest());
    847      1.1  christos }
    848      1.1  christos EOF
    849      1.1  christos 
    850  1.1.1.2  christos     if try $CC -c $CFLAGS $test.c; then
    851  1.1.1.2  christos       echo "Checking for return value of snprintf()... Yes." | tee -a configure.log
    852      1.1  christos     else
    853      1.1  christos       CFLAGS="$CFLAGS -DHAS_snprintf_void"
    854  1.1.1.2  christos       SFLAGS="$SFLAGS -DHAS_snprintf_void"
    855  1.1.1.2  christos       echo "Checking for return value of snprintf()... No." | tee -a configure.log
    856  1.1.1.2  christos       echo "  WARNING: apparently snprintf() does not return a value. zlib" | tee -a configure.log
    857  1.1.1.2  christos       echo "  can build but will be open to possible string-format security" | tee -a configure.log
    858  1.1.1.2  christos       echo "  vulnerabilities." | tee -a configure.log
    859      1.1  christos     fi
    860      1.1  christos   else
    861      1.1  christos     CFLAGS="$CFLAGS -DNO_snprintf"
    862  1.1.1.2  christos     SFLAGS="$SFLAGS -DNO_snprintf"
    863  1.1.1.2  christos     echo "Checking for snprintf() in stdio.h... No." | tee -a configure.log
    864  1.1.1.2  christos     echo "  WARNING: snprintf() not found, falling back to sprintf(). zlib" | tee -a configure.log
    865  1.1.1.2  christos     echo "  can build but will be open to possible buffer-overflow security" | tee -a configure.log
    866  1.1.1.2  christos     echo "  vulnerabilities." | tee -a configure.log
    867  1.1.1.5  christos     if test $insecure -ne 1; then
    868  1.1.1.5  christos       echo "  The --insecure option must be provided to ./configure in order to" | tee -a configure.log
    869  1.1.1.5  christos       echo "  compile using the insecure sprintf() function." | tee -a configure.log
    870  1.1.1.5  christos     fi
    871  1.1.1.2  christos     echo >> configure.log
    872      1.1  christos     cat >$test.c <<EOF
    873      1.1  christos #include <stdio.h>
    874      1.1  christos int mytest()
    875      1.1  christos {
    876      1.1  christos   char buf[20];
    877      1.1  christos   return sprintf(buf, "%s", "foo");
    878      1.1  christos }
    879      1.1  christos int main()
    880      1.1  christos {
    881      1.1  christos   return (mytest());
    882      1.1  christos }
    883      1.1  christos EOF
    884      1.1  christos 
    885  1.1.1.2  christos     if try $CC -c $CFLAGS $test.c; then
    886  1.1.1.2  christos       echo "Checking for return value of sprintf()... Yes." | tee -a configure.log
    887      1.1  christos     else
    888      1.1  christos       CFLAGS="$CFLAGS -DHAS_sprintf_void"
    889  1.1.1.2  christos       SFLAGS="$SFLAGS -DHAS_sprintf_void"
    890  1.1.1.2  christos       echo "Checking for return value of sprintf()... No." | tee -a configure.log
    891  1.1.1.2  christos       echo "  WARNING: apparently sprintf() does not return a value. zlib" | tee -a configure.log
    892  1.1.1.2  christos       echo "  can build but will be open to possible string-format security" | tee -a configure.log
    893  1.1.1.2  christos       echo "  vulnerabilities." | tee -a configure.log
    894      1.1  christos     fi
    895      1.1  christos   fi
    896      1.1  christos fi
    897      1.1  christos 
    898  1.1.1.2  christos # see if we can hide zlib internal symbols that are linked between separate source files
    899  1.1.1.2  christos if test "$gcc" -eq 1; then
    900  1.1.1.2  christos   echo >> configure.log
    901  1.1.1.2  christos   cat > $test.c <<EOF
    902  1.1.1.2  christos #define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
    903  1.1.1.2  christos int ZLIB_INTERNAL foo;
    904  1.1.1.2  christos int main()
    905  1.1.1.2  christos {
    906  1.1.1.2  christos   return 0;
    907      1.1  christos }
    908      1.1  christos EOF
    909  1.1.1.2  christos   if tryboth $CC -c $CFLAGS $test.c; then
    910  1.1.1.2  christos     CFLAGS="$CFLAGS -DHAVE_HIDDEN"
    911  1.1.1.2  christos     SFLAGS="$SFLAGS -DHAVE_HIDDEN"
    912  1.1.1.2  christos     echo "Checking for attribute(visibility) support... Yes." | tee -a configure.log
    913  1.1.1.2  christos   else
    914  1.1.1.2  christos     echo "Checking for attribute(visibility) support... No." | tee -a configure.log
    915  1.1.1.2  christos   fi
    916      1.1  christos fi
    917      1.1  christos 
    918  1.1.1.5  christos # check for ibm s390x build
    919  1.1.1.5  christos HAVE_S390X=0
    920  1.1.1.5  christos cat > $test.c << EOF
    921  1.1.1.5  christos #ifndef __s390x__
    922  1.1.1.5  christos     #error
    923  1.1.1.5  christos #endif
    924  1.1.1.5  christos EOF
    925  1.1.1.5  christos if try $CC -c $CFLAGS $test.c; then 
    926  1.1.1.5  christos     echo "Checking for s390x build ... Yes." | tee -a configure.log
    927  1.1.1.5  christos     HAVE_S390X=1
    928  1.1.1.5  christos else
    929  1.1.1.5  christos     echo "Checking for s390x build ... No." | tee -a configure.log
    930  1.1.1.5  christos fi
    931  1.1.1.5  christos 
    932  1.1.1.5  christos # check for ibm s390x vx vector extensions
    933  1.1.1.5  christos HAVE_S390X_VX=0
    934  1.1.1.5  christos if test $HAVE_S390X -eq 1 && test $enable_crcvx -eq 1 ; then
    935  1.1.1.5  christos     # preset the compiler specific flags
    936  1.1.1.5  christos     if test $clang -eq 1; then
    937  1.1.1.5  christos         VGFMAFLAG=-fzvector
    938  1.1.1.5  christos     else
    939  1.1.1.5  christos         VGFMAFLAG=-mzarch
    940  1.1.1.5  christos     fi
    941  1.1.1.5  christos 
    942  1.1.1.5  christos     cat > $test.c <<EOF
    943  1.1.1.5  christos #ifndef __s390x__
    944  1.1.1.5  christos #error
    945  1.1.1.5  christos #endif
    946  1.1.1.5  christos #include <vecintrin.h>
    947  1.1.1.5  christos int main(void) {
    948  1.1.1.5  christos     unsigned long long a __attribute__((vector_size(16))) = { 0 };
    949  1.1.1.5  christos     unsigned long long b __attribute__((vector_size(16))) = { 0 };
    950  1.1.1.5  christos     unsigned char c __attribute__((vector_size(16))) = { 0 };
    951  1.1.1.5  christos     c = vec_gfmsum_accum_128(a, b, c);
    952  1.1.1.5  christos     return c[0];
    953  1.1.1.5  christos }
    954  1.1.1.5  christos EOF
    955  1.1.1.5  christos 
    956  1.1.1.5  christos     # cflags already contains a valid march
    957  1.1.1.5  christos     if try $CC -c $CFLAGS $VGFMAFLAG $test.c; then
    958  1.1.1.5  christos         echo "Checking for s390x vx vector extension ... Yes." | tee -a configure.log
    959  1.1.1.5  christos         HAVE_S390X_VX=1
    960  1.1.1.5  christos     # or set march for our compile units
    961  1.1.1.5  christos     elif try $CC -c $CFLAGS $VGFMAFLAG -march=z13 $test.c; then
    962  1.1.1.5  christos         echo "Checking for s390x vx vector extension (march=z13) ... Yes." | tee -a configure.log
    963  1.1.1.5  christos         HAVE_S390X_VX=1
    964  1.1.1.5  christos         VGFMAFLAG="$VGFMAFLAG -march=z13"
    965  1.1.1.5  christos     # else we are not on s390x
    966  1.1.1.5  christos     else 
    967  1.1.1.5  christos         echo "Checking for s390x vx vector extension ... No." | tee -a configure.log
    968  1.1.1.5  christos     fi
    969  1.1.1.5  christos 
    970  1.1.1.5  christos     # prepare compiling for s390x
    971  1.1.1.5  christos     if test $HAVE_S390X_VX -eq 1; then
    972  1.1.1.5  christos         CFLAGS="$CFLAGS -DHAVE_S390X_VX"
    973  1.1.1.5  christos         SFLAGS="$SFLAGS -DHAVE_S390X_VX"
    974  1.1.1.5  christos         OBJC="$OBJC crc32_vx.o"
    975  1.1.1.5  christos         PIC_OBJC="$PIC_OBJC crc32_vx.lo"
    976  1.1.1.5  christos     else
    977  1.1.1.5  christos         # target has no vx extension
    978  1.1.1.5  christos         VGFMAFLAG=""
    979  1.1.1.5  christos     fi
    980  1.1.1.5  christos fi
    981  1.1.1.5  christos 
    982  1.1.1.2  christos # show the results in the log
    983  1.1.1.2  christos echo >> configure.log
    984  1.1.1.2  christos echo ALL = $ALL >> configure.log
    985  1.1.1.2  christos echo AR = $AR >> configure.log
    986  1.1.1.2  christos echo ARFLAGS = $ARFLAGS >> configure.log
    987  1.1.1.2  christos echo CC = $CC >> configure.log
    988  1.1.1.2  christos echo CFLAGS = $CFLAGS >> configure.log
    989  1.1.1.2  christos echo CPP = $CPP >> configure.log
    990  1.1.1.2  christos echo EXE = $EXE >> configure.log
    991  1.1.1.2  christos echo LDCONFIG = $LDCONFIG >> configure.log
    992  1.1.1.2  christos echo LDFLAGS = $LDFLAGS >> configure.log
    993  1.1.1.2  christos echo LDSHARED = $LDSHARED >> configure.log
    994  1.1.1.2  christos echo LDSHAREDLIBC = $LDSHAREDLIBC >> configure.log
    995  1.1.1.2  christos echo OBJC = $OBJC >> configure.log
    996  1.1.1.2  christos echo PIC_OBJC = $PIC_OBJC >> configure.log
    997  1.1.1.2  christos echo RANLIB = $RANLIB >> configure.log
    998  1.1.1.2  christos echo SFLAGS = $SFLAGS >> configure.log
    999  1.1.1.2  christos echo SHAREDLIB = $SHAREDLIB >> configure.log
   1000  1.1.1.2  christos echo SHAREDLIBM = $SHAREDLIBM >> configure.log
   1001  1.1.1.2  christos echo SHAREDLIBV = $SHAREDLIBV >> configure.log
   1002  1.1.1.2  christos echo STATICLIB = $STATICLIB >> configure.log
   1003  1.1.1.2  christos echo TEST = $TEST >> configure.log
   1004  1.1.1.2  christos echo VER = $VER >> configure.log
   1005  1.1.1.2  christos echo SRCDIR = $SRCDIR >> configure.log
   1006  1.1.1.2  christos echo exec_prefix = $exec_prefix >> configure.log
   1007  1.1.1.2  christos echo includedir = $includedir >> configure.log
   1008  1.1.1.2  christos echo libdir = $libdir >> configure.log
   1009  1.1.1.2  christos echo mandir = $mandir >> configure.log
   1010  1.1.1.2  christos echo prefix = $prefix >> configure.log
   1011  1.1.1.2  christos echo sharedlibdir = $sharedlibdir >> configure.log
   1012  1.1.1.2  christos echo uname = $uname >> configure.log
   1013  1.1.1.5  christos echo HAVE_S390X = $HAVE_S390X >> configure.log
   1014  1.1.1.5  christos echo HAVE_S390X_VX = $HAVE_S390X_VX >> configure.log
   1015  1.1.1.5  christos echo VGFMAFLAG = $VGFMAFLAG >> configure.log
   1016      1.1  christos 
   1017  1.1.1.4  christos # update Makefile with the configure results
   1018  1.1.1.2  christos sed < ${SRCDIR}Makefile.in "
   1019  1.1.1.2  christos /^CC *=/s#=.*#=$CC#
   1020  1.1.1.5  christos /^GCOV *=/s#=.*#=$GCOV#
   1021  1.1.1.5  christos /^LLVM_GCOV_FLAG *=/s#=.*#=$LLVM_GCOV_FLAG#
   1022  1.1.1.2  christos /^CFLAGS *=/s#=.*#=$CFLAGS#
   1023  1.1.1.2  christos /^SFLAGS *=/s#=.*#=$SFLAGS#
   1024  1.1.1.2  christos /^LDFLAGS *=/s#=.*#=$LDFLAGS#
   1025  1.1.1.2  christos /^LDSHARED *=/s#=.*#=$LDSHARED#
   1026  1.1.1.2  christos /^CPP *=/s#=.*#=$CPP#
   1027  1.1.1.2  christos /^STATICLIB *=/s#=.*#=$STATICLIB#
   1028  1.1.1.2  christos /^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
   1029  1.1.1.2  christos /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
   1030  1.1.1.2  christos /^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
   1031  1.1.1.2  christos /^AR *=/s#=.*#=$AR#
   1032  1.1.1.2  christos /^ARFLAGS *=/s#=.*#=$ARFLAGS#
   1033  1.1.1.2  christos /^RANLIB *=/s#=.*#=$RANLIB#
   1034  1.1.1.2  christos /^LDCONFIG *=/s#=.*#=$LDCONFIG#
   1035  1.1.1.2  christos /^LDSHAREDLIBC *=/s#=.*#=$LDSHAREDLIBC#
   1036  1.1.1.2  christos /^EXE *=/s#=.*#=$EXE#
   1037  1.1.1.2  christos /^SRCDIR *=/s#=.*#=$SRCDIR#
   1038  1.1.1.2  christos /^ZINC *=/s#=.*#=$ZINC#
   1039  1.1.1.2  christos /^ZINCOUT *=/s#=.*#=$ZINCOUT#
   1040  1.1.1.2  christos /^prefix *=/s#=.*#=$prefix#
   1041  1.1.1.2  christos /^exec_prefix *=/s#=.*#=$exec_prefix#
   1042  1.1.1.2  christos /^libdir *=/s#=.*#=$libdir#
   1043  1.1.1.2  christos /^sharedlibdir *=/s#=.*#=$sharedlibdir#
   1044  1.1.1.2  christos /^includedir *=/s#=.*#=$includedir#
   1045  1.1.1.2  christos /^mandir *=/s#=.*#=$mandir#
   1046  1.1.1.2  christos /^OBJC *=/s#=.*#= $OBJC#
   1047  1.1.1.2  christos /^PIC_OBJC *=/s#=.*#= $PIC_OBJC#
   1048  1.1.1.2  christos /^all: */s#:.*#: $ALL#
   1049  1.1.1.2  christos /^test: */s#:.*#: $TEST#
   1050  1.1.1.2  christos " > Makefile
   1051      1.1  christos 
   1052  1.1.1.2  christos # create zlib.pc with the configure results
   1053  1.1.1.2  christos sed < ${SRCDIR}zlib.pc.in "
   1054      1.1  christos /^CC *=/s#=.*#=$CC#
   1055      1.1  christos /^CFLAGS *=/s#=.*#=$CFLAGS#
   1056      1.1  christos /^CPP *=/s#=.*#=$CPP#
   1057      1.1  christos /^LDSHARED *=/s#=.*#=$LDSHARED#
   1058  1.1.1.2  christos /^STATICLIB *=/s#=.*#=$STATICLIB#
   1059      1.1  christos /^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
   1060      1.1  christos /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
   1061      1.1  christos /^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
   1062      1.1  christos /^AR *=/s#=.*#=$AR#
   1063  1.1.1.2  christos /^ARFLAGS *=/s#=.*#=$ARFLAGS#
   1064      1.1  christos /^RANLIB *=/s#=.*#=$RANLIB#
   1065      1.1  christos /^EXE *=/s#=.*#=$EXE#
   1066      1.1  christos /^prefix *=/s#=.*#=$prefix#
   1067      1.1  christos /^exec_prefix *=/s#=.*#=$exec_prefix#
   1068      1.1  christos /^libdir *=/s#=.*#=$libdir#
   1069  1.1.1.2  christos /^sharedlibdir *=/s#=.*#=$sharedlibdir#
   1070      1.1  christos /^includedir *=/s#=.*#=$includedir#
   1071      1.1  christos /^mandir *=/s#=.*#=$mandir#
   1072      1.1  christos /^LDFLAGS *=/s#=.*#=$LDFLAGS#
   1073  1.1.1.2  christos " | sed -e "
   1074  1.1.1.2  christos s/\@VERSION\@/$VER/g;
   1075  1.1.1.2  christos " > zlib.pc
   1076  1.1.1.2  christos 
   1077  1.1.1.2  christos # done
   1078  1.1.1.2  christos leave 0
   1079