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