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'}
77 OBJC='$(OBJZ) $(OBJG)'
78 PIC_OBJC='$(PIC_OBJZ) $(PIC_OBJG)'
80 # leave this script, optionally in a bad way
83 if test "$*" != "0"; then
84 echo "** $0 aborting." | tee -a configure.log
86 rm -f $test.[co] $test $test$shared_ext $test.gcno ./--version
87 echo -------------------- >> configure.log
93 # process command line options
98 echo 'usage:' | tee -a configure.log
99 echo ' configure [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a configure.log
100 echo ' [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log
101 echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log
103 -p*=* | --prefix=*) prefix=`echo $1 | sed 's/.*=//'`; shift ;;
104 -e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/.*=//'`; shift ;;
105 -l*=* | --libdir=*) libdir=`echo $1 | sed 's/.*=//'`; shift ;;
106 --sharedlibdir=*) sharedlibdir=`echo $1 | sed 's/.*=//'`; shift ;;
107 -i*=* | --includedir=*) includedir=`echo $1 | sed 's/.*=//'`;shift ;;
108 -u*=* | --uname=*) uname=`echo $1 | sed 's/.*=//'`;shift ;;
109 -p* | --prefix) prefix="$2"; shift; shift ;;
110 -e* | --eprefix) exec_prefix="$2"; shift; shift ;;
111 -l* | --libdir) libdir="$2"; shift; shift ;;
112 -i* | --includedir) includedir="$2"; shift; shift ;;
113 -s* | --shared | --enable-shared) shared=1; shift ;;
114 -t | --static) shared=0; shift ;;
115 --solo) solo=1; shift ;;
116 --cover) cover=1; shift ;;
117 -z* | --zprefix) zprefix=1; shift ;;
118 -6* | --64) build64=1; shift ;;
119 -a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;;
120 --sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;;
121 --localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;;
123 echo "unknown option: $1" | tee -a configure.log
124 echo "$0 --help for help" | tee -a configure.log
129 # temporary file name
132 # put arguments in log, also put test file in log if used in arguments
137 echo === $test.c === >> configure.log
138 cat $test.c >> configure.log
139 echo === >> configure.log;;
141 echo $* >> configure.log
144 # check for gcc vs. cc and set compile and link flags based on the system identified by uname
146 extern int getchar();
147 int hello() {return getchar();}
150 test -z "$CC" && echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log
151 cc=${CC-${CROSS_PREFIX}gcc}
152 cflags=${CFLAGS-"-O3"}
153 # to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
158 case `$cc -v 2>&1` in
163 if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then
164 echo ... using gcc >> configure.log
166 CFLAGS="${CFLAGS--O3} ${ARCHS}"
167 SFLAGS="${CFLAGS--O3} -fPIC"
168 LDFLAGS="${LDFLAGS} ${ARCHS}"
169 if test $build64 -eq 1; then
170 CFLAGS="${CFLAGS} -m64"
171 SFLAGS="${SFLAGS} -m64"
173 if test "${ZLIBGCCWARN}" = "YES"; then
174 CFLAGS="${CFLAGS} -Wall -Wextra -pedantic"
176 if test -z "$uname"; then
177 uname=`(uname -s || echo unknown) 2>/dev/null`
180 Linux* | linux* | GNU | GNU/* | solaris*)
181 LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"} ;;
182 *BSD | *bsd* | DragonFly)
183 LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"}
184 LDCONFIG="ldconfig -m" ;;
185 CYGWIN* | Cygwin* | cygwin* | OS/2*)
189 rm -f $test.[co] $test $test$shared_ext
190 echo "Please use win32/Makefile.gcc instead." | tee -a configure.log
192 LDSHARED=${LDSHARED-"$cc -shared"}
195 QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4
196 # (alain.bonnefoy@icbt.com)
197 LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"} ;;
199 LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"}
200 case `(uname -m || echo unknown) 2>/dev/null` in
203 SHAREDLIB='libz.so' ;;
206 SHAREDLIB='libz.sl' ;;
210 SHAREDLIB=libz$shared_ext
211 SHAREDLIBV=libz.$VER$shared_ext
212 SHAREDLIBM=libz.$VER1$shared_ext
213 LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"}
214 if libtool -V 2>&1 | grep Apple > /dev/null; then
217 AR="/usr/bin/libtool"
220 *) LDSHARED=${LDSHARED-"$cc -shared"} ;;
223 # find system name and corresponding cc options
226 echo ... using $CC >> configure.log
227 if test -z "$uname"; then
228 uname=`(uname -sr || echo unknown) 2>/dev/null`
231 HP-UX*) SFLAGS=${CFLAGS-"-O +z"}
232 CFLAGS=${CFLAGS-"-O"}
233 # LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"}
234 LDSHARED=${LDSHARED-"ld -b"}
235 case `(uname -m || echo unknown) 2>/dev/null` in
238 SHAREDLIB='libz.so' ;;
241 SHAREDLIB='libz.sl' ;;
243 IRIX*) SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."}
244 CFLAGS=${CFLAGS-"-ansi -O2"}
245 LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;;
246 OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"}
247 CFLAGS=${CFLAGS-"-O -std1"}
248 LDFLAGS="${LDFLAGS} -Wl,-rpath,."
249 LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"} ;;
250 OSF1*) SFLAGS=${CFLAGS-"-O -std1"}
251 CFLAGS=${CFLAGS-"-O -std1"}
252 LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;;
253 QNX*) SFLAGS=${CFLAGS-"-4 -O"}
254 CFLAGS=${CFLAGS-"-4 -O"}
255 LDSHARED=${LDSHARED-"cc"}
256 RANLIB=${RANLIB-"true"}
259 SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "}
260 CFLAGS=${CFLAGS-"-O3"}
261 LDSHARED=${LDSHARED-"cc -dy -KPIC -G"} ;;
262 SunOS\ 5* | solaris*)
263 LDSHARED=${LDSHARED-"cc -G -h libz$shared_ext.$VER1"}
264 SFLAGS=${CFLAGS-"-fast -KPIC"}
265 CFLAGS=${CFLAGS-"-fast"}
266 if test $build64 -eq 1; then
267 # old versions of SunPRO/Workshop/Studio don't support -m64,
268 # but newer ones do. Check for it.
269 flag64=`$CC -flags | egrep -- '^-m64'`
270 if test x"$flag64" != x"" ; then
271 CFLAGS="${CFLAGS} -m64"
272 SFLAGS="${SFLAGS} -m64"
274 case `(uname -m || echo unknown) 2>/dev/null` in
276 SFLAGS="$SFLAGS -xarch=amd64"
277 CFLAGS="$CFLAGS -xarch=amd64" ;;
279 SFLAGS="$SFLAGS -xarch=v9"
280 CFLAGS="$CFLAGS -xarch=v9" ;;
285 SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"}
286 CFLAGS=${CFLAGS-"-O2"}
287 LDSHARED=${LDSHARED-"ld"} ;;
288 SunStudio\ 9*) SFLAGS=${CFLAGS-"-fast -xcode=pic32 -xtarget=ultra3 -xarch=v9b"}
289 CFLAGS=${CFLAGS-"-fast -xtarget=ultra3 -xarch=v9b"}
290 LDSHARED=${LDSHARED-"cc -xarch=v9b"} ;;
291 UNIX_System_V\ 4.2.0)
292 SFLAGS=${CFLAGS-"-KPIC -O"}
293 CFLAGS=${CFLAGS-"-O"}
294 LDSHARED=${LDSHARED-"cc -G"} ;;
296 SFLAGS=${CFLAGS-"-Kconform_pic -O"}
297 CFLAGS=${CFLAGS-"-O"}
298 LDSHARED=${LDSHARED-"cc -G"} ;;
300 SFLAGS=${CFLAGS-"-KPIC -O"}
301 CFLAGS=${CFLAGS-"-O"}
302 LDSHARED=${LDSHARED-"cc -G"} ;;
303 AIX*) # Courtesy of dbakker@arrayasolutions.com
304 SFLAGS=${CFLAGS-"-O -qmaxmem=8192"}
305 CFLAGS=${CFLAGS-"-O -qmaxmem=8192"}
306 LDSHARED=${LDSHARED-"xlc -G"} ;;
307 # send working options for other systems to zlib@gzip.org
308 *) SFLAGS=${CFLAGS-"-O"}
309 CFLAGS=${CFLAGS-"-O"}
310 LDSHARED=${LDSHARED-"cc -shared"} ;;
314 # destination names for shared library if not defined above
315 SHAREDLIB=${SHAREDLIB-"libz$shared_ext"}
316 SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"}
317 SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"}
319 echo >> configure.log
321 # define functions for testing compiler and library characteristics and logging the results
326 if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
330 test "`( $* ) 2>&1 | tee -a configure.log`" = ""
332 echo - using any output from compiler to indicate an error >> configure.log
337 ( $* ) >> configure.log 2>&1
339 if test $ret -ne 0; then
340 echo "(exit code "$ret")" >> configure.log
351 printf %s "$got" >> configure.log
352 if test $ret -ne 0; then
359 int foo() { return 0; }
361 echo "Checking for obsessive-compulsive compiler options..." >> configure.log
362 if ! try $CC -c $CFLAGS $test.c; then
363 echo "Compiler error reporting is too harsh for $0 (perhaps remove -Werror)." | tee -a configure.log
367 echo >> configure.log
369 # see if shared library build supported
371 extern int getchar();
372 int hello() {return getchar();}
374 if test $shared -eq 1; then
375 echo Checking for shared library support... | tee -a configure.log
376 # we must test in two steps (cc then ld), required at least on SunOS 4.x
377 if try $CC -w -c $SFLAGS $test.c &&
378 try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then
379 echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log
380 elif test -z "$old_cc" -a -z "$old_cflags"; then
381 echo No shared library support. | tee -a configure.log
384 echo 'No shared library support; try without defining CC and CFLAGS' | tee -a configure.log
388 if test $shared -eq 0; then
391 TEST="all teststatic"
395 echo Building static library $STATICLIB version $VER with $CC. | tee -a configure.log
398 TEST="all teststatic testshared"
401 # check for underscores in external names for use by assembler code
405 echo >> configure.log
406 show "$NM $test.o | grep _hello"
407 if test "`$NM $test.o | grep _hello | tee -a configure.log`" = ""; then
408 CPP="$CPP -DNO_UNDERLINE"
409 echo Checking for underline in external names... No. | tee -a configure.log
411 echo Checking for underline in external names... Yes. | tee -a configure.log
415 echo >> configure.log
417 # check for large file support, and if none, check for fseeko()
419 #include <sys/types.h>
422 if try $CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c; then
423 CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1"
424 SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1"
426 TEST="${TEST} test64"
427 echo "Checking for off64_t... Yes." | tee -a configure.log
428 echo "Checking for fseeko... Yes." | tee -a configure.log
430 echo "Checking for off64_t... No." | tee -a configure.log
431 echo >> configure.log
439 if try $CC $CFLAGS -o $test $test.c; then
440 echo "Checking for fseeko... Yes." | tee -a configure.log
442 CFLAGS="${CFLAGS} -DNO_FSEEKO"
443 SFLAGS="${SFLAGS} -DNO_FSEEKO"
444 echo "Checking for fseeko... No." | tee -a configure.log
448 echo >> configure.log
450 # check for strerror() for use by gz* functions
454 int main() { return strlen(strerror(errno)); }
456 if try $CC $CFLAGS -o $test $test.c; then
457 echo "Checking for strerror... Yes." | tee -a configure.log
459 CFLAGS="${CFLAGS} -DNO_STRERROR"
460 SFLAGS="${SFLAGS} -DNO_STRERROR"
461 echo "Checking for strerror... No." | tee -a configure.log
464 # copy clean zconf.h for subsequent edits
465 cp -p zconf.h.in zconf.h
467 echo >> configure.log
469 # check for unistd.h and save result in zconf.h
472 int main() { return 0; }
474 if try $CC -c $CFLAGS $test.c; then
475 sed < zconf.h "/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
476 mv zconf.temp.h zconf.h
477 echo "Checking for unistd.h... Yes." | tee -a configure.log
479 echo "Checking for unistd.h... No." | tee -a configure.log
482 echo >> configure.log
484 # check for stdarg.h and save result in zconf.h
487 int main() { return 0; }
489 if try $CC -c $CFLAGS $test.c; then
490 sed < zconf.h "/^#ifdef HAVE_STDARG_H.* may be/s/def HAVE_STDARG_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
491 mv zconf.temp.h zconf.h
492 echo "Checking for stdarg.h... Yes." | tee -a configure.log
494 echo "Checking for stdarg.h... No." | tee -a configure.log
497 # if the z_ prefix was requested, save that in zconf.h
498 if test $zprefix -eq 1; then
499 sed < zconf.h "/#ifdef Z_PREFIX.* may be/s/def Z_PREFIX\(.*\) may be/ 1\1 was/" > zconf.temp.h
500 mv zconf.temp.h zconf.h
501 echo >> configure.log
502 echo "Using z_ prefix on all symbols." | tee -a configure.log
505 # if --solo compilation was requested, save that in zconf.h and remove gz stuff from object lists
506 if test $solo -eq 1; then
507 sed '/#define ZCONF_H/a\
510 ' < zconf.h > zconf.temp.h
511 mv zconf.temp.h zconf.h
513 PIC_OBJC='$(PIC_OBJZ)'
516 # if code coverage testing was requested, use older gcc if defined, e.g. "gcc-4.2" on Mac OS X
517 if test $cover -eq 1; then
518 CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage"
519 if test -n "$GCC_CLASSIC"; then
524 echo >> configure.log
526 # conduct a series of tests to resolve eight possible cases of using "vs" or "s" printf functions
527 # (using stdarg or not), with or without "n" (proving size of buffer), and with or without a
528 # return value. The most secure result is vsnprintf() with a return value. snprintf() with a
529 # return value is secure as well, but then gzprintf() will be limited to 20 arguments.
542 if try $CC -c $CFLAGS $test.c; then
543 echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()." | tee -a configure.log
545 echo >> configure.log
549 int mytest(const char *fmt, ...)
554 vsnprintf(buf, sizeof(buf), fmt, ap);
560 return (mytest("Hello%d\n", 1));
563 if try $CC $CFLAGS -o $test $test.c; then
564 echo "Checking for vsnprintf() in stdio.h... Yes." | tee -a configure.log
566 echo >> configure.log
570 int mytest(const char *fmt, ...)
576 n = vsnprintf(buf, sizeof(buf), fmt, ap);
582 return (mytest("Hello%d\n", 1));
586 if try $CC -c $CFLAGS $test.c; then
587 echo "Checking for return value of vsnprintf()... Yes." | tee -a configure.log
589 CFLAGS="$CFLAGS -DHAS_vsnprintf_void"
590 SFLAGS="$SFLAGS -DHAS_vsnprintf_void"
591 echo "Checking for return value of vsnprintf()... No." | tee -a configure.log
592 echo " WARNING: apparently vsnprintf() does not return a value. zlib" | tee -a configure.log
593 echo " can build but will be open to possible string-format security" | tee -a configure.log
594 echo " vulnerabilities." | tee -a configure.log
597 CFLAGS="$CFLAGS -DNO_vsnprintf"
598 SFLAGS="$SFLAGS -DNO_vsnprintf"
599 echo "Checking for vsnprintf() in stdio.h... No." | tee -a configure.log
600 echo " WARNING: vsnprintf() not found, falling back to vsprintf(). zlib" | tee -a configure.log
601 echo " can build but will be open to possible buffer-overflow security" | tee -a configure.log
602 echo " vulnerabilities." | tee -a configure.log
604 echo >> configure.log
608 int mytest(const char *fmt, ...)
614 n = vsprintf(buf, fmt, ap);
620 return (mytest("Hello%d\n", 1));
624 if try $CC -c $CFLAGS $test.c; then
625 echo "Checking for return value of vsprintf()... Yes." | tee -a configure.log
627 CFLAGS="$CFLAGS -DHAS_vsprintf_void"
628 SFLAGS="$SFLAGS -DHAS_vsprintf_void"
629 echo "Checking for return value of vsprintf()... No." | tee -a configure.log
630 echo " WARNING: apparently vsprintf() does not return a value. zlib" | tee -a configure.log
631 echo " can build but will be open to possible string-format security" | tee -a configure.log
632 echo " vulnerabilities." | tee -a configure.log
636 echo "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()." | tee -a configure.log
638 echo >> configure.log
644 snprintf(buf, sizeof(buf), "%s", "foo");
653 if try $CC $CFLAGS -o $test $test.c; then
654 echo "Checking for snprintf() in stdio.h... Yes." | tee -a configure.log
656 echo >> configure.log
662 return snprintf(buf, sizeof(buf), "%s", "foo");
670 if try $CC -c $CFLAGS $test.c; then
671 echo "Checking for return value of snprintf()... Yes." | tee -a configure.log
673 CFLAGS="$CFLAGS -DHAS_snprintf_void"
674 SFLAGS="$SFLAGS -DHAS_snprintf_void"
675 echo "Checking for return value of snprintf()... No." | tee -a configure.log
676 echo " WARNING: apparently snprintf() does not return a value. zlib" | tee -a configure.log
677 echo " can build but will be open to possible string-format security" | tee -a configure.log
678 echo " vulnerabilities." | tee -a configure.log
681 CFLAGS="$CFLAGS -DNO_snprintf"
682 SFLAGS="$SFLAGS -DNO_snprintf"
683 echo "Checking for snprintf() in stdio.h... No." | tee -a configure.log
684 echo " WARNING: snprintf() not found, falling back to sprintf(). zlib" | tee -a configure.log
685 echo " can build but will be open to possible buffer-overflow security" | tee -a configure.log
686 echo " vulnerabilities." | tee -a configure.log
688 echo >> configure.log
694 return sprintf(buf, "%s", "foo");
702 if try $CC -c $CFLAGS $test.c; then
703 echo "Checking for return value of sprintf()... Yes." | tee -a configure.log
705 CFLAGS="$CFLAGS -DHAS_sprintf_void"
706 SFLAGS="$SFLAGS -DHAS_sprintf_void"
707 echo "Checking for return value of sprintf()... No." | tee -a configure.log
708 echo " WARNING: apparently sprintf() does not return a value. zlib" | tee -a configure.log
709 echo " can build but will be open to possible string-format security" | tee -a configure.log
710 echo " vulnerabilities." | tee -a configure.log
715 # see if we can hide zlib internal symbols that are linked between separate source files
716 if test "$gcc" -eq 1; then
717 echo >> configure.log
719 #define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
720 int ZLIB_INTERNAL foo;
726 if tryboth $CC -c $CFLAGS $test.c; then
727 CFLAGS="$CFLAGS -DHAVE_HIDDEN"
728 SFLAGS="$SFLAGS -DHAVE_HIDDEN"
729 echo "Checking for attribute(visibility) support... Yes." | tee -a configure.log
731 echo "Checking for attribute(visibility) support... No." | tee -a configure.log
735 echo >> configure.log
737 # find a four-byte unsiged integer type for crc calculations
740 #define is32(n,t) for(n=1,k=0;n;n<<=1,k++);if(k==32){puts(t);return 0;}
747 is32(l, "unsigned long")
748 is32(s, "unsigned short")
753 if try $CC $CFLAGS $test.c -o $test && Z_U4=`./$test` && test -n "$Z_U4"; then
754 sed < zconf.h "/#define Z_U4/s/\/\* \.\/configure may/#define Z_U4 $Z_U4 \/* .\/configure put the/" > zconf.temp.h
755 mv zconf.temp.h zconf.h
756 echo "Looking for a four-byte integer type... Found." | tee -a configure.log
758 echo "Looking for a four-byte integer type... Not found." | tee -a configure.log
761 # show the results in the log
762 echo >> configure.log
763 echo ALL = $ALL >> configure.log
764 echo AR = $AR >> configure.log
765 echo ARFLAGS = $ARFLAGS >> configure.log
766 echo CC = $CC >> configure.log
767 echo CFLAGS = $CFLAGS >> configure.log
768 echo CPP = $CPP >> configure.log
769 echo EXE = $EXE >> configure.log
770 echo LDCONFIG = $LDCONFIG >> configure.log
771 echo LDFLAGS = $LDFLAGS >> configure.log
772 echo LDSHARED = $LDSHARED >> configure.log
773 echo LDSHAREDLIBC = $LDSHAREDLIBC >> configure.log
774 echo OBJC = $OBJC >> configure.log
775 echo PIC_OBJC = $PIC_OBJC >> configure.log
776 echo RANLIB = $RANLIB >> configure.log
777 echo SFLAGS = $SFLAGS >> configure.log
778 echo SHAREDLIB = $SHAREDLIB >> configure.log
779 echo SHAREDLIBM = $SHAREDLIBM >> configure.log
780 echo SHAREDLIBV = $SHAREDLIBV >> configure.log
781 echo STATICLIB = $STATICLIB >> configure.log
782 echo TEST = $TEST >> configure.log
783 echo VER = $VER >> configure.log
784 echo Z_U4 = $Z_U4 >> configure.log
785 echo exec_prefix = $exec_prefix >> configure.log
786 echo includedir = $includedir >> configure.log
787 echo libdir = $libdir >> configure.log
788 echo mandir = $mandir >> configure.log
789 echo prefix = $prefix >> configure.log
790 echo sharedlibdir = $sharedlibdir >> configure.log
791 echo uname = $uname >> configure.log
793 # udpate Makefile with the configure results
796 /^CFLAGS *=/s#=.*#=$CFLAGS#
797 /^SFLAGS *=/s#=.*#=$SFLAGS#
798 /^LDFLAGS *=/s#=.*#=$LDFLAGS#
799 /^LDSHARED *=/s#=.*#=$LDSHARED#
800 /^CPP *=/s#=.*#=$CPP#
801 /^STATICLIB *=/s#=.*#=$STATICLIB#
802 /^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
803 /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
804 /^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
806 /^ARFLAGS *=/s#=.*#=$ARFLAGS#
807 /^RANLIB *=/s#=.*#=$RANLIB#
808 /^LDCONFIG *=/s#=.*#=$LDCONFIG#
809 /^LDSHAREDLIBC *=/s#=.*#=$LDSHAREDLIBC#
810 /^EXE *=/s#=.*#=$EXE#
811 /^prefix *=/s#=.*#=$prefix#
812 /^exec_prefix *=/s#=.*#=$exec_prefix#
813 /^libdir *=/s#=.*#=$libdir#
814 /^sharedlibdir *=/s#=.*#=$sharedlibdir#
815 /^includedir *=/s#=.*#=$includedir#
816 /^mandir *=/s#=.*#=$mandir#
817 /^OBJC *=/s#=.*#= $OBJC#
818 /^PIC_OBJC *=/s#=.*#= $PIC_OBJC#
819 /^all: */s#:.*#: $ALL#
820 /^test: */s#:.*#: $TEST#
823 # create zlib.pc with the configure results
826 /^CFLAGS *=/s#=.*#=$CFLAGS#
827 /^CPP *=/s#=.*#=$CPP#
828 /^LDSHARED *=/s#=.*#=$LDSHARED#
829 /^STATICLIB *=/s#=.*#=$STATICLIB#
830 /^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
831 /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
832 /^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
834 /^ARFLAGS *=/s#=.*#=$ARFLAGS#
835 /^RANLIB *=/s#=.*#=$RANLIB#
836 /^EXE *=/s#=.*#=$EXE#
837 /^prefix *=/s#=.*#=$prefix#
838 /^exec_prefix *=/s#=.*#=$exec_prefix#
839 /^libdir *=/s#=.*#=$libdir#
840 /^sharedlibdir *=/s#=.*#=$sharedlibdir#
841 /^includedir *=/s#=.*#=$includedir#
842 /^mandir *=/s#=.*#=$mandir#
843 /^LDFLAGS *=/s#=.*#=$LDFLAGS#
845 s/\@VERSION\@/$VER/g;