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