configure 28.0 KB
Newer Older
M
Mark Adler 已提交
1
#!/bin/sh
M
Mark Adler 已提交
2
# configure script for zlib.
M
Mark Adler 已提交
3
#
M
Mark Adler 已提交
4 5
# Normally configure builds both a static and a shared library.
# If you want to build just a static library, use: ./configure --static
M
Mark Adler 已提交
6
#
M
Mark Adler 已提交
7 8 9 10 11
# To impose specific compiler or flags or install directory, use for example:
#    prefix=$HOME CC=cc CFLAGS="-O4" ./configure
# or for csh/tcsh users:
#    (setenv prefix $HOME; setenv CC cc; setenv CFLAGS "-O4"; ./configure)

M
Mark Adler 已提交
12 13 14 15
# Incorrect settings of CC or CFLAGS may prevent creating a shared library.
# If you have problems, try without defining CC and CFLAGS before reporting
# an error.

M
Mark Adler 已提交
16
# start off configure.log
17 18 19 20
echo -------------------- >> configure.log
echo $0 $* >> configure.log
date >> configure.log

21 22 23 24 25 26 27 28 29 30 31 32
# get source directory
SRCDIR=`dirname $0`
if test $SRCDIR = "."; then
    ZINC=""
    ZINCOUT="-I."
    SRCDIR=""
else
    ZINC='-include zconf.h'
    ZINCOUT='-I. -I$(SRCDIR)'
    SRCDIR="$SRCDIR/"
fi

M
Mark Adler 已提交
33
# set command prefix for cross-compilation
M
Mark Adler 已提交
34
if [ -n "${CHOST}" ]; then
M
Mark Adler 已提交
35
    uname="`echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/'`"
M
Mark Adler 已提交
36 37 38
    CROSS_PREFIX="${CHOST}-"
fi

M
Mark Adler 已提交
39
# destination name for static library
M
Mark Adler 已提交
40
STATICLIB=libz.a
M
Mark Adler 已提交
41 42

# extract zlib version numbers from zlib.h
43 44 45 46
VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}zlib.h`
VER3=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < ${SRCDIR}zlib.h`
VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h`
VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h`
M
Mark Adler 已提交
47 48

# establish commands for library building
M
Mark Adler 已提交
49
if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then
M
Mark Adler 已提交
50
    AR=${AR-"${CROSS_PREFIX}ar"}
51
    test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log
M
Mark Adler 已提交
52 53
else
    AR=${AR-"ar"}
54
    test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log
M
Mark Adler 已提交
55
fi
56
ARFLAGS=${ARFLAGS-"rc"}
M
Mark Adler 已提交
57
if "${CROSS_PREFIX}ranlib" --version >/dev/null 2>/dev/null || test $? -lt 126; then
M
Mark Adler 已提交
58
    RANLIB=${RANLIB-"${CROSS_PREFIX}ranlib"}
59
    test -n "${CROSS_PREFIX}" && echo Using ${RANLIB} | tee -a configure.log
M
Mark Adler 已提交
60 61 62
else
    RANLIB=${RANLIB-"ranlib"}
fi
M
Mark Adler 已提交
63
if "${CROSS_PREFIX}nm" --version >/dev/null 2>/dev/null || test $? -lt 126; then
M
Mark Adler 已提交
64
    NM=${NM-"${CROSS_PREFIX}nm"}
65
    test -n "${CROSS_PREFIX}" && echo Using ${NM} | tee -a configure.log
M
Mark Adler 已提交
66 67 68
else
    NM=${NM-"nm"}
fi
M
Mark Adler 已提交
69 70

# set defaults before processing command line options
M
Mark Adler 已提交
71
LDCONFIG=${LDCONFIG-"ldconfig"}
M
Mark Adler 已提交
72
LDSHAREDLIBC="${LDSHAREDLIBC--lc}"
M
Mark Adler 已提交
73
ARCHS=
M
Mark Adler 已提交
74
prefix=${prefix-/usr/local}
M
Mark Adler 已提交
75 76
exec_prefix=${exec_prefix-'${prefix}'}
libdir=${libdir-'${exec_prefix}/lib'}
M
Mark Adler 已提交
77
sharedlibdir=${sharedlibdir-'${libdir}'}
M
Mark Adler 已提交
78
includedir=${includedir-'${prefix}/include'}
M
Mark Adler 已提交
79
mandir=${mandir-'${prefix}/share/man'}
M
Mark Adler 已提交
80
shared_ext='.so'
M
Mark Adler 已提交
81
shared=1
82
solo=0
83
cover=0
M
Mark Adler 已提交
84
zprefix=0
85
zconst=0
M
Mark Adler 已提交
86
build64=0
M
Mark Adler 已提交
87
gcc=0
88
warn=0
89
debug=0
M
Mark Adler 已提交
90 91
old_cc="$CC"
old_cflags="$CFLAGS"
92 93
OBJC='$(OBJZ) $(OBJG)'
PIC_OBJC='$(PIC_OBJZ) $(PIC_OBJG)'
M
Mark Adler 已提交
94

95 96 97 98 99 100 101 102 103 104 105 106 107
# leave this script, optionally in a bad way
leave()
{
  if test "$*" != "0"; then
    echo "** $0 aborting." | tee -a configure.log
  fi
  rm -f $test.[co] $test $test$shared_ext $test.gcno ./--version
  echo -------------------- >> configure.log
  echo >> configure.log
  echo >> configure.log
  exit $1
}

M
Mark Adler 已提交
108
# process command line options
M
Mark Adler 已提交
109 110
while test $# -ge 1
do
M
Mark Adler 已提交
111
case "$1" in
M
Mark Adler 已提交
112
    -h* | --help)
113
      echo 'usage:' | tee -a configure.log
114
      echo '  configure [--const] [--zprefix] [--prefix=PREFIX]  [--eprefix=EXPREFIX]' | tee -a configure.log
115 116
      echo '    [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log
      echo '    [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log
