]> git.lizzy.rs Git - zlib.git/blob - configure
Add a ./config --solo option to make zlib subset with no libary use
[zlib.git] / configure
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 if [ -n "${CHOST}" ]; then
17     uname="`echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/'`"
18     CROSS_PREFIX="${CHOST}-"
19 fi
20
21 STATICLIB=libz.a
22 VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
23 VER3=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < zlib.h`
24 VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h`
25 VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h`
26 if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then
27     AR=${AR-"${CROSS_PREFIX}ar"}
28     test -n "${CROSS_PREFIX}" && echo Using ${AR}
29 else
30     AR=${AR-"ar"}
31     test -n "${CROSS_PREFIX}" && echo Using ${AR}
32 fi
33 AR_RC="${AR} rc"
34 if "${CROSS_PREFIX}ranlib" --version >/dev/null 2>/dev/null || test $? -lt 126; then
35     RANLIB=${RANLIB-"${CROSS_PREFIX}ranlib"}
36     test -n "${CROSS_PREFIX}" && echo Using ${RANLIB}
37 else
38     RANLIB=${RANLIB-"ranlib"}
39 fi
40 if "${CROSS_PREFIX}nm" --version >/dev/null 2>/dev/null || test $? -lt 126; then
41     NM=${NM-"${CROSS_PREFIX}nm"}
42     test -n "${CROSS_PREFIX}" && echo Using ${NM}
43 else
44     NM=${NM-"nm"}
45 fi
46 LDCONFIG=${LDCONFIG-"ldconfig"}
47 LDSHAREDLIBC="${LDSHAREDLIBC--lc}"
48 ARCHS=
49 prefix=${prefix-/usr/local}
50 exec_prefix=${exec_prefix-'${prefix}'}
51 libdir=${libdir-'${exec_prefix}/lib'}
52 sharedlibdir=${sharedlibdir-'${libdir}'}
53 includedir=${includedir-'${prefix}/include'}
54 mandir=${mandir-'${prefix}/share/man'}
55 shared_ext='.so'
56 shared=1
57 solo=0
58 zprefix=0
59 build64=0
60 gcc=0
61 old_cc="$CC"
62 old_cflags="$CFLAGS"
63 OBJC='$(OBJZ) $(OBJG)'
64 PIC_OBJC='$(PIC_OBJZ) $(PIC_OBJG)'
65
66 while test $# -ge 1
67 do
68 case "$1" in
69     -h* | --help)
70       echo 'usage:'
71       echo '  configure [--zprefix] [--prefix=PREFIX]  [--eprefix=EXPREFIX]'
72       echo '    [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]'
73       echo '    [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]'
74         exit 0 ;;
75     -p*=* | --prefix=*) prefix=`echo $1 | sed 's/.*=//'`; shift ;;
76     -e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/.*=//'`; shift ;;
77     -l*=* | --libdir=*) libdir=`echo $1 | sed 's/.*=//'`; shift ;;
78     --sharedlibdir=*) sharedlibdir=`echo $1 | sed 's/.*=//'`; shift ;;
79     -i*=* | --includedir=*) includedir=`echo $1 | sed 's/.*=//'`;shift ;;
80     -u*=* | --uname=*) uname=`echo $1 | sed 's/.*=//'`;shift ;;
81     -p* | --prefix) prefix="$2"; shift; shift ;;
82     -e* | --eprefix) exec_prefix="$2"; shift; shift ;;
83     -l* | --libdir) libdir="$2"; shift; shift ;;
84     -i* | --includedir) includedir="$2"; shift; shift ;;
85     -s* | --shared | --enable-shared) shared=1; shift ;;
86     -t | --static) shared=0; shift ;;
87     --solo) solo=1; shift ;;
88     -z* | --zprefix) zprefix=1; shift ;;
89     -6* | --64) build64=1; shift ;;
90     -a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;;
91     --sysconfdir=*) echo "ignored option: --sysconfdir"; shift ;;
92     --localstatedir=*) echo "ignored option: --localstatedir"; shift ;;
93     *) echo "unknown option: $1"; echo "$0 --help for help"; exit 1 ;;
94     esac
95 done
96
97 test=ztest$$
98 cat > $test.c <<EOF
99 extern int getchar();
100 int hello() {return getchar();}
101 EOF
102
103 test -z "$CC" && echo Checking for ${CROSS_PREFIX}gcc...
104 cc=${CC-${CROSS_PREFIX}gcc}
105 cflags=${CFLAGS-"-O3"}
106 # to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
107 case "$cc" in
108   *gcc*) gcc=1 ;;
109 esac
110 case `$cc -v 2>&1` in
111   *gcc*) gcc=1 ;;
112 esac
113
114 if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
115   CC="$cc"
116   CFLAGS="${CFLAGS--O3} ${ARCHS}"
117   SFLAGS="${CFLAGS--O3} -fPIC"
118   LDFLAGS="${LDFLAGS} ${ARCHS}"
119   if test $build64 -eq 1; then
120     CFLAGS="${CFLAGS} -m64"
121     SFLAGS="${SFLAGS} -m64"
122   fi
123   if test "${ZLIBGCCWARN}" = "YES"; then
124     CFLAGS="${CFLAGS} -Wall -Wextra -pedantic"
125   fi
126   if test -z "$uname"; then
127     uname=`(uname -s || echo unknown) 2>/dev/null`
128   fi
129   case "$uname" in
130   Linux* | linux* | GNU | GNU/* | *BSD | *bsd* | DragonFly | solaris*)
131         LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"} ;;
132   CYGWIN* | Cygwin* | cygwin* | OS/2*)
133         EXE='.exe' ;;
134   MINGW* | mingw*)
135 # temporary bypass
136         rm -f $test.[co] $test $test$shared_ext
137         echo "Please use win32/Makefile.gcc instead."
138         exit 1
139         LDSHARED=${LDSHARED-"$cc -shared"}
140         LDSHAREDLIBC=""
141         EXE='.exe' ;;
142   QNX*)  # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4
143          # (alain.bonnefoy@icbt.com)
144                  LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"} ;;
145   HP-UX*)
146          LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"}
147          case `(uname -m || echo unknown) 2>/dev/null` in
148          ia64)
149                  shared_ext='.so'
150                  SHAREDLIB='libz.so' ;;
151          *)
152                  shared_ext='.sl'
153                  SHAREDLIB='libz.sl' ;;
154          esac ;;
155   Darwin* | darwin*)
156              shared_ext='.dylib'
157              SHAREDLIB=libz$shared_ext
158              SHAREDLIBV=libz.$VER$shared_ext
159              SHAREDLIBM=libz.$VER1$shared_ext
160              LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"}
161              AR="libtool"
162              AR_RC="${AR} -o" ;;
163   *)             LDSHARED=${LDSHARED-"$cc -shared"} ;;
164   esac
165 else
166   # find system name and corresponding cc options
167   CC=${CC-cc}
168   gcc=0
169   if test -z "$uname"; then
170     uname=`(uname -sr || echo unknown) 2>/dev/null`
171   fi
172   case "$uname" in
173   HP-UX*)    SFLAGS=${CFLAGS-"-O +z"}
174              CFLAGS=${CFLAGS-"-O"}
175 #            LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"}
176              LDSHARED=${LDSHARED-"ld -b"}
177          case `(uname -m || echo unknown) 2>/dev/null` in
178          ia64)
179              shared_ext='.so'
180              SHAREDLIB='libz.so' ;;
181          *)
182              shared_ext='.sl'
183              SHAREDLIB='libz.sl' ;;
184          esac ;;
185   IRIX*)     SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."}
186              CFLAGS=${CFLAGS-"-ansi -O2"}
187              LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;;
188   OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"}
189              CFLAGS=${CFLAGS-"-O -std1"}
190              LDFLAGS="${LDFLAGS} -Wl,-rpath,."
191              LDSHARED=${LDSHARED-"cc -shared  -Wl,-soname,libz.so -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"} ;;
192   OSF1*)     SFLAGS=${CFLAGS-"-O -std1"}
193              CFLAGS=${CFLAGS-"-O -std1"}
194              LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;;
195   QNX*)      SFLAGS=${CFLAGS-"-4 -O"}
196              CFLAGS=${CFLAGS-"-4 -O"}
197              LDSHARED=${LDSHARED-"cc"}
198              RANLIB=${RANLIB-"true"}
199              AR_RC="cc -A" ;;
200   SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "}
201              CFLAGS=${CFLAGS-"-O3"}
202              LDSHARED=${LDSHARED-"cc -dy -KPIC -G"} ;;
203   SunOS\ 5* | solaris*)
204          LDSHARED=${LDSHARED-"cc -G"}
205          case `(uname -m || echo unknown) 2>/dev/null` in
206          i86*)
207              SFLAGS=${CFLAGS-"-xpentium -fast -KPIC -R."}
208              CFLAGS=${CFLAGS-"-xpentium -fast"} ;;
209          *)
210              SFLAGS=${CFLAGS-"-fast -xcg92 -KPIC -R."}
211              CFLAGS=${CFLAGS-"-fast -xcg92"} ;;
212          esac ;;
213   SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"}
214              CFLAGS=${CFLAGS-"-O2"}
215              LDSHARED=${LDSHARED-"ld"} ;;
216   SunStudio\ 9*) SFLAGS=${CFLAGS-"-fast -xcode=pic32 -xtarget=ultra3 -xarch=v9b"}
217              CFLAGS=${CFLAGS-"-fast -xtarget=ultra3 -xarch=v9b"}
218              LDSHARED=${LDSHARED-"cc -xarch=v9b"} ;;
219   UNIX_System_V\ 4.2.0)
220              SFLAGS=${CFLAGS-"-KPIC -O"}
221              CFLAGS=${CFLAGS-"-O"}
222              LDSHARED=${LDSHARED-"cc -G"} ;;
223   UNIX_SV\ 4.2MP)
224              SFLAGS=${CFLAGS-"-Kconform_pic -O"}
225              CFLAGS=${CFLAGS-"-O"}
226              LDSHARED=${LDSHARED-"cc -G"} ;;
227   OpenUNIX\ 5)
228              SFLAGS=${CFLAGS-"-KPIC -O"}
229              CFLAGS=${CFLAGS-"-O"}
230              LDSHARED=${LDSHARED-"cc -G"} ;;
231   AIX*)  # Courtesy of dbakker@arrayasolutions.com
232              SFLAGS=${CFLAGS-"-O -qmaxmem=8192"}
233              CFLAGS=${CFLAGS-"-O -qmaxmem=8192"}
234              LDSHARED=${LDSHARED-"xlc -G"} ;;
235   # send working options for other systems to zlib@gzip.org
236   *)         SFLAGS=${CFLAGS-"-O"}
237              CFLAGS=${CFLAGS-"-O"}
238              LDSHARED=${LDSHARED-"cc -shared"} ;;
239   esac
240 fi
241
242 SHAREDLIB=${SHAREDLIB-"libz$shared_ext"}
243 SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"}
244 SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"}
245
246 if test $shared -eq 1; then
247   echo Checking for shared library support...
248   # we must test in two steps (cc then ld), required at least on SunOS 4.x
249   if test "`($CC -w -c $SFLAGS $test.c) 2>&1`" = "" &&
250      test "`($LDSHARED $SFLAGS -o $test$shared_ext $test.o) 2>&1`" = ""; then
251     echo Building shared library $SHAREDLIBV with $CC.
252   elif test -z "$old_cc" -a -z "$old_cflags"; then
253     echo No shared library support.
254     shared=0;
255   else
256     echo Tested $CC -w -c $SFLAGS $test.c
257     $CC -w -c $SFLAGS $test.c
258     echo Tested $LDSHARED $SFLAGS -o $test$shared_ext $test.o
259     $LDSHARED $SFLAGS -o $test$shared_ext $test.o
260     echo 'No shared library support; try without defining CC and CFLAGS'
261     shared=0;
262   fi
263 fi
264 if test $shared -eq 0; then
265   LDSHARED="$CC"
266   ALL="static"
267   TEST="all teststatic"
268   SHAREDLIB=""
269   SHAREDLIBV=""
270   SHAREDLIBM=""
271   echo Building static library $STATICLIB version $VER with $CC.
272 else
273   ALL="static shared"
274   TEST="all teststatic testshared"
275 fi
276
277 cat > $test.c <<EOF
278 #include <sys/types.h>
279 off64_t dummy = 0;
280 EOF
281 if test "`($CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c) 2>&1`" = ""; then
282   CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1"
283   SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1"
284   ALL="${ALL} all64"
285   TEST="${TEST} test64"
286   echo "Checking for off64_t... Yes."
287   echo "Checking for fseeko... Yes."
288 else
289   echo "Checking for off64_t... No."
290   cat > $test.c <<EOF
291 #include <stdio.h>
292 int main(void) {
293   fseeko(NULL, 0, 0);
294   return 0;
295 }
296 EOF
297   if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then
298     echo "Checking for fseeko... Yes."
299   else
300     CFLAGS="${CFLAGS} -DNO_FSEEKO"
301     SFLAGS="${SFLAGS} -DNO_FSEEKO"
302     echo "Checking for fseeko... No."
303   fi
304 fi
305
306 cp -p zconf.h.in zconf.h
307
308 cat > $test.c <<EOF
309 #include <unistd.h>
310 int main() { return 0; }
311 EOF
312 if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
313   sed < zconf.h "/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
314   mv zconf.temp.h zconf.h
315   echo "Checking for unistd.h... Yes."
316 else
317   echo "Checking for unistd.h... No."
318 fi
319
320 cat > $test.c <<EOF
321 #include <stdarg.h>
322 int main() { return 0; }
323 EOF
324 if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
325   sed < zconf.h "/^#ifdef HAVE_STDARG_H.* may be/s/def HAVE_STDARG_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
326   mv zconf.temp.h zconf.h
327   echo "Checking for stdarg.h... Yes."
328 else
329   echo "Checking for stdarg.h... No."
330 fi
331
332 if test $zprefix -eq 1; then
333   sed < zconf.h "/#ifdef Z_PREFIX.* may be/s/def Z_PREFIX\(.*\) may be/ 1\1 was/" > zconf.temp.h
334   mv zconf.temp.h zconf.h
335   echo "Using z_ prefix on all symbols."
336 fi
337
338 if test $solo -eq 1; then
339   sed '/#define ZCONF_H/a\
340 #define Z_SOLO
341
342 ' < zconf.h > zconf.temp.h
343   mv zconf.temp.h zconf.h
344 OBJC='$(OBJZ)'
345 PIC_OBJC='$(PIC_OBJZ)'
346 fi
347
348 cat > $test.c <<EOF
349 #include <stdio.h>
350 #include <stdarg.h>
351 #include "zconf.h"
352
353 int main()
354 {
355 #ifndef STDC
356   choke me
357 #endif
358
359   return 0;
360 }
361 EOF
362
363 if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
364   echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()."
365
366   cat > $test.c <<EOF
367 #include <stdio.h>
368 #include <stdarg.h>
369
370 int mytest(const char *fmt, ...)
371 {
372   char buf[20];
373   va_list ap;
374
375   va_start(ap, fmt);
376   vsnprintf(buf, sizeof(buf), fmt, ap);
377   va_end(ap);
378   return 0;
379 }
380
381 int main()
382 {
383   return (mytest("Hello%d\n", 1));
384 }
385 EOF
386   if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then
387     echo "Checking for vsnprintf() in stdio.h... Yes."
388
389     cat >$test.c <<EOF
390 #include <stdio.h>
391 #include <stdarg.h>
392
393 int mytest(const char *fmt, ...)
394 {
395   int n;
396   char buf[20];
397   va_list ap;
398
399   va_start(ap, fmt);
400   n = vsnprintf(buf, sizeof(buf), fmt, ap);
401   va_end(ap);
402   return n;
403 }
404
405 int main()
406 {
407   return (mytest("Hello%d\n", 1));
408 }
409 EOF
410
411     if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
412       echo "Checking for return value of vsnprintf()... Yes."
413     else
414       CFLAGS="$CFLAGS -DHAS_vsnprintf_void"
415       SFLAGS="$SFLAGS -DHAS_vsnprintf_void"
416       echo "Checking for return value of vsnprintf()... No."
417       echo "  WARNING: apparently vsnprintf() does not return a value. zlib"
418       echo "  can build but will be open to possible string-format security"
419       echo "  vulnerabilities."
420     fi
421   else
422     CFLAGS="$CFLAGS -DNO_vsnprintf"
423     SFLAGS="$SFLAGS -DNO_vsnprintf"
424     echo "Checking for vsnprintf() in stdio.h... No."
425     echo "  WARNING: vsnprintf() not found, falling back to vsprintf(). zlib"
426     echo "  can build but will be open to possible buffer-overflow security"
427     echo "  vulnerabilities."
428
429     cat >$test.c <<EOF
430 #include <stdio.h>
431 #include <stdarg.h>
432
433 int mytest(const char *fmt, ...)
434 {
435   int n;
436   char buf[20];
437   va_list ap;
438
439   va_start(ap, fmt);
440   n = vsprintf(buf, fmt, ap);
441   va_end(ap);
442   return n;
443 }
444
445 int main()
446 {
447   return (mytest("Hello%d\n", 1));
448 }
449 EOF
450
451     if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
452       echo "Checking for return value of vsprintf()... Yes."
453     else
454       CFLAGS="$CFLAGS -DHAS_vsprintf_void"
455       SFLAGS="$SFLAGS -DHAS_vsprintf_void"
456       echo "Checking for return value of vsprintf()... No."
457       echo "  WARNING: apparently vsprintf() does not return a value. zlib"
458       echo "  can build but will be open to possible string-format security"
459       echo "  vulnerabilities."
460     fi
461   fi
462 else
463   echo "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()."
464
465   cat >$test.c <<EOF
466 #include <stdio.h>
467
468 int mytest()
469 {
470   char buf[20];
471
472   snprintf(buf, sizeof(buf), "%s", "foo");
473   return 0;
474 }
475
476 int main()
477 {
478   return (mytest());
479 }
480 EOF
481
482   if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then
483     echo "Checking for snprintf() in stdio.h... Yes."
484
485     cat >$test.c <<EOF
486 #include <stdio.h>
487
488 int mytest()
489 {
490   char buf[20];
491
492   return snprintf(buf, sizeof(buf), "%s", "foo");
493 }
494
495 int main()
496 {
497   return (mytest());
498 }
499 EOF
500
501     if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
502       echo "Checking for return value of snprintf()... Yes."
503     else
504       CFLAGS="$CFLAGS -DHAS_snprintf_void"
505       SFLAGS="$SFLAGS -DHAS_snprintf_void"
506       echo "Checking for return value of snprintf()... No."
507       echo "  WARNING: apparently snprintf() does not return a value. zlib"
508       echo "  can build but will be open to possible string-format security"
509       echo "  vulnerabilities."
510     fi
511   else
512     CFLAGS="$CFLAGS -DNO_snprintf"
513     SFLAGS="$SFLAGS -DNO_snprintf"
514     echo "Checking for snprintf() in stdio.h... No."
515     echo "  WARNING: snprintf() not found, falling back to sprintf(). zlib"
516     echo "  can build but will be open to possible buffer-overflow security"
517     echo "  vulnerabilities."
518
519     cat >$test.c <<EOF
520 #include <stdio.h>
521
522 int mytest()
523 {
524   char buf[20];
525
526   return sprintf(buf, "%s", "foo");
527 }
528
529 int main()
530 {
531   return (mytest());
532 }
533 EOF
534
535     if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
536       echo "Checking for return value of sprintf()... Yes."
537     else
538       CFLAGS="$CFLAGS -DHAS_sprintf_void"
539       SFLAGS="$SFLAGS -DHAS_sprintf_void"
540       echo "Checking for return value of sprintf()... No."
541       echo "  WARNING: apparently sprintf() does not return a value. zlib"
542       echo "  can build but will be open to possible string-format security"
543       echo "  vulnerabilities."
544     fi
545   fi
546 fi
547
548 if test "$gcc" -eq 1; then
549   cat > $test.c <<EOF
550 #if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33)
551 #  define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
552 #else
553 #  define ZLIB_INTERNAL
554 #endif
555 int ZLIB_INTERNAL foo;
556 int main()
557 {
558   return 0;
559 }
560 EOF
561   if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
562     echo "Checking for attribute(visibility) support... Yes."
563   else
564     CFLAGS="$CFLAGS -DNO_VIZ"
565     SFLAGS="$SFLAGS -DNO_VIZ"
566     echo "Checking for attribute(visibility) support... No."
567   fi
568 fi
569
570 CPP=${CPP-"$CC -E"}
571 case $CFLAGS in
572   *ASMV*)
573     if test "`$NM $test.o | grep _hello`" = ""; then
574       CPP="$CPP -DNO_UNDERLINE"
575       echo Checking for underline in external names... No.
576     else
577       echo Checking for underline in external names... Yes.
578     fi ;;
579 esac
580
581 rm -f $test.[co] $test $test$shared_ext
582
583 # udpate Makefile
584 sed < Makefile.in "
585 /^CC *=/s#=.*#=$CC#
586 /^CFLAGS *=/s#=.*#=$CFLAGS#
587 /^SFLAGS *=/s#=.*#=$SFLAGS#
588 /^LDFLAGS *=/s#=.*#=$LDFLAGS#
589 /^LDSHARED *=/s#=.*#=$LDSHARED#
590 /^CPP *=/s#=.*#=$CPP#
591 /^STATICLIB *=/s#=.*#=$STATICLIB#
592 /^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
593 /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
594 /^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
595 /^AR *=/s#=.*#=$AR_RC#
596 /^RANLIB *=/s#=.*#=$RANLIB#
597 /^LDCONFIG *=/s#=.*#=$LDCONFIG#
598 /^LDSHAREDLIBC *=/s#=.*#=$LDSHAREDLIBC#
599 /^EXE *=/s#=.*#=$EXE#
600 /^prefix *=/s#=.*#=$prefix#
601 /^exec_prefix *=/s#=.*#=$exec_prefix#
602 /^libdir *=/s#=.*#=$libdir#
603 /^sharedlibdir *=/s#=.*#=$sharedlibdir#
604 /^includedir *=/s#=.*#=$includedir#
605 /^mandir *=/s#=.*#=$mandir#
606 /^OBJC *=/s#=.*#= $OBJC#
607 /^PIC_OBJC *=/s#=.*#= $PIC_OBJC#
608 /^all: */s#:.*#: $ALL#
609 /^test: */s#:.*#: $TEST#
610 " > Makefile
611
612 sed < zlib.pc.in "
613 /^CC *=/s#=.*#=$CC#
614 /^CFLAGS *=/s#=.*#=$CFLAGS#
615 /^CPP *=/s#=.*#=$CPP#
616 /^LDSHARED *=/s#=.*#=$LDSHARED#
617 /^STATICLIB *=/s#=.*#=$STATICLIB#
618 /^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
619 /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
620 /^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
621 /^AR *=/s#=.*#=$AR_RC#
622 /^RANLIB *=/s#=.*#=$RANLIB#
623 /^EXE *=/s#=.*#=$EXE#
624 /^prefix *=/s#=.*#=$prefix#
625 /^exec_prefix *=/s#=.*#=$exec_prefix#
626 /^libdir *=/s#=.*#=$libdir#
627 /^sharedlibdir *=/s#=.*#=$sharedlibdir#
628 /^includedir *=/s#=.*#=$includedir#
629 /^mandir *=/s#=.*#=$mandir#
630 /^LDFLAGS *=/s#=.*#=$LDFLAGS#
631 " | sed -e "
632 s/\@VERSION\@/$VER/g;
633 " > zlib.pc