diff options
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 69 |
1 files changed, 52 insertions, 17 deletions
@@ -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 | ||
13 | LIBS=libz.a | 17 | LIBS=libz.a |
18 | SHAREDLIB=libz.so | ||
14 | VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h` | 19 | VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h` |
15 | AR=${AR-"ar rc"} | 20 | AR=${AR-"ar rc"} |
16 | RANLIB=${RANLIB-"ranlib"} | 21 | RANLIB=${RANLIB-"ranlib"} |
17 | prefix=${prefix-/usr/local} | 22 | prefix=${prefix-/usr/local} |
18 | exec_prefix=${exec_prefix-$prefix} | 23 | exec_prefix=${exec_prefix-$prefix} |
24 | shared_ext='.so' | ||
25 | shared=0 | ||
26 | |||
27 | case "$1" in | ||
28 | -s* | --s*) shared=1; shift;; | ||
29 | -h* | --h*) echo 'syntax: configure [ --shared ]'; exit 0;; | ||
30 | esac | ||
19 | 31 | ||
20 | test -z "$CC" && echo Checking for gcc... | 32 | test -z "$CC" && echo Checking for gcc... |
21 | test=ztest$$ | 33 | test=ztest$$ |
22 | cat > $test.c <<EOF | 34 | cat > $test.c <<EOF |
23 | int hello() { printf("hello\n"); } | 35 | int hello() { printf("hello\n"); } |
24 | EOF | 36 | EOF |
25 | if test -z "$CC" && (gcc -c -O3 $test.c) 2>/dev/null; then | 37 | if 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 | ||
30 | else | 45 | else |
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 |
60 | fi | 80 | fi |
61 | 81 | ||
62 | echo Checking for shared library support... | 82 | if 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... |
64 | if 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" |
69 | else | 89 | echo Building shared library $SHAREDLIB.$VER with $CC. |
90 | else | ||
91 | echo No shared library suppport. | ||
92 | shared=0; | ||
93 | fi | ||
94 | fi | ||
95 | if 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. |
72 | fi | 98 | fi |
73 | rm -f $test.[co] $test.so | 99 | rm -f $test.[co] $test$shared_ext |
100 | |||
101 | if test -f /usr/include/unistd.h; then | ||
102 | CFLAGS="$CFLAGS -DHAVE_UNISTD_H" | ||
103 | fi | ||
104 | |||
105 | if test ! -f /usr/include/errno.h; then | ||
106 | CFLAGS="$CFLAGS -DNO_ERRNO_H" | ||
107 | fi | ||
74 | 108 | ||
75 | # udpate Makefile | 109 | # udpate Makefile |
76 | sed < Makefile.in " | 110 | sed < 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, |