M
Mark Adler 已提交
117
        exit 0 ;;
M
Mark Adler 已提交
118 119 120
    -p*=* | --prefix=*) prefix=`echo $1 | sed 's/.*=//'`; shift ;;
    -e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/.*=//'`; shift ;;
    -l*=* | --libdir=*) libdir=`echo $1 | sed 's/.*=//'`; shift ;;
M
Mark Adler 已提交
121
    --sharedlibdir=*) sharedlibdir=`echo $1 | sed 's/.*=//'`; shift ;;
M
Mark Adler 已提交
122 123
    -i*=* | --includedir=*) includedir=`echo $1 | sed 's/.*=//'`;shift ;;
    -u*=* | --uname=*) uname=`echo $1 | sed 's/.*=//'`;shift ;;
M
Mark Adler 已提交
124 125 126 127 128 129
    -p* | --prefix) prefix="$2"; shift; shift ;;
    -e* | --eprefix) exec_prefix="$2"; shift; shift ;;
    -l* | --libdir) libdir="$2"; shift; shift ;;
    -i* | --includedir) includedir="$2"; shift; shift ;;
    -s* | --shared | --enable-shared) shared=1; shift ;;
    -t | --static) shared=0; shift ;;
130
    --solo) solo=1; shift ;;
131
    --cover) cover=1; shift ;;
M
Mark Adler 已提交
132
    -z* | --zprefix) zprefix=1; shift ;;
M
Mark Adler 已提交
133
    -6* | --64) build64=1; shift ;;
M
Mark Adler 已提交
134
    -a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;;
135 136
    --sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;;
    --localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;;
137
    -c* | --const) zconst=1; shift ;;
138
    -w* | --warn) warn=1; shift ;;
139
    -d* | --debug) debug=1; shift ;;
140 141 142 143
    *)
      echo "unknown option: $1" | tee -a configure.log
      echo "$0 --help for help" | tee -a configure.log
      leave 1;;
M
Mark Adler 已提交
144 145
    esac
done
M
Mark Adler 已提交
146

147
# temporary file name
M
Mark Adler 已提交
148
test=ztest$$
149

150
# put arguments in log, also put test file in log if used in arguments
151 152 153 154 155 156 157 158 159 160 161
show()
{
  case "$*" in
    *$test.c*)
      echo === $test.c === >> configure.log
      cat $test.c >> configure.log
      echo === >> configure.log;;
  esac
  echo $* >> configure.log
}

M
Mark Adler 已提交
162
# check for gcc vs. cc and set compile and link flags based on the system identified by uname
M
Mark Adler 已提交
163
cat > $test.c <<EOF
M
Mark Adler 已提交
164 165
extern int getchar();
int hello() {return getchar();}
M
Mark Adler 已提交
166
EOF
M
Mark Adler 已提交
167

168
test -z "$CC" && echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log
M
Mark Adler 已提交
169
cc=${CC-${CROSS_PREFIX}gcc}
M
Mark Adler 已提交
170
cflags=${CFLAGS-"-O3"}
M
Mark Adler 已提交
171
# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
M
Mark Adler 已提交
172
case "$cc" in
M
Mark Adler 已提交
173
  *gcc*) gcc=1 ;;
M
Mark Adler 已提交
174
  *clang*) gcc=1 ;;
M
Mark Adler 已提交
175
esac
M
Mark Adler 已提交
176 177 178
case `$cc -v 2>&1` in
  *gcc*) gcc=1 ;;
esac
M
Mark Adler 已提交
179

180 181
show $cc -c $test.c
if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then
182
  echo ... using gcc >> configure.log
M
Mark Adler 已提交
183
  CC="$cc"
M
Mark Adler 已提交
184
  CFLAGS="${CFLAGS--O3}"
M
Mark Adler 已提交
185
  SFLAGS="${CFLAGS--O3} -fPIC"
M
Mark Adler 已提交
186 187 188 189
  if test "$ARCHS"; then
    CFLAGS="${CFLAGS} ${ARCHS}"
    LDFLAGS="${LDFLAGS} ${ARCHS}"
  fi
M
Mark Adler 已提交
190 191 192 193
  if test $build64 -eq 1; then
    CFLAGS="${CFLAGS} -m64"
    SFLAGS="${SFLAGS} -m64"
  fi
194
  if test "$warn" -eq 1; then
195 196 197 198 199
    if test "$zconst" -eq 1; then
      CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -pedantic -DZLIB_CONST"
    else
      CFLAGS="${CFLAGS} -Wall -Wextra -pedantic"
    fi
M
Mark Adler 已提交
200
  fi
201 202 203 204
  if test $debug -eq 1; then
    CFLAGS="${CFLAGS} -DZLIB_DEBUG"
    SFLAGS="${SFLAGS} -DZLIB_DEBUG"
  fi
M
Mark Adler 已提交
205
  if test -z "$uname"; then
M
Mark Adler 已提交
206 207 208
    uname=`(uname -s || echo unknown) 2>/dev/null`
  fi
  case "$uname" in
