cannam@128
|
1 #!/bin/sh
|
cannam@128
|
2 # configure script for zlib.
|
cannam@128
|
3 #
|
cannam@128
|
4 # Normally configure builds both a static and a shared library.
|
cannam@128
|
5 # If you want to build just a static library, use: ./configure --static
|
cannam@128
|
6 #
|
cannam@128
|
7 # To impose specific compiler or flags or install directory, use for example:
|
cannam@128
|
8 # prefix=$HOME CC=cc CFLAGS="-O4" ./configure
|
cannam@128
|
9 # or for csh/tcsh users:
|
cannam@128
|
10 # (setenv prefix $HOME; setenv CC cc; setenv CFLAGS "-O4"; ./configure)
|
cannam@128
|
11
|
cannam@128
|
12 # Incorrect settings of CC or CFLAGS may prevent creating a shared library.
|
cannam@128
|
13 # If you have problems, try without defining CC and CFLAGS before reporting
|
cannam@128
|
14 # an error.
|
cannam@128
|
15
|
cannam@128
|
16 # start off configure.log
|
cannam@128
|
17 echo -------------------- >> configure.log
|
cannam@128
|
18 echo $0 $* >> configure.log
|
cannam@128
|
19 date >> configure.log
|
cannam@128
|
20
|
cannam@128
|
21 # set command prefix for cross-compilation
|
cannam@128
|
22 if [ -n "${CHOST}" ]; then
|
cannam@128
|
23 uname="`echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/'`"
|
cannam@128
|
24 CROSS_PREFIX="${CHOST}-"
|
cannam@128
|
25 fi
|
cannam@128
|
26
|
cannam@128
|
27 # destination name for static library
|
cannam@128
|
28 STATICLIB=libz.a
|
cannam@128
|
29
|
cannam@128
|
30 # extract zlib version numbers from zlib.h
|
cannam@128
|
31 VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
|
cannam@128
|
32 VER3=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < zlib.h`
|
cannam@128
|
33 VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h`
|
cannam@128
|
34 VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h`
|
cannam@128
|
35
|
cannam@128
|
36 # establish commands for library building
|
cannam@128
|
37 if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then
|
cannam@128
|
38 AR=${AR-"${CROSS_PREFIX}ar"}
|
cannam@128
|
39 test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log
|
cannam@128
|
40 else
|
cannam@128
|
41 AR=${AR-"ar"}
|
cannam@128
|
42 test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log
|
cannam@128
|
43 fi
|
cannam@128
|
44 ARFLAGS=${ARFLAGS-"rc"}
|
cannam@128
|
45 if "${CROSS_PREFIX}ranlib" --version >/dev/null 2>/dev/null || test $? -lt 126; then
|
cannam@128
|
46 RANLIB=${RANLIB-"${CROSS_PREFIX}ranlib"}
|
cannam@128
|
47 test -n "${CROSS_PREFIX}" && echo Using ${RANLIB} | tee -a configure.log
|
cannam@128
|
48 else
|
cannam@128
|
49 RANLIB=${RANLIB-"ranlib"}
|
cannam@128
|
50 fi
|
cannam@128
|
51 if "${CROSS_PREFIX}nm" --version >/dev/null 2>/dev/null || test $? -lt 126; then
|
cannam@128
|
52 NM=${NM-"${CROSS_PREFIX}nm"}
|
cannam@128
|
53 test -n "${CROSS_PREFIX}" && echo Using ${NM} | tee -a configure.log
|
cannam@128
|
54 else
|
cannam@128
|
55 NM=${NM-"nm"}
|
cannam@128
|
56 fi
|
cannam@128
|
57
|
cannam@128
|
58 # set defaults before processing command line options
|
cannam@128
|
59 LDCONFIG=${LDCONFIG-"ldconfig"}
|
cannam@128
|
60 LDSHAREDLIBC="${LDSHAREDLIBC--lc}"
|
cannam@128
|
61 ARCHS=
|
cannam@128
|
62 prefix=${prefix-/usr/local}
|
cannam@128
|
63 exec_prefix=${exec_prefix-'${prefix}'}
|
cannam@128
|
64 libdir=${libdir-'${exec_prefix}/lib'}
|
cannam@128
|
65 sharedlibdir=${sharedlibdir-'${libdir}'}
|
cannam@128
|
66 includedir=${includedir-'${prefix}/include'}
|
cannam@128
|
67 mandir=${mandir-'${prefix}/share/man'}
|
cannam@128
|
68 shared_ext='.so'
|
cannam@128
|
69 shared=1
|
cannam@128
|
70 solo=0
|
cannam@128
|
71 cover=0
|
cannam@128
|
72 zprefix=0
|
cannam@128
|
73 zconst=0
|
cannam@128
|
74 build64=0
|
cannam@128
|
75 gcc=0
|
cannam@128
|
76 old_cc="$CC"
|
cannam@128
|
77 old_cflags="$CFLAGS"
|
cannam@128
|
78 OBJC='$(OBJZ) $(OBJG)'
|
cannam@128
|
79 PIC_OBJC='$(PIC_OBJZ) $(PIC_OBJG)'
|
cannam@128
|
80
|
cannam@128
|
81 # leave this script, optionally in a bad way
|
cannam@128
|
82 leave()
|
cannam@128
|
83 {
|
cannam@128
|
84 if test "$*" != "0"; then
|
cannam@128
|
85 echo "** $0 aborting." | tee -a configure.log
|
cannam@128
|
86 fi
|
cannam@128
|
87 rm -f $test.[co] $test $test$shared_ext $test.gcno ./--version
|
cannam@128
|
88 echo -------------------- >> configure.log
|
cannam@128
|
89 echo >> configure.log
|
cannam@128
|
90 echo >> configure.log
|
cannam@128
|
91 exit $1
|
cannam@128
|
92 }
|
cannam@128
|
93
|
cannam@128
|
94 # process command line options
|
cannam@128
|
95 while test $# -ge 1
|
cannam@128
|
96 do
|
cannam@128
|
97 case "$1" in
|
cannam@128
|
98 -h* | --help)
|
cannam@128
|
99 echo 'usage:' | tee -a configure.log
|
cannam@128
|
100 echo ' configure [--const] [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a configure.log
|
cannam@128
|
101 echo ' [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log
|
cannam@128
|
102 echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log
|
cannam@128
|
103 exit 0 ;;
|
cannam@128
|
104 -p*=* | --prefix=*) prefix=`echo $1 | sed 's/.*=//'`; shift ;;
|
cannam@128
|
105 -e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/.*=//'`; shift ;;
|
cannam@128
|
106 -l*=* | --libdir=*) libdir=`echo $1 | sed 's/.*=//'`; shift ;;
|
cannam@128
|
107 --sharedlibdir=*) sharedlibdir=`echo $1 | sed 's/.*=//'`; shift ;;
|
cannam@128
|
108 -i*=* | --includedir=*) includedir=`echo $1 | sed 's/.*=//'`;shift ;;
|
cannam@128
|
109 -u*=* | --uname=*) uname=`echo $1 | sed 's/.*=//'`;shift ;;
|
cannam@128
|
110 -p* | --prefix) prefix="$2"; shift; shift ;;
|
cannam@128
|
111 -e* | --eprefix) exec_prefix="$2"; shift; shift ;;
|
cannam@128
|
112 -l* | --libdir) libdir="$2"; shift; shift ;;
|
cannam@128
|
113 -i* | --includedir) includedir="$2"; shift; shift ;;
|
cannam@128
|
114 -s* | --shared | --enable-shared) shared=1; shift ;;
|
cannam@128
|
115 -t | --static) shared=0; shift ;;
|
cannam@128
|
116 --solo) solo=1; shift ;;
|
cannam@128
|
117 --cover) cover=1; shift ;;
|
cannam@128
|
118 -z* | --zprefix) zprefix=1; shift ;;
|
cannam@128
|
119 -6* | --64) build64=1; shift ;;
|
cannam@128
|
120 -a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;;
|
cannam@128
|
121 --sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;;
|
cannam@128
|
122 --localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;;
|
cannam@128
|
123 -c* | --const) zconst=1; shift ;;
|
cannam@128
|
124 *)
|
cannam@128
|
125 echo "unknown option: $1" | tee -a configure.log
|
cannam@128
|
126 echo "$0 --help for help" | tee -a configure.log
|
cannam@128
|
127 leave 1;;
|
cannam@128
|
128 esac
|
cannam@128
|
129 done
|
cannam@128
|
130
|
cannam@128
|
131 # temporary file name
|
cannam@128
|
132 test=ztest$$
|
cannam@128
|
133
|
cannam@128
|
134 # put arguments in log, also put test file in log if used in arguments
|
cannam@128
|
135 show()
|
cannam@128
|
136 {
|
cannam@128
|
137 case "$*" in
|
cannam@128
|
138 *$test.c*)
|
cannam@128
|
139 echo === $test.c === >> configure.log
|
cannam@128
|
140 cat $test.c >> configure.log
|
cannam@128
|
141 echo === >> configure.log;;
|
cannam@128
|
142 esac
|
cannam@128
|
143 echo $* >> configure.log
|
cannam@128
|
144 }
|
cannam@128
|
145
|
cannam@128
|
146 # check for gcc vs. cc and set compile and link flags based on the system identified by uname
|
cannam@128
|
147 cat > $test.c <<EOF
|
cannam@128
|
148 extern int getchar();
|
cannam@128
|
149 int hello() {return getchar();}
|
cannam@128
|
150 EOF
|
cannam@128
|
151
|
cannam@128
|
152 test -z "$CC" && echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log
|
cannam@128
|
153 cc=${CC-${CROSS_PREFIX}gcc}
|
cannam@128
|
154 cflags=${CFLAGS-"-O3"}
|
cannam@128
|
155 # to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
|
cannam@128
|
156 case "$cc" in
|
cannam@128
|
157 *gcc*) gcc=1 ;;
|
cannam@128
|
158 *clang*) gcc=1 ;;
|
cannam@128
|
159 esac
|
cannam@128
|
160 case `$cc -v 2>&1` in
|
cannam@128
|
161 *gcc*) gcc=1 ;;
|
cannam@128
|
162 esac
|
cannam@128
|
163
|
cannam@128
|
164 show $cc -c $test.c
|
cannam@128
|
165 if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then
|
cannam@128
|
166 echo ... using gcc >> configure.log
|
cannam@128
|
167 CC="$cc"
|
cannam@128
|
168 CFLAGS="${CFLAGS--O3} ${ARCHS}"
|
cannam@128
|
169 SFLAGS="${CFLAGS--O3} -fPIC"
|
cannam@128
|
170 LDFLAGS="${LDFLAGS} ${ARCHS}"
|
cannam@128
|
171 if test $build64 -eq 1; then
|
cannam@128
|
172 CFLAGS="${CFLAGS} -m64"
|
cannam@128
|
173 SFLAGS="${SFLAGS} -m64"
|
cannam@128
|
174 fi
|
cannam@128
|
175 if test "${ZLIBGCCWARN}" = "YES"; then
|
cannam@128
|
176 if test "$zconst" -eq 1; then
|
cannam@128
|
177 CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -pedantic -DZLIB_CONST"
|
cannam@128
|
178 else
|
cannam@128
|
179 CFLAGS="${CFLAGS} -Wall -Wextra -pedantic"
|
cannam@128
|
180 fi
|
cannam@128
|
181 fi
|
cannam@128
|
182 if test -z "$uname"; then
|
cannam@128
|
183 uname=`(uname -s || echo unknown) 2>/dev/null`
|
cannam@128
|
184 fi
|
cannam@128
|
185 case "$uname" in
|
cannam@128
|
186 Linux* | linux* | GNU | GNU/* | solaris*)
|
cannam@128
|
187 LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"} ;;
|
cannam@128
|
188 *BSD | *bsd* | DragonFly)
|
cannam@128
|
189 LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"}
|
cannam@128
|
190 LDCONFIG="ldconfig -m" ;;
|
cannam@128
|
191 CYGWIN* | Cygwin* | cygwin* | OS/2*)
|
cannam@128
|
192 EXE='.exe' ;;
|
cannam@128
|
193 MINGW* | mingw*)
|
cannam@128
|
194 # temporary bypass
|
cannam@128
|
195 rm -f $test.[co] $test $test$shared_ext
|
cannam@128
|
196 echo "Please use win32/Makefile.gcc instead." | tee -a configure.log
|
cannam@128
|
197 leave 1
|
cannam@128
|
198 LDSHARED=${LDSHARED-"$cc -shared"}
|
cannam@128
|
199 LDSHAREDLIBC=""
|
cannam@128
|
200 EXE='.exe' ;;
|
cannam@128
|
201 QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4
|
cannam@128
|
202 # (alain.bonnefoy@icbt.com)
|
cannam@128
|
203 LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"} ;;
|
cannam@128
|
204 HP-UX*)
|
cannam@128
|
205 LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"}
|
cannam@128
|
206 case `(uname -m || echo unknown) 2>/dev/null` in
|
cannam@128
|
207 ia64)
|
cannam@128
|
208 shared_ext='.so'
|
cannam@128
|
209 SHAREDLIB='libz.so' ;;
|
cannam@128
|
210 *)
|
cannam@128
|
211 shared_ext='.sl'
|
cannam@128
|
212 SHAREDLIB='libz.sl' ;;
|
cannam@128
|
213 esac ;;
|
cannam@128
|
214 Darwin* | darwin*)
|
cannam@128
|
215 shared_ext='.dylib'
|
cannam@128
|
216 SHAREDLIB=libz$shared_ext
|
cannam@128
|
217 SHAREDLIBV=libz.$VER$shared_ext
|
cannam@128
|
218 SHAREDLIBM=libz.$VER1$shared_ext
|
cannam@128
|
219 LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"}
|
cannam@128
|
220 if libtool -V 2>&1 | grep Apple > /dev/null; then
|
cannam@128
|
221 AR="libtool"
|
cannam@128
|
222 else
|
cannam@128
|
223 AR="/usr/bin/libtool"
|
cannam@128
|
224 fi
|
cannam@128
|
225 ARFLAGS="-o" ;;
|
cannam@128
|
226 *) LDSHARED=${LDSHARED-"$cc -shared"} ;;
|
cannam@128
|
227 esac
|
cannam@128
|
228 else
|
cannam@128
|
229 # find system name and corresponding cc options
|
cannam@128
|
230 CC=${CC-cc}
|
cannam@128
|
231 gcc=0
|
cannam@128
|
232 echo ... using $CC >> configure.log
|
cannam@128
|
233 if test -z "$uname"; then
|
cannam@128
|
234 uname=`(uname -sr || echo unknown) 2>/dev/null`
|
cannam@128
|
235 fi
|
cannam@128
|
236 case "$uname" in
|
cannam@128
|
237 HP-UX*) SFLAGS=${CFLAGS-"-O +z"}
|
cannam@128
|
238 CFLAGS=${CFLAGS-"-O"}
|
cannam@128
|
239 # LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"}
|
cannam@128
|
240 LDSHARED=${LDSHARED-"ld -b"}
|
cannam@128
|
241 case `(uname -m || echo unknown) 2>/dev/null` in
|
cannam@128
|
242 ia64)
|
cannam@128
|
243 shared_ext='.so'
|
cannam@128
|
244 SHAREDLIB='libz.so' ;;
|
cannam@128
|
245 *)
|
cannam@128
|
246 shared_ext='.sl'
|
cannam@128
|
247 SHAREDLIB='libz.sl' ;;
|
cannam@128
|
248 esac ;;
|
cannam@128
|
249 IRIX*) SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."}
|
cannam@128
|
250 CFLAGS=${CFLAGS-"-ansi -O2"}
|
cannam@128
|
251 LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;;
|
cannam@128
|
252 OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"}
|
cannam@128
|
253 CFLAGS=${CFLAGS-"-O -std1"}
|
cannam@128
|
254 LDFLAGS="${LDFLAGS} -Wl,-rpath,."
|
cannam@128
|
255 LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"} ;;
|
cannam@128
|
256 OSF1*) SFLAGS=${CFLAGS-"-O -std1"}
|
cannam@128
|
257 CFLAGS=${CFLAGS-"-O -std1"}
|
cannam@128
|
258 LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;;
|
cannam@128
|
259 QNX*) SFLAGS=${CFLAGS-"-4 -O"}
|
cannam@128
|
260 CFLAGS=${CFLAGS-"-4 -O"}
|
cannam@128
|
261 LDSHARED=${LDSHARED-"cc"}
|
cannam@128
|
262 RANLIB=${RANLIB-"true"}
|
cannam@128
|
263 AR="cc"
|
cannam@128
|
264 ARFLAGS="-A" ;;
|
cannam@128
|
265 SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "}
|
cannam@128
|
266 CFLAGS=${CFLAGS-"-O3"}
|
cannam@128
|
267 LDSHARED=${LDSHARED-"cc -dy -KPIC -G"} ;;
|
cannam@128
|
268 SunOS\ 5* | solaris*)
|
cannam@128
|
269 LDSHARED=${LDSHARED-"cc -G -h libz$shared_ext.$VER1"}
|
cannam@128
|
270 SFLAGS=${CFLAGS-"-fast -KPIC"}
|
cannam@128
|
271 CFLAGS=${CFLAGS-"-fast"}
|
cannam@128
|
272 if test $build64 -eq 1; then
|
cannam@128
|
273 # old versions of SunPRO/Workshop/Studio don't support -m64,
|
cannam@128
|
274 # but newer ones do. Check for it.
|
cannam@128
|
275 flag64=`$CC -flags | egrep -- '^-m64'`
|
cannam@128
|
276 if test x"$flag64" != x"" ; then
|
cannam@128
|
277 CFLAGS="${CFLAGS} -m64"
|
cannam@128
|
278 SFLAGS="${SFLAGS} -m64"
|
cannam@128
|
279 else
|
cannam@128
|
280 case `(uname -m || echo unknown) 2>/dev/null` in
|
cannam@128
|
281 i86*)
|
cannam@128
|
282 SFLAGS="$SFLAGS -xarch=amd64"
|
cannam@128
|
283 CFLAGS="$CFLAGS -xarch=amd64" ;;
|
cannam@128
|
284 *)
|
cannam@128
|
285 SFLAGS="$SFLAGS -xarch=v9"
|
cannam@128
|
286 CFLAGS="$CFLAGS -xarch=v9" ;;
|
cannam@128
|
287 esac
|
cannam@128
|
288 fi
|
cannam@128
|
289 fi
|
cannam@128
|
290 ;;
|
cannam@128
|
291 SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"}
|
cannam@128
|
292 CFLAGS=${CFLAGS-"-O2"}
|
cannam@128
|
293 LDSHARED=${LDSHARED-"ld"} ;;
|
cannam@128
|
294 SunStudio\ 9*) SFLAGS=${CFLAGS-"-fast -xcode=pic32 -xtarget=ultra3 -xarch=v9b"}
|
cannam@128
|
295 CFLAGS=${CFLAGS-"-fast -xtarget=ultra3 -xarch=v9b"}
|
cannam@128
|
296 LDSHARED=${LDSHARED-"cc -xarch=v9b"} ;;
|
cannam@128
|
297 UNIX_System_V\ 4.2.0)
|
cannam@128
|
298 SFLAGS=${CFLAGS-"-KPIC -O"}
|
cannam@128
|
299 CFLAGS=${CFLAGS-"-O"}
|
cannam@128
|
300 LDSHARED=${LDSHARED-"cc -G"} ;;
|
cannam@128
|
301 UNIX_SV\ 4.2MP)
|
cannam@128
|
302 SFLAGS=${CFLAGS-"-Kconform_pic -O"}
|
cannam@128
|
303 CFLAGS=${CFLAGS-"-O"}
|
cannam@128
|
304 LDSHARED=${LDSHARED-"cc -G"} ;;
|
cannam@128
|
305 OpenUNIX\ 5)
|
cannam@128
|
306 SFLAGS=${CFLAGS-"-KPIC -O"}
|
cannam@128
|
307 CFLAGS=${CFLAGS-"-O"}
|
cannam@128
|
308 LDSHARED=${LDSHARED-"cc -G"} ;;
|
cannam@128
|
309 AIX*) # Courtesy of dbakker@arrayasolutions.com
|
cannam@128
|
310 SFLAGS=${CFLAGS-"-O -qmaxmem=8192"}
|
cannam@128
|
311 CFLAGS=${CFLAGS-"-O -qmaxmem=8192"}
|
cannam@128
|
312 LDSHARED=${LDSHARED-"xlc -G"} ;;
|
cannam@128
|
313 # send working options for other systems to zlib@gzip.org
|
cannam@128
|
314 *) SFLAGS=${CFLAGS-"-O"}
|
cannam@128
|
315 CFLAGS=${CFLAGS-"-O"}
|
cannam@128
|
316 LDSHARED=${LDSHARED-"cc -shared"} ;;
|
cannam@128
|
317 esac
|
cannam@128
|
318 fi
|
cannam@128
|
319
|
cannam@128
|
320 # destination names for shared library if not defined above
|
cannam@128
|
321 SHAREDLIB=${SHAREDLIB-"libz$shared_ext"}
|
cannam@128
|
322 SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"}
|
cannam@128
|
323 SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"}
|
cannam@128
|
324
|
cannam@128
|
325 echo >> configure.log
|
cannam@128
|
326
|
cannam@128
|
327 # define functions for testing compiler and library characteristics and logging the results
|
cannam@128
|
328
|
cannam@128
|
329 cat > $test.c <<EOF
|
cannam@128
|
330 #error error
|
cannam@128
|
331 EOF
|
cannam@128
|
332 if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
|
cannam@128
|
333 try()
|
cannam@128
|
334 {
|
cannam@128
|
335 show $*
|
cannam@128
|
336 test "`( $* ) 2>&1 | tee -a configure.log`" = ""
|
cannam@128
|
337 }
|
cannam@128
|
338 echo - using any output from compiler to indicate an error >> configure.log
|
cannam@128
|
339 else
|
cannam@128
|
340 try()
|
cannam@128
|
341 {
|
cannam@128
|
342 show $*
|
cannam@128
|
343 ( $* ) >> configure.log 2>&1
|
cannam@128
|
344 ret=$?
|
cannam@128
|
345 if test $ret -ne 0; then
|
cannam@128
|
346 echo "(exit code "$ret")" >> configure.log
|
cannam@128
|
347 fi
|
cannam@128
|
348 return $ret
|
cannam@128
|
349 }
|
cannam@128
|
350 fi
|
cannam@128
|
351
|
cannam@128
|
352 tryboth()
|
cannam@128
|
353 {
|
cannam@128
|
354 show $*
|
cannam@128
|
355 got=`( $* ) 2>&1`
|
cannam@128
|
356 ret=$?
|
cannam@128
|
357 printf %s "$got" >> configure.log
|
cannam@128
|
358 if test $ret -ne 0; then
|
cannam@128
|
359 return $ret
|
cannam@128
|
360 fi
|
cannam@128
|
361 test "$got" = ""
|
cannam@128
|
362 }
|
cannam@128
|
363
|
cannam@128
|
364 cat > $test.c << EOF
|
cannam@128
|
365 int foo() { return 0; }
|
cannam@128
|
366 EOF
|
cannam@128
|
367 echo "Checking for obsessive-compulsive compiler options..." >> configure.log
|
cannam@128
|
368 if try $CC -c $CFLAGS $test.c; then
|
cannam@128
|
369 :
|
cannam@128
|
370 else
|
cannam@128
|
371 echo "Compiler error reporting is too harsh for $0 (perhaps remove -Werror)." | tee -a configure.log
|
cannam@128
|
372 leave 1
|
cannam@128
|
373 fi
|
cannam@128
|
374
|
cannam@128
|
375 echo >> configure.log
|
cannam@128
|
376
|
cannam@128
|
377 # see if shared library build supported
|
cannam@128
|
378 cat > $test.c <<EOF
|
cannam@128
|
379 extern int getchar();
|
cannam@128
|
380 int hello() {return getchar();}
|
cannam@128
|
381 EOF
|
cannam@128
|
382 if test $shared -eq 1; then
|
cannam@128
|
383 echo Checking for shared library support... | tee -a configure.log
|
cannam@128
|
384 # we must test in two steps (cc then ld), required at least on SunOS 4.x
|
cannam@128
|
385 if try $CC -w -c $SFLAGS $test.c &&
|
cannam@128
|
386 try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then
|
cannam@128
|
387 echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log
|
cannam@128
|
388 elif test -z "$old_cc" -a -z "$old_cflags"; then
|
cannam@128
|
389 echo No shared library support. | tee -a configure.log
|
cannam@128
|
390 shared=0;
|
cannam@128
|
391 else
|
cannam@128
|
392 echo 'No shared library support; try without defining CC and CFLAGS' | tee -a configure.log
|
cannam@128
|
393 shared=0;
|
cannam@128
|
394 fi
|
cannam@128
|
395 fi
|
cannam@128
|
396 if test $shared -eq 0; then
|
cannam@128
|
397 LDSHARED="$CC"
|
cannam@128
|
398 ALL="static"
|
cannam@128
|
399 TEST="all teststatic"
|
cannam@128
|
400 SHAREDLIB=""
|
cannam@128
|
401 SHAREDLIBV=""
|
cannam@128
|
402 SHAREDLIBM=""
|
cannam@128
|
403 echo Building static library $STATICLIB version $VER with $CC. | tee -a configure.log
|
cannam@128
|
404 else
|
cannam@128
|
405 ALL="static shared"
|
cannam@128
|
406 TEST="all teststatic testshared"
|
cannam@128
|
407 fi
|
cannam@128
|
408
|
cannam@128
|
409 # check for underscores in external names for use by assembler code
|
cannam@128
|
410 CPP=${CPP-"$CC -E"}
|
cannam@128
|
411 case $CFLAGS in
|
cannam@128
|
412 *ASMV*)
|
cannam@128
|
413 echo >> configure.log
|
cannam@128
|
414 show "$NM $test.o | grep _hello"
|
cannam@128
|
415 if test "`$NM $test.o | grep _hello | tee -a configure.log`" = ""; then
|
cannam@128
|
416 CPP="$CPP -DNO_UNDERLINE"
|
cannam@128
|
417 echo Checking for underline in external names... No. | tee -a configure.log
|
cannam@128
|
418 else
|
cannam@128
|
419 echo Checking for underline in external names... Yes. | tee -a configure.log
|
cannam@128
|
420 fi ;;
|
cannam@128
|
421 esac
|
cannam@128
|
422
|
cannam@128
|
423 echo >> configure.log
|
cannam@128
|
424
|
cannam@128
|
425 # check for large file support, and if none, check for fseeko()
|
cannam@128
|
426 cat > $test.c <<EOF
|
cannam@128
|
427 #include <sys/types.h>
|
cannam@128
|
428 off64_t dummy = 0;
|
cannam@128
|
429 EOF
|
cannam@128
|
430 if try $CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c; then
|
cannam@128
|
431 CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1"
|
cannam@128
|
432 SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1"
|
cannam@128
|
433 ALL="${ALL} all64"
|
cannam@128
|
434 TEST="${TEST} test64"
|
cannam@128
|
435 echo "Checking for off64_t... Yes." | tee -a configure.log
|
cannam@128
|
436 echo "Checking for fseeko... Yes." | tee -a configure.log
|
cannam@128
|
437 else
|
cannam@128
|
438 echo "Checking for off64_t... No." | tee -a configure.log
|
cannam@128
|
439 echo >> configure.log
|
cannam@128
|
440 cat > $test.c <<EOF
|
cannam@128
|
441 #include <stdio.h>
|
cannam@128
|
442 int main(void) {
|
cannam@128
|
443 fseeko(NULL, 0, 0);
|
cannam@128
|
444 return 0;
|
cannam@128
|
445 }
|
cannam@128
|
446 EOF
|
cannam@128
|
447 if try $CC $CFLAGS -o $test $test.c; then
|
cannam@128
|
448 echo "Checking for fseeko... Yes." | tee -a configure.log
|
cannam@128
|
449 else
|
cannam@128
|
450 CFLAGS="${CFLAGS} -DNO_FSEEKO"
|
cannam@128
|
451 SFLAGS="${SFLAGS} -DNO_FSEEKO"
|
cannam@128
|
452 echo "Checking for fseeko... No." | tee -a configure.log
|
cannam@128
|
453 fi
|
cannam@128
|
454 fi
|
cannam@128
|
455
|
cannam@128
|
456 echo >> configure.log
|
cannam@128
|
457
|
cannam@128
|
458 # check for strerror() for use by gz* functions
|
cannam@128
|
459 cat > $test.c <<EOF
|
cannam@128
|
460 #include <string.h>
|
cannam@128
|
461 #include <errno.h>
|
cannam@128
|
462 int main() { return strlen(strerror(errno)); }
|
cannam@128
|
463 EOF
|
cannam@128
|
464 if try $CC $CFLAGS -o $test $test.c; then
|
cannam@128
|
465 echo "Checking for strerror... Yes." | tee -a configure.log
|
cannam@128
|
466 else
|
cannam@128
|
467 CFLAGS="${CFLAGS} -DNO_STRERROR"
|
cannam@128
|
468 SFLAGS="${SFLAGS} -DNO_STRERROR"
|
cannam@128
|
469 echo "Checking for strerror... No." | tee -a configure.log
|
cannam@128
|
470 fi
|
cannam@128
|
471
|
cannam@128
|
472 # copy clean zconf.h for subsequent edits
|
cannam@128
|
473 cp -p zconf.h.in zconf.h
|
cannam@128
|
474
|
cannam@128
|
475 echo >> configure.log
|
cannam@128
|
476
|
cannam@128
|
477 # check for unistd.h and save result in zconf.h
|
cannam@128
|
478 cat > $test.c <<EOF
|
cannam@128
|
479 #include <unistd.h>
|
cannam@128
|
480 int main() { return 0; }
|
cannam@128
|
481 EOF
|
cannam@128
|
482 if try $CC -c $CFLAGS $test.c; then
|
cannam@128
|
483 sed < zconf.h "/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
|
cannam@128
|
484 mv zconf.temp.h zconf.h
|
cannam@128
|
485 echo "Checking for unistd.h... Yes." | tee -a configure.log
|
cannam@128
|
486 else
|
cannam@128
|
487 echo "Checking for unistd.h... No." | tee -a configure.log
|
cannam@128
|
488 fi
|
cannam@128
|
489
|
cannam@128
|
490 echo >> configure.log
|
cannam@128
|
491
|
cannam@128
|
492 # check for stdarg.h and save result in zconf.h
|
cannam@128
|
493 cat > $test.c <<EOF
|
cannam@128
|
494 #include <stdarg.h>
|
cannam@128
|
495 int main() { return 0; }
|
cannam@128
|
496 EOF
|
cannam@128
|
497 if try $CC -c $CFLAGS $test.c; then
|
cannam@128
|
498 sed < zconf.h "/^#ifdef HAVE_STDARG_H.* may be/s/def HAVE_STDARG_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
|
cannam@128
|
499 mv zconf.temp.h zconf.h
|
cannam@128
|
500 echo "Checking for stdarg.h... Yes." | tee -a configure.log
|
cannam@128
|
501 else
|
cannam@128
|
502 echo "Checking for stdarg.h... No." | tee -a configure.log
|
cannam@128
|
503 fi
|
cannam@128
|
504
|
cannam@128
|
505 # if the z_ prefix was requested, save that in zconf.h
|
cannam@128
|
506 if test $zprefix -eq 1; then
|
cannam@128
|
507 sed < zconf.h "/#ifdef Z_PREFIX.* may be/s/def Z_PREFIX\(.*\) may be/ 1\1 was/" > zconf.temp.h
|
cannam@128
|
508 mv zconf.temp.h zconf.h
|
cannam@128
|
509 echo >> configure.log
|
cannam@128
|
510 echo "Using z_ prefix on all symbols." | tee -a configure.log
|
cannam@128
|
511 fi
|
cannam@128
|
512
|
cannam@128
|
513 # if --solo compilation was requested, save that in zconf.h and remove gz stuff from object lists
|
cannam@128
|
514 if test $solo -eq 1; then
|
cannam@128
|
515 sed '/#define ZCONF_H/a\
|
cannam@128
|
516 #define Z_SOLO
|
cannam@128
|
517
|
cannam@128
|
518 ' < zconf.h > zconf.temp.h
|
cannam@128
|
519 mv zconf.temp.h zconf.h
|
cannam@128
|
520 OBJC='$(OBJZ)'
|
cannam@128
|
521 PIC_OBJC='$(PIC_OBJZ)'
|
cannam@128
|
522 fi
|
cannam@128
|
523
|
cannam@128
|
524 # if code coverage testing was requested, use older gcc if defined, e.g. "gcc-4.2" on Mac OS X
|
cannam@128
|
525 if test $cover -eq 1; then
|
cannam@128
|
526 CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage"
|
cannam@128
|
527 if test -n "$GCC_CLASSIC"; then
|
cannam@128
|
528 CC=$GCC_CLASSIC
|
cannam@128
|
529 fi
|
cannam@128
|
530 fi
|
cannam@128
|
531
|
cannam@128
|
532 echo >> configure.log
|
cannam@128
|
533
|
cannam@128
|
534 # conduct a series of tests to resolve eight possible cases of using "vs" or "s" printf functions
|
cannam@128
|
535 # (using stdarg or not), with or without "n" (proving size of buffer), and with or without a
|
cannam@128
|
536 # return value. The most secure result is vsnprintf() with a return value. snprintf() with a
|
cannam@128
|
537 # return value is secure as well, but then gzprintf() will be limited to 20 arguments.
|
cannam@128
|
538 cat > $test.c <<EOF
|
cannam@128
|
539 #include <stdio.h>
|
cannam@128
|
540 #include <stdarg.h>
|
cannam@128
|
541 #include "zconf.h"
|
cannam@128
|
542 int main()
|
cannam@128
|
543 {
|
cannam@128
|
544 #ifndef STDC
|
cannam@128
|
545 choke me
|
cannam@128
|
546 #endif
|
cannam@128
|
547 return 0;
|
cannam@128
|
548 }
|
cannam@128
|
549 EOF
|
cannam@128
|
550 if try $CC -c $CFLAGS $test.c; then
|
cannam@128
|
551 echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()." | tee -a configure.log
|
cannam@128
|
552
|
cannam@128
|
553 echo >> configure.log
|
cannam@128
|
554 cat > $test.c <<EOF
|
cannam@128
|
555 #include <stdio.h>
|
cannam@128
|
556 #include <stdarg.h>
|
cannam@128
|
557 int mytest(const char *fmt, ...)
|
cannam@128
|
558 {
|
cannam@128
|
559 char buf[20];
|
cannam@128
|
560 va_list ap;
|
cannam@128
|
561 va_start(ap, fmt);
|
cannam@128
|
562 vsnprintf(buf, sizeof(buf), fmt, ap);
|
cannam@128
|
563 va_end(ap);
|
cannam@128
|
564 return 0;
|
cannam@128
|
565 }
|
cannam@128
|
566 int main()
|
cannam@128
|
567 {
|
cannam@128
|
568 return (mytest("Hello%d\n", 1));
|
cannam@128
|
569 }
|
cannam@128
|
570 EOF
|
cannam@128
|
571 if try $CC $CFLAGS -o $test $test.c; then
|
cannam@128
|
572 echo "Checking for vsnprintf() in stdio.h... Yes." | tee -a configure.log
|
cannam@128
|
573
|
cannam@128
|
574 echo >> configure.log
|
cannam@128
|
575 cat >$test.c <<EOF
|
cannam@128
|
576 #include <stdio.h>
|
cannam@128
|
577 #include <stdarg.h>
|
cannam@128
|
578 int mytest(const char *fmt, ...)
|
cannam@128
|
579 {
|
cannam@128
|
580 int n;
|
cannam@128
|
581 char buf[20];
|
cannam@128
|
582 va_list ap;
|
cannam@128
|
583 va_start(ap, fmt);
|
cannam@128
|
584 n = vsnprintf(buf, sizeof(buf), fmt, ap);
|
cannam@128
|
585 va_end(ap);
|
cannam@128
|
586 return n;
|
cannam@128
|
587 }
|
cannam@128
|
588 int main()
|
cannam@128
|
589 {
|
cannam@128
|
590 return (mytest("Hello%d\n", 1));
|
cannam@128
|
591 }
|
cannam@128
|
592 EOF
|
cannam@128
|
593
|
cannam@128
|
594 if try $CC -c $CFLAGS $test.c; then
|
cannam@128
|
595 echo "Checking for return value of vsnprintf()... Yes." | tee -a configure.log
|
cannam@128
|
596 else
|
cannam@128
|
597 CFLAGS="$CFLAGS -DHAS_vsnprintf_void"
|
cannam@128
|
598 SFLAGS="$SFLAGS -DHAS_vsnprintf_void"
|
cannam@128
|
599 echo "Checking for return value of vsnprintf()... No." | tee -a configure.log
|
cannam@128
|
600 echo " WARNING: apparently vsnprintf() does not return a value. zlib" | tee -a configure.log
|
cannam@128
|
601 echo " can build but will be open to possible string-format security" | tee -a configure.log
|
cannam@128
|
602 echo " vulnerabilities." | tee -a configure.log
|
cannam@128
|
603 fi
|
cannam@128
|
604 else
|
cannam@128
|
605 CFLAGS="$CFLAGS -DNO_vsnprintf"
|
cannam@128
|
606 SFLAGS="$SFLAGS -DNO_vsnprintf"
|
cannam@128
|
607 echo "Checking for vsnprintf() in stdio.h... No." | tee -a configure.log
|
cannam@128
|
608 echo " WARNING: vsnprintf() not found, falling back to vsprintf(). zlib" | tee -a configure.log
|
cannam@128
|
609 echo " can build but will be open to possible buffer-overflow security" | tee -a configure.log
|
cannam@128
|
610 echo " vulnerabilities." | tee -a configure.log
|
cannam@128
|
611
|
cannam@128
|
612 echo >> configure.log
|
cannam@128
|
613 cat >$test.c <<EOF
|
cannam@128
|
614 #include <stdio.h>
|
cannam@128
|
615 #include <stdarg.h>
|
cannam@128
|
616 int mytest(const char *fmt, ...)
|
cannam@128
|
617 {
|
cannam@128
|
618 int n;
|
cannam@128
|
619 char buf[20];
|
cannam@128
|
620 va_list ap;
|
cannam@128
|
621 va_start(ap, fmt);
|
cannam@128
|
622 n = vsprintf(buf, fmt, ap);
|
cannam@128
|
623 va_end(ap);
|
cannam@128
|
624 return n;
|
cannam@128
|
625 }
|
cannam@128
|
626 int main()
|
cannam@128
|
627 {
|
cannam@128
|
628 return (mytest("Hello%d\n", 1));
|
cannam@128
|
629 }
|
cannam@128
|
630 EOF
|
cannam@128
|
631
|
cannam@128
|
632 if try $CC -c $CFLAGS $test.c; then
|
cannam@128
|
633 echo "Checking for return value of vsprintf()... Yes." | tee -a configure.log
|
cannam@128
|
634 else
|
cannam@128
|
635 CFLAGS="$CFLAGS -DHAS_vsprintf_void"
|
cannam@128
|
636 SFLAGS="$SFLAGS -DHAS_vsprintf_void"
|
cannam@128
|
637 echo "Checking for return value of vsprintf()... No." | tee -a configure.log
|
cannam@128
|
638 echo " WARNING: apparently vsprintf() does not return a value. zlib" | tee -a configure.log
|
cannam@128
|
639 echo " can build but will be open to possible string-format security" | tee -a configure.log
|
cannam@128
|
640 echo " vulnerabilities." | tee -a configure.log
|
cannam@128
|
641 fi
|
cannam@128
|
642 fi
|
cannam@128
|
643 else
|
cannam@128
|
644 echo "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()." | tee -a configure.log
|
cannam@128
|
645
|
cannam@128
|
646 echo >> configure.log
|
cannam@128
|
647 cat >$test.c <<EOF
|
cannam@128
|
648 #include <stdio.h>
|
cannam@128
|
649 int mytest()
|
cannam@128
|
650 {
|
cannam@128
|
651 char buf[20];
|
cannam@128
|
652 snprintf(buf, sizeof(buf), "%s", "foo");
|
cannam@128
|
653 return 0;
|
cannam@128
|
654 }
|
cannam@128
|
655 int main()
|
cannam@128
|
656 {
|
cannam@128
|
657 return (mytest());
|
cannam@128
|
658 }
|
cannam@128
|
659 EOF
|
cannam@128
|
660
|
cannam@128
|
661 if try $CC $CFLAGS -o $test $test.c; then
|
cannam@128
|
662 echo "Checking for snprintf() in stdio.h... Yes." | tee -a configure.log
|
cannam@128
|
663
|
cannam@128
|
664 echo >> configure.log
|
cannam@128
|
665 cat >$test.c <<EOF
|
cannam@128
|
666 #include <stdio.h>
|
cannam@128
|
667 int mytest()
|
cannam@128
|
668 {
|
cannam@128
|
669 char buf[20];
|
cannam@128
|
670 return snprintf(buf, sizeof(buf), "%s", "foo");
|
cannam@128
|
671 }
|
cannam@128
|
672 int main()
|
cannam@128
|
673 {
|
cannam@128
|
674 return (mytest());
|
cannam@128
|
675 }
|
cannam@128
|
676 EOF
|
cannam@128
|
677
|
cannam@128
|
678 if try $CC -c $CFLAGS $test.c; then
|
cannam@128
|
679 echo "Checking for return value of snprintf()... Yes." | tee -a configure.log
|
cannam@128
|
680 else
|
cannam@128
|
681 CFLAGS="$CFLAGS -DHAS_snprintf_void"
|
cannam@128
|
682 SFLAGS="$SFLAGS -DHAS_snprintf_void"
|
cannam@128
|
683 echo "Checking for return value of snprintf()... No." | tee -a configure.log
|
cannam@128
|
684 echo " WARNING: apparently snprintf() does not return a value. zlib" | tee -a configure.log
|
cannam@128
|
685 echo " can build but will be open to possible string-format security" | tee -a configure.log
|
cannam@128
|
686 echo " vulnerabilities." | tee -a configure.log
|
cannam@128
|
687 fi
|
cannam@128
|
688 else
|
cannam@128
|
689 CFLAGS="$CFLAGS -DNO_snprintf"
|
cannam@128
|
690 SFLAGS="$SFLAGS -DNO_snprintf"
|
cannam@128
|
691 echo "Checking for snprintf() in stdio.h... No." | tee -a configure.log
|
cannam@128
|
692 echo " WARNING: snprintf() not found, falling back to sprintf(). zlib" | tee -a configure.log
|
cannam@128
|
693 echo " can build but will be open to possible buffer-overflow security" | tee -a configure.log
|
cannam@128
|
694 echo " vulnerabilities." | tee -a configure.log
|
cannam@128
|
695
|
cannam@128
|
696 echo >> configure.log
|
cannam@128
|
697 cat >$test.c <<EOF
|
cannam@128
|
698 #include <stdio.h>
|
cannam@128
|
699 int mytest()
|
cannam@128
|
700 {
|
cannam@128
|
701 char buf[20];
|
cannam@128
|
702 return sprintf(buf, "%s", "foo");
|
cannam@128
|
703 }
|
cannam@128
|
704 int main()
|
cannam@128
|
705 {
|
cannam@128
|
706 return (mytest());
|
cannam@128
|
707 }
|
cannam@128
|
708 EOF
|
cannam@128
|
709
|
cannam@128
|
710 if try $CC -c $CFLAGS $test.c; then
|
cannam@128
|
711 echo "Checking for return value of sprintf()... Yes." | tee -a configure.log
|
cannam@128
|
712 else
|
cannam@128
|
713 CFLAGS="$CFLAGS -DHAS_sprintf_void"
|
cannam@128
|
714 SFLAGS="$SFLAGS -DHAS_sprintf_void"
|
cannam@128
|
715 echo "Checking for return value of sprintf()... No." | tee -a configure.log
|
cannam@128
|
716 echo " WARNING: apparently sprintf() does not return a value. zlib" | tee -a configure.log
|
cannam@128
|
717 echo " can build but will be open to possible string-format security" | tee -a configure.log
|
cannam@128
|
718 echo " vulnerabilities." | tee -a configure.log
|
cannam@128
|
719 fi
|
cannam@128
|
720 fi
|
cannam@128
|
721 fi
|
cannam@128
|
722
|
cannam@128
|
723 # see if we can hide zlib internal symbols that are linked between separate source files
|
cannam@128
|
724 if test "$gcc" -eq 1; then
|
cannam@128
|
725 echo >> configure.log
|
cannam@128
|
726 cat > $test.c <<EOF
|
cannam@128
|
727 #define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
|
cannam@128
|
728 int ZLIB_INTERNAL foo;
|
cannam@128
|
729 int main()
|
cannam@128
|
730 {
|
cannam@128
|
731 return 0;
|
cannam@128
|
732 }
|
cannam@128
|
733 EOF
|
cannam@128
|
734 if tryboth $CC -c $CFLAGS $test.c; then
|
cannam@128
|
735 CFLAGS="$CFLAGS -DHAVE_HIDDEN"
|
cannam@128
|
736 SFLAGS="$SFLAGS -DHAVE_HIDDEN"
|
cannam@128
|
737 echo "Checking for attribute(visibility) support... Yes." | tee -a configure.log
|
cannam@128
|
738 else
|
cannam@128
|
739 echo "Checking for attribute(visibility) support... No." | tee -a configure.log
|
cannam@128
|
740 fi
|
cannam@128
|
741 fi
|
cannam@128
|
742
|
cannam@128
|
743 # show the results in the log
|
cannam@128
|
744 echo >> configure.log
|
cannam@128
|
745 echo ALL = $ALL >> configure.log
|
cannam@128
|
746 echo AR = $AR >> configure.log
|
cannam@128
|
747 echo ARFLAGS = $ARFLAGS >> configure.log
|
cannam@128
|
748 echo CC = $CC >> configure.log
|
cannam@128
|
749 echo CFLAGS = $CFLAGS >> configure.log
|
cannam@128
|
750 echo CPP = $CPP >> configure.log
|
cannam@128
|
751 echo EXE = $EXE >> configure.log
|
cannam@128
|
752 echo LDCONFIG = $LDCONFIG >> configure.log
|
cannam@128
|
753 echo LDFLAGS = $LDFLAGS >> configure.log
|
cannam@128
|
754 echo LDSHARED = $LDSHARED >> configure.log
|
cannam@128
|
755 echo LDSHAREDLIBC = $LDSHAREDLIBC >> configure.log
|
cannam@128
|
756 echo OBJC = $OBJC >> configure.log
|
cannam@128
|
757 echo PIC_OBJC = $PIC_OBJC >> configure.log
|
cannam@128
|
758 echo RANLIB = $RANLIB >> configure.log
|
cannam@128
|
759 echo SFLAGS = $SFLAGS >> configure.log
|
cannam@128
|
760 echo SHAREDLIB = $SHAREDLIB >> configure.log
|
cannam@128
|
761 echo SHAREDLIBM = $SHAREDLIBM >> configure.log
|
cannam@128
|
762 echo SHAREDLIBV = $SHAREDLIBV >> configure.log
|
cannam@128
|
763 echo STATICLIB = $STATICLIB >> configure.log
|
cannam@128
|
764 echo TEST = $TEST >> configure.log
|
cannam@128
|
765 echo VER = $VER >> configure.log
|
cannam@128
|
766 echo Z_U4 = $Z_U4 >> configure.log
|
cannam@128
|
767 echo exec_prefix = $exec_prefix >> configure.log
|
cannam@128
|
768 echo includedir = $includedir >> configure.log
|
cannam@128
|
769 echo libdir = $libdir >> configure.log
|
cannam@128
|
770 echo mandir = $mandir >> configure.log
|
cannam@128
|
771 echo prefix = $prefix >> configure.log
|
cannam@128
|
772 echo sharedlibdir = $sharedlibdir >> configure.log
|
cannam@128
|
773 echo uname = $uname >> configure.log
|
cannam@128
|
774
|
cannam@128
|
775 # udpate Makefile with the configure results
|
cannam@128
|
776 sed < Makefile.in "
|
cannam@128
|
777 /^CC *=/s#=.*#=$CC#
|
cannam@128
|
778 /^CFLAGS *=/s#=.*#=$CFLAGS#
|
cannam@128
|
779 /^SFLAGS *=/s#=.*#=$SFLAGS#
|
cannam@128
|
780 /^LDFLAGS *=/s#=.*#=$LDFLAGS#
|
cannam@128
|
781 /^LDSHARED *=/s#=.*#=$LDSHARED#
|
cannam@128
|
782 /^CPP *=/s#=.*#=$CPP#
|
cannam@128
|
783 /^STATICLIB *=/s#=.*#=$STATICLIB#
|
cannam@128
|
784 /^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
|
cannam@128
|
785 /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
|
cannam@128
|
786 /^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
|
cannam@128
|
787 /^AR *=/s#=.*#=$AR#
|
cannam@128
|
788 /^ARFLAGS *=/s#=.*#=$ARFLAGS#
|
cannam@128
|
789 /^RANLIB *=/s#=.*#=$RANLIB#
|
cannam@128
|
790 /^LDCONFIG *=/s#=.*#=$LDCONFIG#
|
cannam@128
|
791 /^LDSHAREDLIBC *=/s#=.*#=$LDSHAREDLIBC#
|
cannam@128
|
792 /^EXE *=/s#=.*#=$EXE#
|
cannam@128
|
793 /^prefix *=/s#=.*#=$prefix#
|
cannam@128
|
794 /^exec_prefix *=/s#=.*#=$exec_prefix#
|
cannam@128
|
795 /^libdir *=/s#=.*#=$libdir#
|
cannam@128
|
796 /^sharedlibdir *=/s#=.*#=$sharedlibdir#
|
cannam@128
|
797 /^includedir *=/s#=.*#=$includedir#
|
cannam@128
|
798 /^mandir *=/s#=.*#=$mandir#
|
cannam@128
|
799 /^OBJC *=/s#=.*#= $OBJC#
|
cannam@128
|
800 /^PIC_OBJC *=/s#=.*#= $PIC_OBJC#
|
cannam@128
|
801 /^all: */s#:.*#: $ALL#
|
cannam@128
|
802 /^test: */s#:.*#: $TEST#
|
cannam@128
|
803 " > Makefile
|
cannam@128
|
804
|
cannam@128
|
805 # create zlib.pc with the configure results
|
cannam@128
|
806 sed < zlib.pc.in "
|
cannam@128
|
807 /^CC *=/s#=.*#=$CC#
|
cannam@128
|
808 /^CFLAGS *=/s#=.*#=$CFLAGS#
|
cannam@128
|
809 /^CPP *=/s#=.*#=$CPP#
|
cannam@128
|
810 /^LDSHARED *=/s#=.*#=$LDSHARED#
|
cannam@128
|
811 /^STATICLIB *=/s#=.*#=$STATICLIB#
|
cannam@128
|
812 /^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
|
cannam@128
|
813 /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
|
cannam@128
|
814 /^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
|
cannam@128
|
815 /^AR *=/s#=.*#=$AR#
|
cannam@128
|
816 /^ARFLAGS *=/s#=.*#=$ARFLAGS#
|
cannam@128
|
817 /^RANLIB *=/s#=.*#=$RANLIB#
|
cannam@128
|
818 /^EXE *=/s#=.*#=$EXE#
|
cannam@128
|
819 /^prefix *=/s#=.*#=$prefix#
|
cannam@128
|
820 /^exec_prefix *=/s#=.*#=$exec_prefix#
|
cannam@128
|
821 /^libdir *=/s#=.*#=$libdir#
|
cannam@128
|
822 /^sharedlibdir *=/s#=.*#=$sharedlibdir#
|
cannam@128
|
823 /^includedir *=/s#=.*#=$includedir#
|
cannam@128
|
824 /^mandir *=/s#=.*#=$mandir#
|
cannam@128
|
825 /^LDFLAGS *=/s#=.*#=$LDFLAGS#
|
cannam@128
|
826 " | sed -e "
|
cannam@128
|
827 s/\@VERSION\@/$VER/g;
|
cannam@128
|
828 " > zlib.pc
|
cannam@128
|
829
|
cannam@128
|
830 # done
|
cannam@128
|
831 leave 0
|