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