209
  Linux* | linux* | GNU | GNU/* | solaris*)
210
        LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"} ;;
211
  *BSD | *bsd* | DragonFly)
212
        LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"}
213
        LDCONFIG="ldconfig -m" ;;
M
Mark Adler 已提交
214 215
  CYGWIN* | Cygwin* | cygwin* | OS/2*)
        EXE='.exe' ;;
M
Mark Adler 已提交
216
  MINGW* | mingw*)
M
Mark Adler 已提交
217 218
# temporary bypass
        rm -f $test.[co] $test $test$shared_ext
219
        echo "Please use win32/Makefile.gcc instead." | tee -a configure.log
220
        leave 1
M
Mark Adler 已提交
221
        LDSHARED=${LDSHARED-"$cc -shared"}
M
Mark Adler 已提交
222 223
        LDSHAREDLIBC=""
        EXE='.exe' ;;
M
Mark Adler 已提交
224 225
  QNX*)  # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4
         # (alain.bonnefoy@icbt.com)
M
Mark Adler 已提交
226
                 LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"} ;;
M
Mark Adler 已提交
227 228 229 230 231
  HP-UX*)
         LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"}
         case `(uname -m || echo unknown) 2>/dev/null` in
         ia64)
                 shared_ext='.so'
M
Mark Adler 已提交
232
                 SHAREDLIB='libz.so' ;;
M
Mark Adler 已提交
233
         *)
M
Mark Adler 已提交
234
                 shared_ext='.sl'
M
Mark Adler 已提交
235 236
                 SHAREDLIB='libz.sl' ;;
         esac ;;
M
Mark Adler 已提交
237 238
  Darwin* | darwin*)
             shared_ext='.dylib'
M
Mark Adler 已提交
239 240 241
             SHAREDLIB=libz$shared_ext
             SHAREDLIBV=libz.$VER$shared_ext
             SHAREDLIBM=libz.$VER1$shared_ext
M
Mark Adler 已提交
242
             LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"}
243
             if libtool -V 2>&1 | grep Apple > /dev/null; then
244 245 246 247
                 AR="libtool"
             else
                 AR="/usr/bin/libtool"
             fi
248
             ARFLAGS="-o" ;;
M
Mark Adler 已提交
249
  *)             LDSHARED=${LDSHARED-"$cc -shared"} ;;
M
Mark Adler 已提交
250
  esac
M
Mark Adler 已提交
251 252 253
else
  # find system name and corresponding cc options
  CC=${CC-cc}
M
Mark Adler 已提交
254
  gcc=0
255
  echo ... using $CC >> configure.log
M
Mark Adler 已提交
256
  if test -z "$uname"; then
M
Mark Adler 已提交
257 258 259
    uname=`(uname -sr || echo unknown) 2>/dev/null`
  fi
  case "$uname" in
M
Mark Adler 已提交
260
  HP-UX*)    SFLAGS=${CFLAGS-"-O +z"}
M
Mark Adler 已提交
261 262 263
             CFLAGS=${CFLAGS-"-O"}
#            LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"}
             LDSHARED=${LDSHARED-"ld -b"}
M
Mark Adler 已提交
264 265 266
         case `(uname -m || echo unknown) 2>/dev/null` in
         ia64)
             shared_ext='.so'
M
Mark Adler 已提交
267
             SHAREDLIB='libz.so' ;;
M
Mark Adler 已提交
268
         *)
M
Mark Adler 已提交
269
             shared_ext='.sl'
M
Mark Adler 已提交
270 271
             SHAREDLIB='libz.sl' ;;
         esac ;;
M
Mark Adler 已提交
272
  IRIX*)     SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."}
M
Mark Adler 已提交
273
             CFLAGS=${CFLAGS-"-ansi -O2"}
M
Mark Adler 已提交
274
             LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;;
M
Mark Adler 已提交
275
  OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"}
M
Mark Adler 已提交
276
             CFLAGS=${CFLAGS-"-O -std1"}
M
Mark Adler 已提交
277 278
             LDFLAGS="${LDFLAGS} -Wl,-rpath,."
             LDSHARED=${LDSHARED-"cc -shared  -Wl,-soname,libz.so -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"} ;;
M
Mark Adler 已提交
279
  OSF1*)     SFLAGS=${CFLAGS-"-O -std1"}
M
Mark Adler 已提交
280
             CFLAGS=${CFLAGS-"-O -std1"}
M
Mark Adler 已提交
281
             LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;;
M
Mark Adler 已提交
282 283
  QNX*)      SFLAGS=${CFLAGS-"-4 -O"}
             CFLAGS=${CFLAGS-"-4 -O"}
M
Mark Adler 已提交
284
             LDSHARED=${LDSHARED-"cc"}
M
Mark Adler 已提交
285
             RANLIB=${RANLIB-"true"}
286 287
             AR="cc"
             ARFLAGS="-A" ;;
M
Mark Adler 已提交
288
  SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "}
M
Mark Adler 已提交
289
             CFLAGS=${CFLAGS-"-O3"}
M
Mark Adler 已提交
290
             LDSHARED=${LDSHARED-"cc -dy -KPIC -G"} ;;
M
Mark Adler 已提交
291
  SunOS\ 5* | solaris*)
292
         LDSHARED=${LDSHARED-"cc -G -h libz$shared_ext.$VER1"}
293
         SFLAGS=${CFLAGS-"-fast -KPIC"}
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312
         CFLAGS=${CFLAGS-"-fast"}
         if test $build64 -eq 1; then
             # old versions of SunPRO/Workshop/Studio don't support -m64,
             # but newer ones do.  Check for it.
             flag64=`$CC -flags | egrep -- '^-m64'`
             if test x"$flag64" != x"" ; then
                 CFLAGS="${CFLAGS} -m64"
                 SFLAGS="${SFLAGS} -m64"
             else
                 case `(uname -m || echo unknown) 2>/dev/null` in
                   i86*)
                     SFLAGS="$SFLAGS -xarch=amd64"
                     CFLAGS="$CFLAGS -xarch=amd64" ;;
                   *)
                     SFLAGS="$SFLAGS -xarch=v9"
                     CFLAGS="$CFLAGS -xarch=v9" ;;
                 esac
             fi
         fi
313 314 315
         if test -n "$ZINC"; then
             ZINC='-I- -I. -I$(SRCDIR)'
         fi
316
         ;;
M
Mark Adler 已提交
317
  SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"}
M
Mark Adler 已提交
318
             CFLAGS=${CFLAGS-"-O2"}
M
Mark Adler 已提交
319
             LDSHARED=${LDSHARED-"ld"} ;;
M
Mark Adler 已提交
320 321
  SunStudio\ 9*) SFLAGS=${CFLAGS-"-fast -xcode=pic32 -xtarget=ultra3 -xarch=v9b"}
             CFLAGS=${CFLAGS-"-fast -xtarget=ultra3 -xarch=v9b"}
M
Mark Adler 已提交
322
             LDSHARED=${LDSHARED-"cc -xarch=v9b"} ;;
M
Mark Adler 已提交
323 324 325
  UNIX_System_V\ 4.2.0)
             SFLAGS=${CFLAGS-"-KPIC -O"}
             CFLAGS=${CFLAGS-"-O"}
M
Mark Adler 已提交
326
             LDSHARED=${LDSHARED-"cc -G"} ;;
M
Mark Adler 已提交
327
  UNIX_SV\ 4.2MP)
M
Mark Adler 已提交
328 329
             SFLAGS=${CFLAGS-"-Kconform_pic -O"}
             CFLAGS=${CFLAGS-"-O"}
M
Mark Adler 已提交
330
             LDSHARED=${LDSHARED-"cc -G"} ;;
M
Mark Adler 已提交
331 332 333
  OpenUNIX\ 5)
             SFLAGS=${CFLAGS-"-KPIC -O"}
             CFLAGS=${CFLAGS-"-O"}
M
Mark Adler 已提交
334
             LDSHARED=${LDSHARED-"cc -G"} ;;
M
Mark Adler 已提交
335
  AIX*)  # Courtesy of dbakker@arrayasolutions.com
M
Mark Adler 已提交
336 337
             SFLAGS=${CFLAGS-"-O -qmaxmem=8192"}
             CFLAGS=${CFLAGS-"-O -qmaxmem=8192"}
M
Mark Adler 已提交
338
             LDSHARED=${LDSHARED-"xlc -G"} ;;
M
Mark Adler 已提交
339
  # send working options for other systems to zlib@gzip.org
M
Mark Adler 已提交
340
  *)         SFLAGS=${CFLAGS-"-O"}
M
Mark Adler 已提交
341
             CFLAGS=${CFLAGS-"-O"}
M
Mark Adler 已提交
342
             LDSHARED=${LDSHARED-"cc -shared"} ;;
M
Mark Adler 已提交
343 344 345
  esac
fi

M
Mark Adler 已提交
346
# destination names for shared library if not defined above
M
Mark Adler 已提交
347 348 349 350
SHAREDLIB=${SHAREDLIB-"libz$shared_ext"}
SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"}
SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"}

351 352
echo >> configure.log

353 354 355 356 357 358 359 360 361 362 363 364 365
# define functions for testing compiler and library characteristics and logging the results

cat > $test.c <<EOF
#error error
EOF
if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
  try()
  {
    show $*
    test "`( $* ) 2>&1 | tee -a configure.log`" = ""
  }
  echo - using any output from compiler to indicate an error >> configure.log
else
M
Mark Adler 已提交
366 367 368 369 370 371 372 373 374 375
  try()
  {
    show $*
    ( $* ) >> configure.log 2>&1
    ret=$?
    if test $ret -ne 0; then
      echo "(exit code "$ret")" >> configure.log
    fi
    return $ret
  }
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393
fi

tryboth()
{
  show $*
  got=`( $* ) 2>&1`
  ret=$?
  printf %s "$got" >> configure.log
  if test $ret -ne 0; then
    return $ret
  fi
  test "$got" = ""
}

cat > $test.c << EOF
int foo() { return 0; }
EOF
echo "Checking for obsessive-compulsive compiler options..." >> configure.log
M
Mark Adler 已提交
394 395 396
if try $CC -c $CFLAGS $test.c; then
  :
else
397 398 399 400 401 402
  echo "Compiler error reporting is too harsh for $0 (perhaps remove -Werror)." | tee -a configure.log
  leave 1
fi

echo >> configure.log

M
Mark Adler 已提交
403
# see if shared library build supported
404 405 406 407
cat > $test.c <<EOF
extern int getchar();
int hello() {return getchar();}
EOF
M
Mark Adler 已提交
408
if test $shared -eq 1; then
409
  echo Checking for shared library support... | tee -a configure.log
M
Mark Adler 已提交
410
  # we must test in two steps (cc then ld), required at least on SunOS 4.x
411 412
  if try $CC -w -c $SFLAGS $test.c &&
     try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then
413
    echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log
M
Mark Adler 已提交
414
  elif test -z "$old_cc" -a -z "$old_cflags"; then
415
    echo No shared library support. | tee -a configure.log
M
Mark Adler 已提交
416
    shared=0;
M
Mark Adler 已提交
417
  else
418
    echo 'No shared library support; try without defining CC and CFLAGS' | tee -a configure.log
M
Mark Adler 已提交
419
    shared=0;
M
Mark Adler 已提交
420 421 422
  fi
fi
if test $shared -eq 0; then
M
Mark Adler 已提交
423
  LDSHARED="$CC"
M
Mark Adler 已提交
424 425
  ALL="static"
  TEST="all teststatic"
M
Mark Adler 已提交
426 427 428
  SHAREDLIB=""
  SHAREDLIBV=""
  SHAREDLIBM=""
429
  echo Building static library $STATICLIB version $VER with $CC. | tee -a configure.log
M
Mark Adler 已提交
430
else
M
Mark Adler 已提交
431 432
  ALL="static shared"
  TEST="all teststatic testshared"
M
Mark Adler 已提交
433 434
fi

M
Mark Adler 已提交
435
# check for underscores in external names for use by assembler code
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450
CPP=${CPP-"$CC -E"}
case $CFLAGS in
  *ASMV*)
    echo >> configure.log
    show "$NM $test.o | grep _hello"
    if test "`$NM $test.o | grep _hello | tee -a configure.log`" = ""; then
      CPP="$CPP -DNO_UNDERLINE"
      echo Checking for underline in external names... No. | tee -a configure.log
    else
      echo Checking for underline in external names... Yes. | tee -a configure.log
    fi ;;
esac

echo >> configure.log

M
Mark Adler 已提交
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529
# check for size_t
cat > $test.c <<EOF
#include <stdio.h>
#include <stdlib.h>
size_t dummy = 0;
EOF
if try $CC -c $CFLAGS $test.c; then
  echo "Checking for size_t... Yes." | tee -a configure.log
  need_sizet=0
else
  echo "Checking for size_t... No." | tee -a configure.log
  need_sizet=1
fi

echo >> configure.log

# check for ssize_t
cat > $test.c <<EOF
#include <sys/types.h>
ssize_t dummy = 0;
EOF
if try $CC -c $CFLAGS $test.c; then
  echo "Checking for ssize_t... Yes." | tee -a configure.log
  need_ssizet=0
else
  echo "Checking for ssize_t... No." | tee -a configure.log
  need_ssizet=1
fi

echo >> configure.log

# find the size_t integer type, if needed
if test $need_sizet -eq 1 -o $need_ssizet -eq 1; then
  cat > $test.c <<EOF
long long dummy = 0;
EOF
  if try $CC -c $CFLAGS $test.c; then
    echo "Checking for long long... Yes." | tee -a configure.log
    cat > $test.c <<EOF
#include <stdio.h>
int main(void) {
    if (sizeof(void *) <= sizeof(int)) puts("int");
    else if (sizeof(void *) <= sizeof(long)) puts("long");
    else puts("long long");
    return 0;
}
EOF
  else
    echo "Checking for long long... No." | tee -a configure.log
    cat > $test.c <<EOF
#include <stdio.h>
int main(void) {
    if (sizeof(void *) <= sizeof(int)) puts("int");
    else puts("long");
    return 0;
}
EOF
  fi
  if try $CC $CFLAGS -o $test $test.c; then
    sizet=`./$test`
    echo "Checking for a pointer-size integer type..." $sizet"." | tee -a configure.log
  else
    echo "Failed to find a pointer-size integer type." | tee -a configure.log
    leave 1
  fi
fi

if test $need_sizet -eq 1; then
  CFLAGS="${CFLAGS} -DNO_SIZE_T=${sizet}"
  SFLAGS="${SFLAGS} -DNO_SIZE_T=${sizet}"
fi

if test $need_ssizet -eq 1; then
  CFLAGS="${CFLAGS} -DNO_SSIZE_T=${sizet}"
  SFLAGS="${SFLAGS} -DNO_SSIZE_T=${sizet}"
fi

echo >> configure.log

M
Mark Adler 已提交
530
# check for large file support, and if none, check for fseeko()
M
Mark Adler 已提交
531 532 533 534
cat > $test.c <<EOF
#include <sys/types.h>
off64_t dummy = 0;
EOF
535
if try $CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c; then
M
Mark Adler 已提交
536 537
  CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1"
  SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1"
M
Mark Adler 已提交
538 539
  ALL="${ALL} all64"
  TEST="${TEST} test64"
540 541
  echo "Checking for off64_t... Yes." | tee -a configure.log
  echo "Checking for fseeko... Yes." | tee -a configure.log
M
Mark Adler 已提交
542
else
543 544
  echo "Checking for off64_t... No." | tee -a configure.log
  echo >> configure.log
M
Mark Adler 已提交
545 546 547 548 549 550 551
  cat > $test.c <<EOF
#include <stdio.h>
int main(void) {
  fseeko(NULL, 0, 0);
  return 0;
}
EOF
552
  if try $CC $CFLAGS -o $test $test.c; then
553
    echo "Checking for fseeko... Yes." | tee -a configure.log
M
Mark Adler 已提交
554 555 556
  else
    CFLAGS="${CFLAGS} -DNO_FSEEKO"
    SFLAGS="${SFLAGS} -DNO_FSEEKO"
557
    echo "Checking for fseeko... No." | tee -a configure.log
M
Mark Adler 已提交
558
  fi
M
Mark Adler 已提交
559
fi
M
Mark Adler 已提交
560

M
Mark Adler 已提交
561 562
echo >> configure.log

M
Mark Adler 已提交
563
# check for strerror() for use by gz* functions
M
Mark Adler 已提交
564 565 566 567 568 569 570 571 572 573 574 575 576
cat > $test.c <<EOF
#include <string.h>
#include <errno.h>
int main() { return strlen(strerror(errno)); }
EOF
if try $CC $CFLAGS -o $test $test.c; then
  echo "Checking for strerror... Yes." | tee -a configure.log
else
  CFLAGS="${CFLAGS} -DNO_STRERROR"
  SFLAGS="${SFLAGS} -DNO_STRERROR"
  echo "Checking for strerror... No." | tee -a configure.log
fi

M
Mark Adler 已提交
577
# copy clean zconf.h for subsequent edits
578
cp -p ${SRCDIR}zconf.h.in zconf.h
M
Mark Adler 已提交
579

580 581
echo >> configure.log

M
Mark Adler 已提交
582
# check for unistd.h and save result in zconf.h
M
Mark Adler 已提交
583 584 585 586
cat > $test.c <<EOF
#include <unistd.h>
int main() { return 0; }
EOF
587
if try $CC -c $CFLAGS $test.c; then
M
Mark Adler 已提交
588
  sed < zconf.h "/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
M
Mark Adler 已提交
589
  mv zconf.temp.h zconf.h
590
  echo "Checking for unistd.h... Yes." | tee -a configure.log
M
Mark Adler 已提交
591
else
592
  echo "Checking for unistd.h... No." | tee -a configure.log
M
Mark Adler 已提交
593 594
fi

595 596
echo >> configure.log

M
Mark Adler 已提交
597
# check for stdarg.h and save result in zconf.h
M
Mark Adler 已提交
598 599 600 601
cat > $test.c <<EOF
#include <stdarg.h>
int main() { return 0; }
EOF
602
if try $CC -c $CFLAGS $test.c; then
M
Mark Adler 已提交
603 604
  sed < zconf.h "/^#ifdef HAVE_STDARG_H.* may be/s/def HAVE_STDARG_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
  mv zconf.temp.h zconf.h
605
  echo "Checking for stdarg.h... Yes." | tee -a configure.log
M
Mark Adler 已提交
606
else
607
  echo "Checking for stdarg.h... No." | tee -a configure.log
M
Mark Adler 已提交
608 609
fi

M
Mark Adler 已提交
610
# if the z_ prefix was requested, save that in zconf.h
M
Mark Adler 已提交
611
if test $zprefix -eq 1; then
M
Mark Adler 已提交
612
  sed < zconf.h "/#ifdef Z_PREFIX.* may be/s/def Z_PREFIX\(.*\) may be/ 1\1 was/" > zconf.temp.h
M
Mark Adler 已提交
613
  mv zconf.temp.h zconf.h
614 615
  echo >> configure.log
  echo "Using z_ prefix on all symbols." | tee -a configure.log
M
Mark Adler 已提交
616 617
fi

M
Mark Adler 已提交
618
# if --solo compilation was requested, save that in zconf.h and remove gz stuff from object lists
619 620 621 622 623 624 625 626 627 628
if test $solo -eq 1; then
  sed '/#define ZCONF_H/a\
#define Z_SOLO

' < zconf.h > zconf.temp.h
  mv zconf.temp.h zconf.h
OBJC='$(OBJZ)'
PIC_OBJC='$(PIC_OBJZ)'
fi

M
Mark Adler 已提交
629
# if code coverage testing was requested, use older gcc if defined, e.g. "gcc-4.2" on Mac OS X
630 631
if test $cover -eq 1; then
  CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage"
632 633 634
  if test -n "$GCC_CLASSIC"; then
    CC=$GCC_CLASSIC
  fi
635 636
fi

637 638
echo >> configure.log

M
Mark Adler 已提交
639 640 641 642
# conduct a series of tests to resolve eight possible cases of using "vs" or "s" printf functions
# (using stdarg or not), with or without "n" (proving size of buffer), and with or without a
# return value.  The most secure result is vsnprintf() with a return value.  snprintf() with a
# return value is secure as well, but then gzprintf() will be limited to 20 arguments.
M
Mark Adler 已提交
643
cat > $test.c <<EOF
M
Mark Adler 已提交
644
#include <stdio.h>
M
Mark Adler 已提交
645 646
#include <stdarg.h>
#include "zconf.h"
M
Mark Adler 已提交
647
int main()
M
Mark Adler 已提交
648 649 650 651 652 653 654
{
#ifndef STDC
  choke me
#endif
  return 0;
}
EOF
655
if try $CC -c $CFLAGS $test.c; then
656
  echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()." | tee -a configure.log
M
Mark Adler 已提交
657

658
  echo >> configure.log
M
Mark Adler 已提交
659 660 661
  cat > $test.c <<EOF
#include <stdio.h>
#include <stdarg.h>
M
Mark Adler 已提交
662
int mytest(const char *fmt, ...)
M
Mark Adler 已提交
663 664 665 666 667 668 669 670 671 672 673 674 675
{
  char buf[20];
  va_list ap;
  va_start(ap, fmt);
  vsnprintf(buf, sizeof(buf), fmt, ap);
  va_end(ap);
  return 0;
}
int main()
{
  return (mytest("Hello%d\n", 1));
}
EOF
676
  if try $CC $CFLAGS -o $test $test.c; then
677
    echo "Checking for vsnprintf() in stdio.h... Yes." | tee -a configure.log
M
Mark Adler 已提交
678

679
    echo >> configure.log
M
Mark Adler 已提交
680 681 682
    cat >$test.c <<EOF
#include <stdio.h>
#include <stdarg.h>
M
Mark Adler 已提交
683
int mytest(const char *fmt, ...)
M
Mark Adler 已提交
684
{
M
Mark Adler 已提交
685
  int n;
M
Mark Adler 已提交
686 687 688
  char buf[20];
  va_list ap;
  va_start(ap, fmt);
M
Mark Adler 已提交
689
  n = vsnprintf(buf, sizeof(buf), fmt, ap);
M
Mark Adler 已提交
690
  va_end(ap);
M
Mark Adler 已提交
691
  return n;
M
Mark Adler 已提交
692 693 694 695 696 697 698
}
int main()
{
  return (mytest("Hello%d\n", 1));
}
EOF

699
    if try $CC -c $CFLAGS $test.c; then
700
      echo "Checking for return value of vsnprintf()... Yes." | tee -a configure.log
M
Mark Adler 已提交
701 702
    else
      CFLAGS="$CFLAGS -DHAS_vsnprintf_void"
M
Mark Adler 已提交
703
      SFLAGS="$SFLAGS -DHAS_vsnprintf_void"
704 705 706 707
      echo "Checking for return value of vsnprintf()... No." | tee -a configure.log
      echo "  WARNING: apparently vsnprintf() does not return a value. zlib" | tee -a configure.log
      echo "  can build but will be open to possible string-format security" | tee -a configure.log
      echo "  vulnerabilities." | tee -a configure.log
M
Mark Adler 已提交
708 709 710
    fi
  else
    CFLAGS="$CFLAGS -DNO_vsnprintf"
M
Mark Adler 已提交
711
    SFLAGS="$SFLAGS -DNO_vsnprintf"
712 713 714 715
    echo "Checking for vsnprintf() in stdio.h... No." | tee -a configure.log
    echo "  WARNING: vsnprintf() not found, falling back to vsprintf(). zlib" | tee -a configure.log
    echo "  can build but will be open to possible buffer-overflow security" | tee -a configure.log
    echo "  vulnerabilities." | tee -a configure.log
M
Mark Adler 已提交
716

717
    echo >> configure.log
M
Mark Adler 已提交
718 719 720
    cat >$test.c <<EOF
#include <stdio.h>
#include <stdarg.h>
M
Mark Adler 已提交
721
int mytest(const char *fmt, ...)
M
Mark Adler 已提交
722
{
M
Mark Adler 已提交
723
  int n;
M
Mark Adler 已提交
724 725 726
  char buf[20];
  va_list ap;
  va_start(ap, fmt);
M
Mark Adler 已提交
727
  n = vsprintf(buf, fmt, ap);
M
Mark Adler 已提交
728
  va_end(ap);
M
Mark Adler 已提交
729
  return n;
M
Mark Adler 已提交
730
}
M
Mark Adler 已提交
731
int main()
M
Mark Adler 已提交
732 733 734 735 736
{
  return (mytest("Hello%d\n", 1));
}
EOF

737
    if try $CC -c $CFLAGS $test.c; then
738
      echo "Checking for return value of vsprintf()... Yes." | tee -a configure.log
M
Mark Adler 已提交
739 740
    else
      CFLAGS="$CFLAGS -DHAS_vsprintf_void"
M
Mark Adler 已提交
741
      SFLAGS="$SFLAGS -DHAS_vsprintf_void"
742 743 744 745
      echo "Checking for return value of vsprintf()... No." | tee -a configure.log
      echo "  WARNING: apparently vsprintf() does not return a value. zlib" | tee -a configure.log
      echo "  can build but will be open to possible string-format security" | tee -a configure.log
      echo "  vulnerabilities." | tee -a configure.log
M
Mark Adler 已提交
746 747 748
    fi
  fi
else
749
  echo "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()." | tee -a configure.log
M
Mark Adler 已提交
750

751
  echo >> configure.log
M
Mark Adler 已提交
752 753
  cat >$test.c <<EOF
#include <stdio.h>
M
Mark Adler 已提交
754
int mytest()
M
Mark Adler 已提交
755 756 757 758 759
{
  char buf[20];
  snprintf(buf, sizeof(buf), "%s", "foo");
  return 0;
}
M
Mark Adler 已提交
760
int main()
M
Mark Adler 已提交
761 762 763 764 765
{
  return (mytest());
}
EOF

766
  if try $CC $CFLAGS -o $test $test.c; then
767
    echo "Checking for snprintf() in stdio.h... Yes." | tee -a configure.log
M
Mark Adler 已提交
768

769
    echo >> configure.log
M
Mark Adler 已提交
770 771
    cat >$test.c <<EOF
#include <stdio.h>
M
Mark Adler 已提交
772
int mytest()
M
Mark Adler 已提交
773 774
{
  char buf[20];
M
Mark Adler 已提交
775
  return snprintf(buf, sizeof(buf), "%s", "foo");
M
Mark Adler 已提交
776
}
M
Mark Adler 已提交
777
int main()
M
Mark Adler 已提交
778 779 780 781 782
{
  return (mytest());
}
EOF

783
    if try $CC -c $CFLAGS $test.c; then
784
      echo "Checking for return value of snprintf()... Yes." | tee -a configure.log
M
Mark Adler 已提交
785 786
    else
      CFLAGS="$CFLAGS -DHAS_snprintf_void"
M
Mark Adler 已提交
787
      SFLAGS="$SFLAGS -DHAS_snprintf_void"
788 789 790 791
      echo "Checking for return value of snprintf()... No." | tee -a configure.log
      echo "  WARNING: apparently snprintf() does not return a value. zlib" | tee -a configure.log
      echo "  can build but will be open to possible string-format security" | tee -a configure.log
      echo "  vulnerabilities." | tee -a configure.log
M
Mark Adler 已提交
792 793 794
    fi
  else
    CFLAGS="$CFLAGS -DNO_snprintf"
M
Mark Adler 已提交
795
    SFLAGS="$SFLAGS -DNO_snprintf"
796 797 798 799
    echo "Checking for snprintf() in stdio.h... No." | tee -a configure.log
    echo "  WARNING: snprintf() not found, falling back to sprintf(). zlib" | tee -a configure.log
    echo "  can build but will be open to possible buffer-overflow security" | tee -a configure.log
    echo "  vulnerabilities." | tee -a configure.log
M
Mark Adler 已提交
800

801
    echo >> configure.log
M
Mark Adler 已提交
802 803
    cat >$test.c <<EOF
#include <stdio.h>
M
Mark Adler 已提交
804
int mytest()
M
Mark Adler 已提交
805 806
{
  char buf[20];
M
Mark Adler 已提交
807
  return sprintf(buf, "%s", "foo");
M
Mark Adler 已提交
808
}
M
Mark Adler 已提交
809
int main()
M
Mark Adler 已提交
810 811 812 813 814
{
  return (mytest());
}
EOF

815
    if try $CC -c $CFLAGS $test.c; then
816
      echo "Checking for return value of sprintf()... Yes." | tee -a configure.log
M
Mark Adler 已提交
817 818
    else
      CFLAGS="$CFLAGS -DHAS_sprintf_void"
M
Mark Adler 已提交
819
      SFLAGS="$SFLAGS -DHAS_sprintf_void"
820 821 822 823
      echo "Checking for return value of sprintf()... No." | tee -a configure.log
      echo "  WARNING: apparently sprintf() does not return a value. zlib" | tee -a configure.log
      echo "  can build but will be open to possible string-format security" | tee -a configure.log
      echo "  vulnerabilities." | tee -a configure.log
M
Mark Adler 已提交
824 825 826 827
    fi
  fi
fi

M
Mark Adler 已提交
828
# see if we can hide zlib internal symbols that are linked between separate source files
M
Mark Adler 已提交
829
if test "$gcc" -eq 1; then
830
  echo >> configure.log
M
Mark Adler 已提交
831
  cat > $test.c <<EOF
832
#define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
M
Mark Adler 已提交
833
int ZLIB_INTERNAL foo;
M
Mark Adler 已提交
834 835 836 837 838
int main()
{
  return 0;
}
EOF
839
  if tryboth $CC -c $CFLAGS $test.c; then
840 841
    CFLAGS="$CFLAGS -DHAVE_HIDDEN"
    SFLAGS="$SFLAGS -DHAVE_HIDDEN"
842
    echo "Checking for attribute(visibility) support... Yes." | tee -a configure.log
M
Mark Adler 已提交
843
  else
844
    echo "Checking for attribute(visibility) support... No." | tee -a configure.log
M
Mark Adler 已提交
845
  fi
M
Mark Adler 已提交
846 847
fi

848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870
# show the results in the log
echo >> configure.log
echo ALL = $ALL >> configure.log
echo AR = $AR >> configure.log
echo ARFLAGS = $ARFLAGS >> configure.log
echo CC = $CC >> configure.log
echo CFLAGS = $CFLAGS >> configure.log
echo CPP = $CPP >> configure.log
echo EXE = $EXE >> configure.log
echo LDCONFIG = $LDCONFIG >> configure.log
echo LDFLAGS = $LDFLAGS >> configure.log
echo LDSHARED = $LDSHARED >> configure.log
echo LDSHAREDLIBC = $LDSHAREDLIBC >> configure.log
echo OBJC = $OBJC >> configure.log
echo PIC_OBJC = $PIC_OBJC >> configure.log
echo RANLIB = $RANLIB >> configure.log
echo SFLAGS = $SFLAGS >> configure.log
echo SHAREDLIB = $SHAREDLIB >> configure.log
echo SHAREDLIBM = $SHAREDLIBM >> configure.log
echo SHAREDLIBV = $SHAREDLIBV >> configure.log
echo STATICLIB = $STATICLIB >> configure.log
echo TEST = $TEST >> configure.log
echo VER = $VER >> configure.log
871
echo Z_U4 = $Z_U4 >> configure.log
872
echo SRCDIR = $SRCDIR >> configure.log
873 874 875 876 877 878 879 880
echo exec_prefix = $exec_prefix >> configure.log
echo includedir = $includedir >> configure.log
echo libdir = $libdir >> configure.log
echo mandir = $mandir >> configure.log
echo prefix = $prefix >> configure.log
echo sharedlibdir = $sharedlibdir >> configure.log
echo uname = $uname >> configure.log

M
Mark Adler 已提交
881
# udpate Makefile with the configure results
882
sed < ${SRCDIR}Makefile.in "
M
Mark Adler 已提交
883 884
/^CC *=/s#=.*#=$CC#
/^CFLAGS *=/s#=.*#=$CFLAGS#
M
Mark Adler 已提交
885
/^SFLAGS *=/s#=.*#=$SFLAGS#
M
Mark Adler 已提交
886
/^LDFLAGS *=/s#=.*#=$LDFLAGS#
M
Mark Adler 已提交
887
/^LDSHARED *=/s#=.*#=$LDSHARED#
M
Mark Adler 已提交
888
/^CPP *=/s#=.*#=$CPP#
M
Mark Adler 已提交
889
/^STATICLIB *=/s#=.*#=$STATICLIB#
M
Mark Adler 已提交
890 891 892
/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
893 894
/^AR *=/s#=.*#=$AR#
/^ARFLAGS *=/s#=.*#=$ARFLAGS#
M
Mark Adler 已提交
895
/^RANLIB *=/s#=.*#=$RANLIB#
M
Mark Adler 已提交
896 897
/^LDCONFIG *=/s#=.*#=$LDCONFIG#
/^LDSHAREDLIBC *=/s#=.*#=$LDSHAREDLIBC#
M
Mark Adler 已提交
898
/^EXE *=/s#=.*#=$EXE#
899 900 901
/^SRCDIR *=/s#=.*#=$SRCDIR#
/^ZINC *=/s#=.*#=$ZINC#
/^ZINCOUT *=/s#=.*#=$ZINCOUT#
M
Mark Adler 已提交
902 903 904
/^prefix *=/s#=.*#=$prefix#
/^exec_prefix *=/s#=.*#=$exec_prefix#
/^libdir *=/s#=.*#=$libdir#
M
Mark Adler 已提交
905
/^sharedlibdir *=/s#=.*#=$sharedlibdir#
M
Mark Adler 已提交
906 907
/^includedir *=/s#=.*#=$includedir#
/^mandir *=/s#=.*#=$mandir#
908 909
/^OBJC *=/s#=.*#= $OBJC#
/^PIC_OBJC *=/s#=.*#= $PIC_OBJC#
M
Mark Adler 已提交
910 911
/^all: */s#:.*#: $ALL#
/^test: */s#:.*#: $TEST#
M
Mark Adler 已提交
912
" > Makefile
M
Mark Adler 已提交
913

