diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:14:39 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:14:39 -0700 |
commit | 423eb40306489f9c88f7dba32c2f69179166730b (patch) | |
tree | b5a83b0b1e52bbe0de973dcbc7ec008c1d7cf7d9 /configure | |
parent | 8a2acbffc86012de3523ecf91db2c4ea1b1c4ea2 (diff) | |
download | zlib-423eb40306489f9c88f7dba32c2f69179166730b.tar.gz zlib-423eb40306489f9c88f7dba32c2f69179166730b.tar.bz2 zlib-423eb40306489f9c88f7dba32c2f69179166730b.zip |
zlib 1.0.1v1.0.1
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/configure b/configure new file mode 100755 index 0000000..a354e4c --- /dev/null +++ b/configure | |||
@@ -0,0 +1,86 @@ | |||
1 | #!/bin/sh | ||
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" | ||
6 | # | ||
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 | ||
12 | |||
13 | LIBS=libz.a | ||
14 | VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h` | ||
15 | AR=${AR-"ar rc"} | ||
16 | RANLIB=${RANLIB-"ranlib"} | ||
17 | prefix=${prefix-/usr/local} | ||
18 | exec_prefix=${exec_prefix-$prefix} | ||
19 | |||
20 | test -z "$CC" && echo Checking for gcc... | ||
21 | test=ztest$$ | ||
22 | cat > $test.c <<EOF | ||
23 | int hello() { printf("hello\n"); } | ||
24 | EOF | ||
25 | if test -z "$CC" && (gcc -c -O3 $test.c) 2>/dev/null; then | ||
26 | CC=gcc | ||
27 | SFLAGS=${CFLAGS-"-fPIC -O3"} | ||
28 | CFLAGS=${CFLAGS-"-O3"} | ||
29 | LDSHARED=${LDSHARED-"gcc -shared"} | ||
30 | else | ||
31 | # find system name and corresponding cc options | ||
32 | CC=${CC-cc} | ||
33 | case `(uname -sr || echo unknown) 2>/dev/null` in | ||
34 | SunOS\ 5*) SFLAGS=${CFLAGS-"-fast -xcg89 -KPIC -R."} | ||
35 | CFLAGS=${CFLAGS-"-fast -xcg89"} | ||
36 | LDSHARED=${LDSHARED-"cc -G"};; | ||
37 | SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"} | ||
38 | CFLAGS=${CFLAGS-"-O2"} | ||
39 | LDSHARED=${LDSHARED-"ld"};; | ||
40 | IRIX*) SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."} | ||
41 | CFLAGS=${CFLAGS-"-ansi -O2"} | ||
42 | LDSHARED=${LDSHARED-"cc -shared"};; | ||
43 | QNX*) SFLAGS=${CFLAGS-"-4 -O"} | ||
44 | CFLAGS=${CFLAGS-"-4 -O"} | ||
45 | LDSHARED=${LDSHARED-"cc"} | ||
46 | RANLIB=${RANLIB-"true"} | ||
47 | AR="cc -A";; | ||
48 | SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "} | ||
49 | CFLAGS=${CFLAGS-"-O3"} | ||
50 | LDSHARED=${LDSHARED-"cc -dy -KPIC -G"};; | ||
51 | HP-UX*) SFLAGS=${CFLAGS-"-O +z"} | ||
52 | CFLAGS=${CFLAGS-"-O"} | ||
53 | LDSHARED=${LDSHARED-"ld -b"} | ||
54 | SHAREDLIBS='libz.sl';; | ||
55 | # send working options for other systems to gzip@prep.ai.mit.edu | ||
56 | *) SFLAGS=${CFLAGS-"-O"} | ||
57 | CFLAGS=${CFLAGS-"-O"} | ||
58 | LDSHARED=${LDSHARED-"cc -shared"};; | ||
59 | esac | ||
60 | fi | ||
61 | |||
62 | echo Checking for shared library support... | ||
63 | # we must test in two steps (cc then ld), required at least on SunOS 4.x | ||
64 | if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" && | ||
65 | test "`($LDSHARED -o $test.so $test.o) 2>&1`" = ""; then | ||
66 | CFLAGS="$SFLAGS" | ||
67 | LIBS='libz.so.$(VER)' | ||
68 | echo Building shared library libz.so.$VER with $CC. | ||
69 | else | ||
70 | LDSHARED="$CC" | ||
71 | echo Building static library $LIBS version $VER with $CC. | ||
72 | fi | ||
73 | rm -f $test.[co] $test.so | ||
74 | |||
75 | # udpate Makefile | ||
76 | sed < Makefile.in " | ||
77 | /^CC *=/s/=.*/=$CC/ | ||
78 | /^CFLAGS *=/s/=.*/=$CFLAGS/ | ||
79 | /^LDSHARED *=/s/=.*/=$LDSHARED/ | ||
80 | /^LIBS *=/s,=.*,=$LIBS, | ||
81 | /^AR *=/s/=.*/=$AR/ | ||
82 | /^RANLIB *=/s,=.*,=$RANLIB, | ||
83 | /^VER *=/s/=.*/=$VER/ | ||
84 | /^prefix *=/s,=.*,=$prefix, | ||
85 | /^exec_prefix *=/s,=.*,=$exec_prefix, | ||
86 | " > Makefile | ||