2 # configure script for zlib.
4 # Normally configure builds both a static and a shared library.
5 # If you want to build just a static library, use: ./configure --static
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)
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
16 # start off configure.log
17 echo -------------------- >> configure.log
18 echo $0 $
* >> configure.log
21 # set command prefix for cross-compilation
22 if [ -n "${CHOST}" ]; then
23 uname
="`echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/'`"
24 CROSS_PREFIX
="${CHOST}-"
27 # destination name for static library
30 # extract zlib version numbers from zlib.h
31 VER
=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
32 VER3
=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < zlib.h`
33 VER2
=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h`
34 VER1
=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h`
36 # establish commands for library building
37 if "${CROSS_PREFIX}ar" --version >/dev
/null
2>/dev
/null ||
test $?
-lt 126; then
38 AR
=${AR-"${CROSS_PREFIX}ar"}
39 test -n "${CROSS_PREFIX}" && echo Using
${AR} |
tee -a configure.log
42 test -n "${CROSS_PREFIX}" && echo Using
${AR} |
tee -a configure.log
44 ARFLAGS
=${ARFLAGS-"rc"}
45 if "${CROSS_PREFIX}ranlib" --version >/dev
/null
2>/dev
/null ||
test $?
-lt 126; then
46 RANLIB
=${RANLIB-"${CROSS_PREFIX}ranlib"}
47 test -n "${CROSS_PREFIX}" && echo Using
${RANLIB} |
tee -a configure.log
49 RANLIB
=${RANLIB-"ranlib"}
51 if "${CROSS_PREFIX}nm" --version >/dev
/null
2>/dev
/null ||
test $?
-lt 126; then
52 NM
=${NM-"${CROSS_PREFIX}nm"}
53 test -n "${CROSS_PREFIX}" && echo Using
${NM} |
tee -a configure.log
58 # set defaults before processing command line options
59 LDCONFIG
=${LDCONFIG-"ldconfig"}
60 LDSHAREDLIBC
="${LDSHAREDLIBC--lc}"
62 prefix
=${prefix-/usr/local}
63 exec_prefix
=${exec_prefix-'${prefix}'}
64 libdir
=${libdir-'${exec_prefix}/lib'}
65 sharedlibdir
=${sharedlibdir-'${libdir}'}
66 includedir
=${includedir-'${prefix}/include'}
67 mandir
=${mandir-'${prefix}/share/man'}
78 OBJC
='$(OBJZ) $(OBJG)'
79 PIC_OBJC
='$(PIC_OBJZ) $(PIC_OBJG)'
81 # leave this script, optionally in a bad way
84 if test "$*" != "0"; then
85 echo "** $0 aborting." |
tee -a configure.log
87 rm -f $test.
[co
] $test $test$shared_ext $test.gcno .
/--version
88 echo -------------------- >> configure.log
94 # process command line options
99 echo 'usage:' |
tee -a configure.log
100 echo ' configure [--const] [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' |
tee -a configure.log
101 echo ' [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' |
tee -a configure.log
102 echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' |
tee -a configure.log
104 -p*=* |
--prefix=*) prefix
=`echo $1 | sed 's/.*=//'`; shift ;;
105 -e*=* |
--eprefix=*) exec_prefix
=`echo $1 | sed 's/.*=//'`; shift ;;
106 -l*=* |
--libdir=*) libdir
=`echo $1 | sed 's/.*=//'`; shift ;;
107 --sharedlibdir=*) sharedlibdir
=`echo $1 | sed 's/.*=//'`; shift ;;
108 -i*=* |
--includedir=*) includedir
=`echo $1 | sed 's/.*=//'`;shift ;;
109 -u*=* |
--uname=*) uname
=`echo $1 | sed 's/.*=//'`;shift ;;
110 -p* |
--prefix) prefix
="$2"; shift; shift ;;
111 -e* |
--eprefix) exec_prefix
="$2"; shift; shift ;;
112 -l* |
--libdir) libdir
="$2"; shift; shift ;;
113 -i* |
--includedir) includedir
="$2"; shift; shift ;;
114 -s* |
--shared |
--enable-shared) shared
=1; shift ;;
115 -t |
--static) shared
=0; shift ;;
116 --solo) solo
=1; shift ;;
117 --cover) cover
=1; shift ;;
118 -z* |
--zprefix) zprefix
=1; shift ;;
119 -6* |
--64) build64
=1; shift ;;
120 -a*=* |
--archs=*) ARCHS
=`echo $1 | sed 's/.*=//'`; shift ;;
121 --sysconfdir=*) echo "ignored option: --sysconfdir" |
tee -a configure.log
; shift ;;
122 --localstatedir=*) echo "ignored option: --localstatedir" |
tee -a configure.log
; shift ;;
123 -c* |
--const) zconst
=1; shift ;;
125 echo "unknown option: $1" |
tee -a configure.log
126 echo "$0 --help for help" |
tee -a configure.log
131 # temporary file name
134 # put arguments in log, also put test file in log if used in arguments
139 echo === $test.c
=== >> configure.log
140 cat $test.c
>> configure.log
141 echo === >> configure.log
;;
143 echo $
* >> configure.log
146 # check for gcc vs. cc and set compile and link flags based on the system identified by uname
148 extern int getchar();
149 int hello() {return getchar();}
152 test -z "$CC" && echo Checking
for ${CROSS_PREFIX}gcc... |
tee -a configure.log
153 cc
=${CC-${CROSS_PREFIX}gcc}
154 cflags
=${CFLAGS-"-O3"}
155 # to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
160 case `$cc -v 2>&1` in
165 if test "$gcc" -eq 1 && ($cc -c $test.c
) >> configure.log
2>&1; then
166 echo ... using gcc
>> configure.log
168 CFLAGS
="${CFLAGS--O3} ${ARCHS}"
169 SFLAGS
="${CFLAGS--O3} -fPIC"
170 LDFLAGS
="${LDFLAGS} ${ARCHS}"
171 if test $build64 -eq 1; then
172 CFLAGS
="${CFLAGS} -m64"
173 SFLAGS
="${SFLAGS} -m64"
175 if test "${ZLIBGCCWARN}" = "YES"; then
176 if test "$zconst" -eq 1; then
177 CFLAGS
="${CFLAGS} -Wall -Wextra -Wcast-qual -pedantic -DZLIB_CONST"
179 CFLAGS
="${CFLAGS} -Wall -Wextra -pedantic"
182 if test -z "$uname"; then
183 uname
=`(uname -s || echo unknown) 2>/dev/null`
186 Linux
* | linux
* | GNU | GNU
/* | solaris
*)
187 LDSHARED
=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"} ;;
188 *BSD |
*bsd
* | DragonFly
)
189 LDSHARED
=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"}
190 LDCONFIG
="ldconfig -m" ;;
191 CYGWIN
* | Cygwin
* | cygwin
* | OS
/2*)
195 rm -f $test.
[co
] $test $test$shared_ext
196 echo "Please use win32/Makefile.gcc instead." |
tee -a configure.log
198 LDSHARED
=${LDSHARED-"$cc -shared"}
201 QNX
*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4
202 # (alain.bonnefoy@icbt.com)
203 LDSHARED
=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"} ;;
205 LDSHARED
=${LDSHARED-"$cc -shared $SFLAGS"}
206 case `(uname -m || echo unknown) 2>/dev/null` in
209 SHAREDLIB
='libz.so' ;;
212 SHAREDLIB
='libz.sl' ;;
216 SHAREDLIB
=libz
$shared_ext
217 SHAREDLIBV
=libz.
$VER$shared_ext
218 SHAREDLIBM
=libz.
$VER1$shared_ext
219 LDSHARED
=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"}
220 if libtool
-V 2>&1 |
grep Apple
> /dev
/null
; then
223 AR
="/usr/bin/libtool"
226 *) LDSHARED
=${LDSHARED-"$cc -shared"} ;;
229 # find system name and corresponding cc options
232 echo ... using
$CC >> configure.log
233 if test -z "$uname"; then
234 uname
=`(uname -sr || echo unknown) 2>/dev/null`
237 HP-UX
*) SFLAGS
=${CFLAGS-"-O +z"}
238 CFLAGS
=${CFLAGS-"-O"}
239 # LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"}
240 LDSHARED
=${LDSHARED-"ld -b"}
241 case `(uname -m || echo unknown) 2>/dev/null` in
244 SHAREDLIB
='libz.so' ;;
247 SHAREDLIB
='libz.sl' ;;
249 IRIX
*) SFLAGS
=${CFLAGS-"-ansi -O2 -rpath ."}
250 CFLAGS
=${CFLAGS-"-ansi -O2"}
251 LDSHARED
=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;;
252 OSF1\ V4
*) SFLAGS
=${CFLAGS-"-O -std1"}
253 CFLAGS
=${CFLAGS-"-O -std1"}
254 LDFLAGS
="${LDFLAGS} -Wl,-rpath,."
255 LDSHARED
=${LDSHARED-"cc -shared -Wl,-soname,libz.so -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"} ;;
256 OSF1
*) SFLAGS
=${CFLAGS-"-O -std1"}
257 CFLAGS
=${CFLAGS-"-O -std1"}
258 LDSHARED
=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;;
259 QNX
*) SFLAGS
=${CFLAGS-"-4 -O"}
260 CFLAGS
=${CFLAGS-"-4 -O"}
261 LDSHARED
=${LDSHARED-"cc"}
262 RANLIB
=${RANLIB-"true"}
265 SCO_SV\
3.2*) SFLAGS
=${CFLAGS-"-O3 -dy -KPIC "}
266 CFLAGS
=${CFLAGS-"-O3"}
267 LDSHARED
=${LDSHARED-"cc -dy -KPIC -G"} ;;
268 SunOS\
5* | solaris
*)
269 LDSHARED
=${LDSHARED-"cc -G -h libz$shared_ext.$VER1"}
270 SFLAGS
=${CFLAGS-"-fast -KPIC"}
271 CFLAGS
=${CFLAGS-"-fast"}
272 if test $build64 -eq 1; then
273 # old versions of SunPRO/Workshop/Studio don't support -m64,
274 # but newer ones do. Check for it.
275 flag64
=`$CC -flags | egrep -- '^-m64'`
276 if test x
"$flag64" != x
"" ; then
277 CFLAGS
="${CFLAGS} -m64"
278 SFLAGS
="${SFLAGS} -m64"
280 case `(uname -m || echo unknown) 2>/dev/null` in
282 SFLAGS
="$SFLAGS -xarch=amd64"
283 CFLAGS
="$CFLAGS -xarch=amd64" ;;
285 SFLAGS
="$SFLAGS -xarch=v9"
286 CFLAGS
="$CFLAGS -xarch=v9" ;;
291 SunOS\
4*) SFLAGS
=${CFLAGS-"-O2 -PIC"}
292 CFLAGS
=${CFLAGS-"-O2"}
293 LDSHARED
=${LDSHARED-"ld"} ;;
294 SunStudio\
9*) SFLAGS
=${CFLAGS-"-fast -xcode=pic32 -xtarget=ultra3 -xarch=v9b"}
295 CFLAGS
=${CFLAGS-"-fast -xtarget=ultra3 -xarch=v9b"}
296 LDSHARED
=${LDSHARED-"cc -xarch=v9b"} ;;
297 UNIX_System_V\
4.2.0)
298 SFLAGS
=${CFLAGS-"-KPIC -O"}
299 CFLAGS
=${CFLAGS-"-O"}
300 LDSHARED
=${LDSHARED-"cc -G"} ;;
302 SFLAGS
=${CFLAGS-"-Kconform_pic -O"}
303 CFLAGS
=${CFLAGS-"-O"}
304 LDSHARED
=${LDSHARED-"cc -G"} ;;
306 SFLAGS
=${CFLAGS-"-KPIC -O"}
307 CFLAGS
=${CFLAGS-"-O"}
308 LDSHARED
=${LDSHARED-"cc -G"} ;;
309 AIX
*) # Courtesy of dbakker@arrayasolutions.com
310 SFLAGS
=${CFLAGS-"-O -qmaxmem=8192"}
311 CFLAGS
=${CFLAGS-"-O -qmaxmem=8192"}
312 LDSHARED
=${LDSHARED-"xlc -G"} ;;
313 # send working options for other systems to zlib@gzip.org
314 *) SFLAGS
=${CFLAGS-"-O"}
315 CFLAGS
=${CFLAGS-"-O"}
316 LDSHARED
=${LDSHARED-"cc -shared"} ;;
320 # destination names for shared library if not defined above
321 SHAREDLIB
=${SHAREDLIB-"libz$shared_ext"}
322 SHAREDLIBV
=${SHAREDLIBV-"libz$shared_ext.$VER"}
323 SHAREDLIBM
=${SHAREDLIBM-"libz$shared_ext.$VER1"}
325 echo >> configure.log
327 # define functions for testing compiler and library characteristics and logging the results
332 if ($CC -c $CFLAGS $test.c
) 2>/dev
/null
; then
336 test "`( $* ) 2>&1 | tee -a configure.log`" = ""
338 echo - using any output from compiler to indicate an error
>> configure.log
343 ( $
* ) >> configure.log
2>&1
345 if test $ret -ne 0; then
346 echo "(exit code "$ret")" >> configure.log
357 printf %s
"$got" >> configure.log
358 if test $ret -ne 0; then
365 int foo() { return 0; }
367 echo "Checking for obsessive-compulsive compiler options..." >> configure.log
368 if try
$CC -c $CFLAGS $test.c
; then
371 echo "Compiler error reporting is too harsh for $0 (perhaps remove -Werror)." |
tee -a configure.log
375 echo >> configure.log
377 # see if shared library build supported
379 extern int getchar();
380 int hello() {return getchar();}
382 if test $shared -eq 1; then
383 echo Checking
for shared library support... |
tee -a configure.log
384 # we must test in two steps (cc then ld), required at least on SunOS 4.x
385 if try
$CC -w -c $SFLAGS $test.c
&&
386 try
$LDSHARED $SFLAGS -o $test$shared_ext $test.o
; then
387 echo Building shared library
$SHAREDLIBV with
$CC. |
tee -a configure.log
388 elif test -z "$old_cc" -a -z "$old_cflags"; then
389 echo No shared library support. |
tee -a configure.log
392 echo 'No shared library support; try without defining CC and CFLAGS' |
tee -a configure.log
396 if test $shared -eq 0; then
399 TEST
="all teststatic"
403 echo Building static library
$STATICLIB version
$VER with
$CC. |
tee -a configure.log
406 TEST
="all teststatic testshared"
409 # check for underscores in external names for use by assembler code
413 echo >> configure.log
414 show
"$NM $test.o | grep _hello"
415 if test "`$NM $test.o | grep _hello | tee -a configure.log`" = ""; then
416 CPP
="$CPP -DNO_UNDERLINE"
417 echo Checking
for underline
in external names... No. |
tee -a configure.log
419 echo Checking
for underline
in external names... Yes. |
tee -a configure.log
423 echo >> configure.log
425 # check for large file support, and if none, check for fseeko()
427 #include <sys/types.h>
430 if try
$CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c
; then
431 CFLAGS
="${CFLAGS} -D_LARGEFILE64_SOURCE=1"
432 SFLAGS
="${SFLAGS} -D_LARGEFILE64_SOURCE=1"
434 TEST
="${TEST} test64"
435 echo "Checking for off64_t... Yes." |
tee -a configure.log
436 echo "Checking for fseeko... Yes." |
tee -a configure.log
438 echo "Checking for off64_t... No." |
tee -a configure.log
439 echo >> configure.log
447 if try
$CC $CFLAGS -o $test $test.c
; then
448 echo "Checking for fseeko... Yes." |
tee -a configure.log
450 CFLAGS
="${CFLAGS} -DNO_FSEEKO"
451 SFLAGS
="${SFLAGS} -DNO_FSEEKO"
452 echo "Checking for fseeko... No." |
tee -a configure.log
456 echo >> configure.log
458 # check for strerror() for use by gz* functions
462 int main() { return strlen(strerror(errno)); }
464 if try
$CC $CFLAGS -o $test $test.c
; then
465 echo "Checking for strerror... Yes." |
tee -a configure.log
467 CFLAGS
="${CFLAGS} -DNO_STRERROR"
468 SFLAGS
="${SFLAGS} -DNO_STRERROR"
469 echo "Checking for strerror... No." |
tee -a configure.log
472 # copy clean zconf.h for subsequent edits
473 cp -p zconf.h.
in zconf.h
475 echo >> configure.log
477 # check for unistd.h and save result in zconf.h
480 int main() { return 0; }
482 if try
$CC -c $CFLAGS $test.c
; then
483 sed < zconf.h
"/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
484 mv zconf.temp.h zconf.h
485 echo "Checking for unistd.h... Yes." |
tee -a configure.log
487 echo "Checking for unistd.h... No." |
tee -a configure.log
490 echo >> configure.log
492 # check for stdarg.h and save result in zconf.h
495 int main() { return 0; }
497 if try
$CC -c $CFLAGS $test.c
; then
498 sed < zconf.h
"/^#ifdef HAVE_STDARG_H.* may be/s/def HAVE_STDARG_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
499 mv zconf.temp.h zconf.h
500 echo "Checking for stdarg.h... Yes." |
tee -a configure.log
502 echo "Checking for stdarg.h... No." |
tee -a configure.log
505 # if the z_ prefix was requested, save that in zconf.h
506 if test $zprefix -eq 1; then
507 sed < zconf.h
"/#ifdef Z_PREFIX.* may be/s/def Z_PREFIX\(.*\) may be/ 1\1 was/" > zconf.temp.h
508 mv zconf.temp.h zconf.h
509 echo >> configure.log
510 echo "Using z_ prefix on all symbols." |
tee -a configure.log
513 # if --solo compilation was requested, save that in zconf.h and remove gz stuff from object lists
514 if test $solo -eq 1; then
515 sed '/#define ZCONF_H/a\
518 ' < zconf.h
> zconf.temp.h
519 mv zconf.temp.h zconf.h
521 PIC_OBJC
='$(PIC_OBJZ)'
524 # if code coverage testing was requested, use older gcc if defined, e.g. "gcc-4.2" on Mac OS X
525 if test $cover -eq 1; then
526 CFLAGS
="${CFLAGS} -fprofile-arcs -ftest-coverage"
527 if test -n "$GCC_CLASSIC"; then
532 echo >> configure.log
534 # conduct a series of tests to resolve eight possible cases of using "vs" or "s" printf functions
535 # (using stdarg or not), with or without "n" (proving size of buffer), and with or without a
536 # return value. The most secure result is vsnprintf() with a return value. snprintf() with a
537 # return value is secure as well, but then gzprintf() will be limited to 20 arguments.
550 if try
$CC -c $CFLAGS $test.c
; then
551 echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()." |
tee -a configure.log
553 echo >> configure.log
557 int mytest(const char *fmt, ...)
562 vsnprintf(buf, sizeof(buf), fmt, ap);
568 return (mytest("Hello%d\n", 1));
571 if try
$CC $CFLAGS -o $test $test.c
; then
572 echo "Checking for vsnprintf() in stdio.h... Yes." |
tee -a configure.log
574 echo >> configure.log
578 int mytest(const char *fmt, ...)
584 n = vsnprintf(buf, sizeof(buf), fmt, ap);
590 return (mytest("Hello%d\n", 1));
594 if try
$CC -c $CFLAGS $test.c
; then
595 echo "Checking for return value of vsnprintf()... Yes." |
tee -a configure.log
597 CFLAGS
="$CFLAGS -DHAS_vsnprintf_void"
598 SFLAGS
="$SFLAGS -DHAS_vsnprintf_void"
599 echo "Checking for return value of vsnprintf()... No." |
tee -a configure.log
600 echo " WARNING: apparently vsnprintf() does not return a value. zlib" |
tee -a configure.log
601 echo " can build but will be open to possible string-format security" |
tee -a configure.log
602 echo " vulnerabilities." |
tee -a configure.log
605 CFLAGS
="$CFLAGS -DNO_vsnprintf"
606 SFLAGS
="$SFLAGS -DNO_vsnprintf"
607 echo "Checking for vsnprintf() in stdio.h... No." |
tee -a configure.log
608 echo " WARNING: vsnprintf() not found, falling back to vsprintf(). zlib" |
tee -a configure.log
609 echo " can build but will be open to possible buffer-overflow security" |
tee -a configure.log
610 echo " vulnerabilities." |
tee -a configure.log
612 echo >> configure.log
616 int mytest(const char *fmt, ...)
622 n = vsprintf(buf, fmt, ap);
628 return (mytest("Hello%d\n", 1));
632 if try
$CC -c $CFLAGS $test.c
; then
633 echo "Checking for return value of vsprintf()... Yes." |
tee -a configure.log
635 CFLAGS
="$CFLAGS -DHAS_vsprintf_void"
636 SFLAGS
="$SFLAGS -DHAS_vsprintf_void"
637 echo "Checking for return value of vsprintf()... No." |
tee -a configure.log
638 echo " WARNING: apparently vsprintf() does not return a value. zlib" |
tee -a configure.log
639 echo " can build but will be open to possible string-format security" |
tee -a configure.log
640 echo " vulnerabilities." |
tee -a configure.log
644 echo "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()." |
tee -a configure.log
646 echo >> configure.log
652 snprintf(buf, sizeof(buf), "%s", "foo");
661 if try
$CC $CFLAGS -o $test $test.c
; then
662 echo "Checking for snprintf() in stdio.h... Yes." |
tee -a configure.log
664 echo >> configure.log
670 return snprintf(buf, sizeof(buf), "%s", "foo");
678 if try
$CC -c $CFLAGS $test.c
; then
679 echo "Checking for return value of snprintf()... Yes." |
tee -a configure.log
681 CFLAGS
="$CFLAGS -DHAS_snprintf_void"
682 SFLAGS
="$SFLAGS -DHAS_snprintf_void"
683 echo "Checking for return value of snprintf()... No." |
tee -a configure.log
684 echo " WARNING: apparently snprintf() does not return a value. zlib" |
tee -a configure.log
685 echo " can build but will be open to possible string-format security" |
tee -a configure.log
686 echo " vulnerabilities." |
tee -a configure.log
689 CFLAGS
="$CFLAGS -DNO_snprintf"
690 SFLAGS
="$SFLAGS -DNO_snprintf"
691 echo "Checking for snprintf() in stdio.h... No." |
tee -a configure.log
692 echo " WARNING: snprintf() not found, falling back to sprintf(). zlib" |
tee -a configure.log
693 echo " can build but will be open to possible buffer-overflow security" |
tee -a configure.log
694 echo " vulnerabilities." |
tee -a configure.log
696 echo >> configure.log
702 return sprintf(buf, "%s", "foo");
710 if try
$CC -c $CFLAGS $test.c
; then
711 echo "Checking for return value of sprintf()... Yes." |
tee -a configure.log
713 CFLAGS
="$CFLAGS -DHAS_sprintf_void"
714 SFLAGS
="$SFLAGS -DHAS_sprintf_void"
715 echo "Checking for return value of sprintf()... No." |
tee -a configure.log
716 echo " WARNING: apparently sprintf() does not return a value. zlib" |
tee -a configure.log
717 echo " can build but will be open to possible string-format security" |
tee -a configure.log
718 echo " vulnerabilities." |
tee -a configure.log
723 # see if we can hide zlib internal symbols that are linked between separate source files
724 if test "$gcc" -eq 1; then
725 echo >> configure.log
727 #define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
728 int ZLIB_INTERNAL foo;
734 if tryboth
$CC -c $CFLAGS $test.c
; then
735 CFLAGS
="$CFLAGS -DHAVE_HIDDEN"
736 SFLAGS
="$SFLAGS -DHAVE_HIDDEN"
737 echo "Checking for attribute(visibility) support... Yes." |
tee -a configure.log
739 echo "Checking for attribute(visibility) support... No." |
tee -a configure.log
743 # show the results in the log
744 echo >> configure.log
745 echo ALL
= $ALL >> configure.log
746 echo AR
= $AR >> configure.log
747 echo ARFLAGS
= $ARFLAGS >> configure.log
748 echo CC
= $CC >> configure.log
749 echo CFLAGS
= $CFLAGS >> configure.log
750 echo CPP
= $CPP >> configure.log
751 echo EXE
= $EXE >> configure.log
752 echo LDCONFIG
= $LDCONFIG >> configure.log
753 echo LDFLAGS
= $LDFLAGS >> configure.log
754 echo LDSHARED
= $LDSHARED >> configure.log
755 echo LDSHAREDLIBC
= $LDSHAREDLIBC >> configure.log
756 echo OBJC
= $OBJC >> configure.log
757 echo PIC_OBJC
= $PIC_OBJC >> configure.log
758 echo RANLIB
= $RANLIB >> configure.log
759 echo SFLAGS
= $SFLAGS >> configure.log
760 echo SHAREDLIB
= $SHAREDLIB >> configure.log
761 echo SHAREDLIBM
= $SHAREDLIBM >> configure.log
762 echo SHAREDLIBV
= $SHAREDLIBV >> configure.log
763 echo STATICLIB
= $STATICLIB >> configure.log
764 echo TEST
= $TEST >> configure.log
765 echo VER
= $VER >> configure.log
766 echo Z_U4
= $Z_U4 >> configure.log
767 echo exec_prefix
= $exec_prefix >> configure.log
768 echo includedir
= $includedir >> configure.log
769 echo libdir
= $libdir >> configure.log
770 echo mandir
= $mandir >> configure.log
771 echo prefix
= $prefix >> configure.log
772 echo sharedlibdir
= $sharedlibdir >> configure.log
773 echo uname
= $uname >> configure.log
775 # udpate Makefile with the configure results
778 /^CFLAGS *=/s#=.*#=$CFLAGS#
779 /^SFLAGS *=/s#=.*#=$SFLAGS#
780 /^LDFLAGS *=/s#=.*#=$LDFLAGS#
781 /^LDSHARED *=/s#=.*#=$LDSHARED#
782 /^CPP *=/s#=.*#=$CPP#
783 /^STATICLIB *=/s#=.*#=$STATICLIB#
784 /^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
785 /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
786 /^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
788 /^ARFLAGS *=/s#=.*#=$ARFLAGS#
789 /^RANLIB *=/s#=.*#=$RANLIB#
790 /^LDCONFIG *=/s#=.*#=$LDCONFIG#
791 /^LDSHAREDLIBC *=/s#=.*#=$LDSHAREDLIBC#
792 /^EXE *=/s#=.*#=$EXE#
793 /^prefix *=/s#=.*#=$prefix#
794 /^exec_prefix *=/s#=.*#=$exec_prefix#
795 /^libdir *=/s#=.*#=$libdir#
796 /^sharedlibdir *=/s#=.*#=$sharedlibdir#
797 /^includedir *=/s#=.*#=$includedir#
798 /^mandir *=/s#=.*#=$mandir#
799 /^OBJC *=/s#=.*#= $OBJC#
800 /^PIC_OBJC *=/s#=.*#= $PIC_OBJC#
801 /^all: */s#:.*#: $ALL#
802 /^test: */s#:.*#: $TEST#
805 # create zlib.pc with the configure results
808 /^CFLAGS *=/s#=.*#=$CFLAGS#
809 /^CPP *=/s#=.*#=$CPP#
810 /^LDSHARED *=/s#=.*#=$LDSHARED#
811 /^STATICLIB *=/s#=.*#=$STATICLIB#
812 /^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
813 /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
814 /^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
816 /^ARFLAGS *=/s#=.*#=$ARFLAGS#
817 /^RANLIB *=/s#=.*#=$RANLIB#
818 /^EXE *=/s#=.*#=$EXE#
819 /^prefix *=/s#=.*#=$prefix#
820 /^exec_prefix *=/s#=.*#=$exec_prefix#
821 /^libdir *=/s#=.*#=$libdir#
822 /^sharedlibdir *=/s#=.*#=$sharedlibdir#
823 /^includedir *=/s#=.*#=$includedir#
824 /^mandir *=/s#=.*#=$mandir#
825 /^LDFLAGS *=/s#=.*#=$LDFLAGS#
827 s/\@VERSION\@/$VER/g;