M
Mark Adler 已提交
914
# create zlib.pc with the configure results
915
sed < ${SRCDIR}zlib.pc.in "
M
Mark Adler 已提交
916 917 918 919
/^CC *=/s#=.*#=$CC#
/^CFLAGS *=/s#=.*#=$CFLAGS#
/^CPP *=/s#=.*#=$CPP#
/^LDSHARED *=/s#=.*#=$LDSHARED#
M
Mark Adler 已提交
920
/^STATICLIB *=/s#=.*#=$STATICLIB#
M
Mark Adler 已提交
921 922 923
/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
924 925
/^AR *=/s#=.*#=$AR#
/^ARFLAGS *=/s#=.*#=$ARFLAGS#
M
Mark Adler 已提交
926 927 928 929 930
/^RANLIB *=/s#=.*#=$RANLIB#
/^EXE *=/s#=.*#=$EXE#
/^prefix *=/s#=.*#=$prefix#
/^exec_prefix *=/s#=.*#=$exec_prefix#
/^libdir *=/s#=.*#=$libdir#
M
Mark Adler 已提交
931
/^sharedlibdir *=/s#=.*#=$sharedlibdir#
M
Mark Adler 已提交
932 933 934 935 936 937
/^includedir *=/s#=.*#=$includedir#
/^mandir *=/s#=.*#=$mandir#
/^LDFLAGS *=/s#=.*#=$LDFLAGS#
" | sed -e "
s/\@VERSION\@/$VER/g;
" > zlib.pc
938 939 940

# done
leave 0