aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2011-09-09 23:17:33 -0700
committerMark Adler <madler@alumni.caltech.edu>2011-09-09 23:17:33 -0700
commit7850e4e406dce1f7a819297eeb151d1ca18e7cd9 (patch)
treed4befddacae46b06c4924193904de533099610b4 /configure
parentebd3c2c0e734fc99a1360014ea52ed04fe6aade4 (diff)
downloadzlib-7850e4e406dce1f7a819297eeb151d1ca18e7cd9.tar.gz
zlib-7850e4e406dce1f7a819297eeb151d1ca18e7cd9.tar.bz2
zlib-7850e4e406dce1f7a819297eeb151d1ca18e7cd9.zip
zlib 1.0.7v1.0.7
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure69
1 files changed, 52 insertions, 17 deletions
diff --git a/configure b/configure
index a354e4c..520d205 100755
--- a/configure
+++ b/configure
@@ -4,6 +4,10 @@
4# of if you need special compiler, flags or install directory. 4# of if you need special compiler, flags or install directory.
5# Otherwise, you can just use directly "make test; make install" 5# Otherwise, you can just use directly "make test; make install"
6# 6#
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
10#
7# To impose specific compiler or flags or install directory, use for example: 11# To impose specific compiler or flags or install directory, use for example:
8# prefix=$HOME CC=cc CFLAGS="-O4" ./configure 12# prefix=$HOME CC=cc CFLAGS="-O4" ./configure
9# or for csh/tcsh users: 13# or for csh/tcsh users:
@@ -11,22 +15,33 @@
11# LDSHARED is the command to be used to create a shared library 15# LDSHARED is the command to be used to create a shared library
12 16
13LIBS=libz.a 17LIBS=libz.a
18SHAREDLIB=libz.so
14VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h` 19VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
15AR=${AR-"ar rc"} 20AR=${AR-"ar rc"}
16RANLIB=${RANLIB-"ranlib"} 21RANLIB=${RANLIB-"ranlib"}
17prefix=${prefix-/usr/local} 22prefix=${prefix-/usr/local}
18exec_prefix=${exec_prefix-$prefix} 23exec_prefix=${exec_prefix-$prefix}
24shared_ext='.so'
25shared=0
26
27case "$1" in
28 -s* | --s*) shared=1; shift;;
29 -h* | --h*) echo 'syntax: configure [ --shared ]'; exit 0;;
30esac
19 31
20test -z "$CC" && echo Checking for gcc... 32test -z "$CC" && echo Checking for gcc...
21test=ztest$$ 33test=ztest$$
22cat > $test.c <<EOF 34cat > $test.c <<EOF
23int hello() { printf("hello\n"); } 35int hello() { printf("hello\n"); }
24EOF 36EOF
25if test -z "$CC" && (gcc -c -O3 $test.c) 2>/dev/null; then 37if test -z "$CC" -o "$CC" = "gcc" && (gcc -c -O3 $test.c) 2>/dev/null; then
26 CC=gcc 38 CC=gcc
27 SFLAGS=${CFLAGS-"-fPIC -O3"} 39 SFLAGS=${CFLAGS-"-fPIC -O3"}
28 CFLAGS=${CFLAGS-"-O3"} 40 CFLAGS=${CFLAGS-"-O3"}
29 LDSHARED=${LDSHARED-"gcc -shared"} 41 case `(uname -s || echo unknown) 2>/dev/null` in
42 Linux | linux) LDSHARED=${LDSHARED-"gcc -shared -Wl,-soname,libz.so.1"};;
43 *) LDSHARED=${LDSHARED-"gcc -shared"};;
44 esac
30else 45else
31 # find system name and corresponding cc options 46 # find system name and corresponding cc options
32 CC=${CC-cc} 47 CC=${CC-cc}
@@ -50,35 +65,55 @@ else
50 LDSHARED=${LDSHARED-"cc -dy -KPIC -G"};; 65 LDSHARED=${LDSHARED-"cc -dy -KPIC -G"};;
51 HP-UX*) SFLAGS=${CFLAGS-"-O +z"} 66 HP-UX*) SFLAGS=${CFLAGS-"-O +z"}
52 CFLAGS=${CFLAGS-"-O"} 67 CFLAGS=${CFLAGS-"-O"}
53 LDSHARED=${LDSHARED-"ld -b"} 68 LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"}
54 SHAREDLIBS='libz.sl';; 69 shared_ext='.sl'
55 # send working options for other systems to gzip@prep.ai.mit.edu 70 SHAREDLIB='libz.sl';;
71 UNIX_System_V\ 4.2.0)
72 SFLAGS=${CFLAGS-"-KPIC -O"}
73 CFLAGS=${CFLAGS-"-O"}
74 LDSHARED=${LDSHARED-"cc -G"};;
75 # send working options for other systems to support@gzip.org
56 *) SFLAGS=${CFLAGS-"-O"} 76 *) SFLAGS=${CFLAGS-"-O"}
57 CFLAGS=${CFLAGS-"-O"} 77 CFLAGS=${CFLAGS-"-O"}
58 LDSHARED=${LDSHARED-"cc -shared"};; 78 LDSHARED=${LDSHARED-"cc -shared"};;
59 esac 79 esac
60fi 80fi
61 81
62echo Checking for shared library support... 82if test $shared -eq 1; then
63# we must test in two steps (cc then ld), required at least on SunOS 4.x 83 echo Checking for shared library support...
64if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" && 84 # we must test in two steps (cc then ld), required at least on SunOS 4.x
65 test "`($LDSHARED -o $test.so $test.o) 2>&1`" = ""; then 85 if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" &&
66 CFLAGS="$SFLAGS" 86 test "`($LDSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then
67 LIBS='libz.so.$(VER)' 87 CFLAGS="$SFLAGS"
68 echo Building shared library libz.so.$VER with $CC. 88 LIBS="$SHAREDLIB.$VER"
69else 89 echo Building shared library $SHAREDLIB.$VER with $CC.
90 else
91 echo No shared library suppport.
92 shared=0;
93 fi
94fi
95if test $shared -eq 0; then
70 LDSHARED="$CC" 96 LDSHARED="$CC"
71 echo Building static library $LIBS version $VER with $CC. 97 echo Building static library $LIBS version $VER with $CC.
72fi 98fi
73rm -f $test.[co] $test.so 99rm -f $test.[co] $test$shared_ext
100
101if test -f /usr/include/unistd.h; then
102 CFLAGS="$CFLAGS -DHAVE_UNISTD_H"
103fi
104
105if test ! -f /usr/include/errno.h; then
106 CFLAGS="$CFLAGS -DNO_ERRNO_H"
107fi
74 108
75# udpate Makefile 109# udpate Makefile
76sed < Makefile.in " 110sed < Makefile.in "
77/^CC *=/s/=.*/=$CC/ 111/^CC *=/s,=.*,=$CC,
78/^CFLAGS *=/s/=.*/=$CFLAGS/ 112/^CFLAGS *=/s/=.*/=$CFLAGS/
79/^LDSHARED *=/s/=.*/=$LDSHARED/ 113/^LDSHARED *=/s%=.*%=$LDSHARED%
80/^LIBS *=/s,=.*,=$LIBS, 114/^LIBS *=/s,=.*,=$LIBS,
81/^AR *=/s/=.*/=$AR/ 115/^SHAREDLIB *=/s,=.*,=$SHAREDLIB,
116/^AR *=/s,=.*,=$AR,
82/^RANLIB *=/s,=.*,=$RANLIB, 117/^RANLIB *=/s,=.*,=$RANLIB,
83/^VER *=/s/=.*/=$VER/ 118/^VER *=/s/=.*/=$VER/
84/^prefix *=/s,=.*,=$prefix, 119/^prefix *=/s,=.*,=$prefix,