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 impose specific compiler or flags or install directory, use for example:
8 # prefix=$HOME CC=cc CFLAGS="-O4" ./configure
9 # or for csh/tcsh users:
10 # (setenv prefix $HOME; setenv CC cc; setenv CFLAGS "-O4"; ./configure)
11 # LDSHARED is the command to be used to create a shared library
14 VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
16 prefix=${prefix-/usr/local}
17 exec_prefix=${exec_prefix-$prefix}
19 test -z "$CC" && echo Checking for gcc...
22 int hello() { printf("hello\n"); }
24 if test -z "$CC" && (gcc -c -O3 $test.c) 2>/dev/null; then
26 SFLAGS=${CFLAGS-"-fPIC -O3"}
27 CFLAGS=${CFLAGS-"-O3"}
28 LDSHARED=${LDSHARED-"gcc -shared"}
30 # find system name and corresponding cc options
32 case `(uname -sr || echo unknown) 2>/dev/null` in
33 SunOS\ 5*) SFLAGS=${CFLAGS-"-fast -xcg89 -KPIC -R."}
34 CFLAGS=${CFLAGS-"-fast -xcg89"}
35 LDSHARED=${LDSHARED-"cc -G"};;
36 SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"}
37 CFLAGS=${CFLAGS-"-O2"}
38 LDSHARED=${LDSHARED-"ld"};;
39 IRIX*) SFLAGS=${CFLAGS-"-O2 -rpath ."}
40 CFLAGS=${CFLAGS-"-O2"}
41 LDSHARED=${LDSHARED-"cc -shared"};;
42 QNX*) SFLAGS=${CFLAGS-"-4 -O -Q"}
43 CFLAGS=${CFLAGS-"-4 -O -Q"}
44 LDSHARED=${LDSHARED-"cc"}
47 # send working options for other systems to gzip@prep.ai.mit.edu
48 *) SFLAGS=${CFLAGS-"-O"}
50 LDSHARED=${LDSHARED-"-shared"};;
54 echo Checking for shared library support...
55 # we must test in two steps (cc then ld), required at least on SunOS 4.x
56 if test "`$CC -c $SFLAGS $test.c 2>&1`" = "" &&
57 test "`$LDSHARED -o $test.so $test.o 2>&1`" = ""; then
60 echo Building shared library libz.so.$VER with $CC.
63 echo Building static library $LIBS version $VER with $CC.
65 rm -f $test.[co] $test.so
68 # ed -s Makefile <<EOF
71 /^CFLAGS *=/s/=.*/=$CFLAGS/
72 /^LDSHARED *=/s/=.*/=$LDSHARED/
73 /^LIBS *=/s,=.*,=$LIBS,
76 /^prefix *=/s,=.*,=$prefix,
77 /^exec_prefix *=/s,=.*,=$exec_prefix,