2 # configure script for zlib. This script is needed only if 
   3 # you wish to build a shared library and your system supports them, 
   4 # of if you need special compiler, flags or install directory. 
   5 # Otherwise, you can just use directly "make test; make install" 
   7 # To create a shared library, use "configure --shared"; by default a static 
   8 # library is created. If the primitive shared library support provided here 
   9 # does not work, use ftp://prep.ai.mit.edu/pub/gnu/libtool-*.tar.gz 
  11 # To impose specific compiler or flags or install directory, use for example: 
  12 #    prefix=$HOME CC=cc CFLAGS="-O4" ./configure 
  13 # or for csh/tcsh users: 
  14 #    (setenv prefix $HOME; setenv CC cc; setenv CFLAGS "-O4"; ./configure) 
  15 # LDSHARED is the command to be used to create a shared library 
  17 # Incorrect settings of CC or CFLAGS may prevent creating a shared library. 
  18 # If you have problems, try without defining CC and CFLAGS before reporting 
  23 VER
=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h` 
  25 RANLIB
=${RANLIB-"ranlib"} 
  26 prefix
=${prefix-/usr/local} 
  27 exec_prefix
=${exec_prefix-'${prefix}'} 
  28 libdir
=${libdir-'${exec_prefix}/lib'} 
  29 includedir
=${includedir-'${prefix}/include'} 
  41       echo '  configure [--shared] [--prefix=PREFIX]  [--exec_prefix=EXPREFIX]' 
  42       echo '     [--libdir=LIBDIR] [--includedir=INCLUDEDIR]' 
  44   -p*=* | --p*=*) prefix
=`echo $1 | sed 's/[-a-z_]*=//'`; shift;; 
  45     -e*=* | --e*=*) exec_prefix
=`echo $1 | sed 's/[-a-z_]*=//'`; shift;; 
  46     -l*=* | --libdir=*) libdir
=`echo $1 | sed 's/[-a-z_]*=//'`; shift;; 
  47     -i*=* | --includedir=*) includedir
=`echo $1 | sed 's/[-a-z_]*=//'`;shift;; 
  48   -p* | --p*) prefix
="$2"; shift; shift;; 
  49     -e* | --e*) exec_prefix
="$2"; shift; shift;; 
  50     -l* | --l*) libdir
="$2"; shift; shift;; 
  51     -i* | --i*) includedir
="$2"; shift; shift;; 
  52   -s* | --s*) shared
=1; shift;; 
  59 int hello() {return getchar();} 
  62 test -z "$CC" && echo Checking 
for gcc...
 
  64 cflags
=${CFLAGS-"-O3"} 
  65 # to force the asm version use: CFLAGS="-O3 -DASMV" ./configure 
  70 if test "$gcc" -eq 1 && ($cc -c $cflags $test.c
) 2>/dev
/null
; then 
  72   SFLAGS
=${CFLAGS-"-fPIC -O3"} 
  74   case `(uname -s || echo unknown) 2>/dev/null` in 
  75   Linux 
| linux
) LDSHARED
=${LDSHARED-"gcc -shared -Wl,-soname,libz.so.1"};; 
  76   *)             LDSHARED
=${LDSHARED-"gcc -shared"};; 
  79   # find system name and corresponding cc options 
  81   case `(uname -sr || echo unknown) 2>/dev/null` in 
  82   HP
-UX*)    SFLAGS
=${CFLAGS-"-O +z"} 
  84 #            LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"} 
  85              LDSHARED
=${LDSHARED-"ld -b"} 
  88   IRIX
*)     SFLAGS
=${CFLAGS-"-ansi -O2 -rpath ."} 
  89              CFLAGS
=${CFLAGS-"-ansi -O2"} 
  90              LDSHARED
=${LDSHARED-"cc -shared"};; 
  91   OSF1\ V4
*) SFLAGS
=${CFLAGS-"-O -std1"} 
  92              CFLAGS
=${CFLAGS-"-O -std1"} 
  93              LDSHARED
=${LDSHARED-"cc -shared  -Wl,-soname,$SHAREDLIB -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"};; 
  94   OSF1
*)     SFLAGS
=${CFLAGS-"-O -std1"} 
  95              CFLAGS
=${CFLAGS-"-O -std1"} 
  96              LDSHARED
=${LDSHARED-"cc -shared"};; 
  97   QNX
*)      SFLAGS
=${CFLAGS-"-4 -O"} 
  98              CFLAGS
=${CFLAGS-"-4 -O"} 
  99              LDSHARED
=${LDSHARED-"cc"} 
 100              RANLIB
=${RANLIB-"true"} 
 102   SCO_SV\ 
3.2*) SFLAGS
=${CFLAGS-"-O3 -dy -KPIC "} 
 103              CFLAGS
=${CFLAGS-"-O3"} 
 104              LDSHARED
=${LDSHARED-"cc -dy -KPIC -G"};; 
 105   SunOS\ 
5*) SFLAGS
=${CFLAGS-"-fast -xcg89 -KPIC -R."} 
 106              CFLAGS
=${CFLAGS-"-fast -xcg89"} 
 107              LDSHARED
=${LDSHARED-"cc -G"};; 
 108   SunOS\ 
4*) SFLAGS
=${CFLAGS-"-O2 -PIC"} 
 109              CFLAGS
=${CFLAGS-"-O2"} 
 110              LDSHARED
=${LDSHARED-"ld"};; 
 111   UNIX_System_V\ 
4.2.0)  
 112              SFLAGS
=${CFLAGS-"-KPIC -O"} 
 113              CFLAGS
=${CFLAGS-"-O"} 
 114              LDSHARED
=${LDSHARED-"cc -G"};; 
 116              SFLAGS
=${CFLAGS-"-Kconform_pic -O"} 
 117              CFLAGS
=${CFLAGS-"-O"} 
 118              LDSHARED
=${LDSHARED-"cc -G"};; 
 119   # send working options for other systems to support@gzip.org 
 120   *)         SFLAGS
=${CFLAGS-"-O"} 
 121              CFLAGS
=${CFLAGS-"-O"} 
 122              LDSHARED
=${LDSHARED-"cc -shared"};; 
 126 if test $shared -eq 1; then 
 127   echo Checking 
for shared library support...
 
 128   # we must test in two steps (cc then ld), required at least on SunOS 4.x 
 129   if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" && 
 130      test "`($LDSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then 
 132     LIBS
="$SHAREDLIB.$VER" 
 133     echo Building shared library 
$SHAREDLIB.
$VER with 
$CC.
 
 134   elif test -z "$old_cc" -a -z "$old_cflags"; then 
 135     echo No shared library suppport.
 
 138     echo 'No shared library suppport; try without defining CC and CFLAGS' 
 142 if test $shared -eq 0; then 
 144   echo Building static library 
$LIBS version 
$VER with 
$CC.
 
 149 int main() { return 0; } 
 151 if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then 
 152   CFLAGS
="$CFLAGS -DHAVE_UNISTD_H" 
 153   echo "Checking for unistd.h... Yes." 
 155   echo "Checking for unistd.h... No." 
 160 int main() { return 0; } 
 162 if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then 
 163   echo "Checking for errno.h...  Yes." 
 165   echo "Checking for errno.h...  No." 
 166   CFLAGS
="$CFLAGS -DNO_ERRNO_H" 
 170 #include <sys/types.h> 
 171 #include <sys/mman.h> 
 172 #include <sys/stat.h> 
 174   return mmap((caddr_t)0, (off_t)0, PROT_READ, MAP_SHARED, 0, (off_t)0);  
 177 if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then 
 178   CFLAGS
="$CFLAGS -DUSE_MMAP" 
 179   echo Checking 
for mmap support... Yes.
 
 181   echo Checking 
for mmap support... No.
 
 187     if test "`nm $test.o | grep _hello`" = ""; then 
 188       CPP
="$CPP -DNO_UNDERLINE" 
 189       echo Checking 
for underline 
in external names... No.
 
 191       echo Checking 
for underline 
in external names... Yes.
 
 195 rm -f $test.
[co
] $test$shared_ext 
 200 /^CFLAGS *=/s%=.*%=$CFLAGS% 
 201 /^CPP *=/s%=.*%=$CPP% 
 202 /^LDSHARED *=/s%=.*%=$LDSHARED% 
 203 /^LIBS *=/s%=.*%=$LIBS% 
 204 /^SHAREDLIB *=/s%=.*%=$SHAREDLIB% 
 206 /^RANLIB *=/s%=.*%=$RANLIB% 
 207 /^VER *=/s%=.*%=$VER% 
 208 /^prefix *=/s%=.*%=$prefix% 
 209 /^exec_prefix *=/s%=.*%=$exec_prefix% 
 210 /^libdir *=/s%=.*%=$libdir% 
 211 /^includedir *=/s%=.*%=$includedir%