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
case `$cc -v 2>&1` in
  *gcc*) gcc=1 ;;
M
Mark Adler 已提交
178
  *clang*) gcc=1 ;;
M
Mark Adler 已提交
179
esac
M
Mark Adler 已提交
180

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

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

352 353
echo >> configure.log

354 355 356 357 358 359 360 361 362 363 364 365 366
# 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 已提交
367 368 369 370 371 372 373 374 375 376
  try()
  {
    show $*
    ( $* ) >> configure.log 2>&1
    ret=$?
    if test $ret -ne 0; then
      echo "(exit code "$ret")" >> configure.log
    fi
    return $ret
  }
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394
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 已提交
395 396 397
if try $CC -c $CFLAGS $test.c; then
  :
else
398 399 400 401 402 403
  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 已提交
404
# see if shared library build supported
405 406 407 408
cat > $test.c <<EOF
extern int getchar();
int hello() {return getchar();}
EOF
M
Mark Adler 已提交
409
if test $shared -eq 1; then
410
  echo Checking for shared library support... | tee -a configure.log
M
Mark Adler 已提交
411
  # we must test in two steps (cc then ld), required at least on SunOS 4.x
412 413
  if try $CC -w -c $SFLAGS $test.c &&
     try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then
414
    echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log
M
Mark Adler 已提交
415
  elif test -z "$old_cc" -a -z "$old_cflags"; then
416
    echo No shared library support. | tee -a configure.log
M
Mark Adler 已提交
417
    shared=0;
M
Mark Adler 已提交
418
  else
419
    echo 'No shared library support; try without defining CC and CFLAGS' | tee -a configure.log
M
Mark Adler 已提交
420
    shared=0;
M
Mark Adler 已提交
421 422 423
  fi
fi
if test $shared -eq 0; then
M
Mark Adler 已提交
424
  LDSHARED="$CC"
M
Mark Adler 已提交
425 426
  ALL="static"
  TEST="all teststatic"
M
Mark Adler 已提交
427 428 429
  SHAREDLIB=""
  SHAREDLIBV=""
  SHAREDLIBM=""
430
  echo Building static library $STATICLIB version $VER with $CC. | tee -a configure.log
M
Mark Adler 已提交
431
else
M
Mark Adler 已提交
432 433
  ALL="static shared"
  TEST="all teststatic testshared"
M
Mark Adler 已提交
434 435
fi

M
Mark Adler 已提交
436
# check for underscores in external names for use by assembler code
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451
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 已提交
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
# 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");
495
    else puts("z_longlong");
M
Mark Adler 已提交
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 530
    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 已提交
531
# check for large file support, and if none, check for fseeko()
M
Mark Adler 已提交
532 533 534 535
cat > $test.c <<EOF
#include <sys/types.h>
off64_t dummy = 0;
EOF
536
if try $CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c; then
M
Mark Adler 已提交
537 538
  CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1"
  SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1"
M
Mark Adler 已提交
539 540
  ALL="${ALL} all64"
  TEST="${TEST} test64"
541 542
  echo "Checking for off64_t... Yes." | tee -a configure.log
  echo "Checking for fseeko... Yes." | tee -a configure.log
M
Mark Adler 已提交
543
else
544 545
  echo "Checking for off64_t... No." | tee -a configure.log
  echo >> configure.log
M
Mark Adler 已提交
546 547 548 549 550 551 552
  cat > $test.c <<EOF
#include <stdio.h>
int main(void) {
  fseeko(NULL, 0, 0);
  return 0;
}
EOF
553
  if try $CC $CFLAGS -o $test $test.c; then
554
    echo "Checking for fseeko... Yes." | tee -a configure.log
M
Mark Adler 已提交
555 556 557
  else
    CFLAGS="${CFLAGS} -DNO_FSEEKO"
    SFLAGS="${SFLAGS} -DNO_FSEEKO"
558
    echo "Checking for fseeko... No." | tee -a configure.log
M
Mark Adler 已提交
559
  fi
M
Mark Adler 已提交
560
fi
M
Mark Adler 已提交
561

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

M
Mark Adler 已提交
564
# check for strerror() for use by gz* functions
M
Mark Adler 已提交
565 566 567 568 569 570 571 572 573 574 575 576 577
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 已提交
578
# copy clean zconf.h for subsequent edits
579
cp -p ${SRCDIR}zconf.h.in zconf.h
M
Mark Adler 已提交
580

581 582
echo >> configure.log

M
Mark Adler 已提交
583
# check for unistd.h and save result in zconf.h
M
Mark Adler 已提交
584 585 586 587
cat > $test.c <<EOF
#include <unistd.h>
int main() { return 0; }
EOF
588
if try $CC -c $CFLAGS $test.c; then
M
Mark Adler 已提交
589
  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 已提交
590
  mv zconf.temp.h zconf.h
591
  echo "Checking for unistd.h... Yes." | tee -a configure.log
M
Mark Adler 已提交
592
else
593
  echo "Checking for unistd.h... No." | tee -a configure.log
M
Mark Adler 已提交
594 595
fi

596 597
echo >> configure.log

M
Mark Adler 已提交
598
# check for stdarg.h and save result in zconf.h
M
Mark Adler 已提交
599 600 601 602
cat > $test.c <<EOF
#include <stdarg.h>
int main() { return 0; }
EOF
603
if try $CC -c $CFLAGS $test.c; then
M
Mark Adler 已提交
604 605
  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
606
  echo "Checking for stdarg.h... Yes." | tee -a configure.log
M
Mark Adler 已提交
607
else
608
  echo "Checking for stdarg.h... No." | tee -a configure.log
M
Mark Adler 已提交
609 610
fi

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

M
Mark Adler 已提交
619
# if --solo compilation was requested, save that in zconf.h and remove gz stuff from object lists
620 621 622 623 624 625 626 627 628 629
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 已提交
630
# if code coverage testing was requested, use older gcc if defined, e.g. "gcc-4.2" on Mac OS X
631 632
if test $cover -eq 1; then
  CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage"
633 634 635
  if test -n "$GCC_CLASSIC"; then
    CC=$GCC_CLASSIC
  fi
636 637
fi

638 639
echo >> configure.log

M
Mark Adler 已提交
640 641 642 643
# 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 已提交
644
cat > $test.c <<EOF
M
Mark Adler 已提交
645
#include <stdio.h>
M
Mark Adler 已提交
646 647
#include <stdarg.h>
#include "zconf.h"
M
Mark Adler 已提交
648
int main()
M
Mark Adler 已提交
649 650 651 652 653 654 655
{
#ifndef STDC
  choke me
#endif
  return 0;
}
EOF
656
if try $CC -c $CFLAGS $test.c; then
657
  echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()." | tee -a configure.log
M
Mark Adler 已提交
658

659
  echo >> configure.log
M
Mark Adler 已提交
660 661 662
  cat > $test.c <<EOF
#include <stdio.h>
#include <stdarg.h>
M
Mark Adler 已提交
663
int mytest(const char *fmt, ...)
M
Mark Adler 已提交
664 665 666 667 668 669 670 671 672 673 674 675 676
{
  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
677
  if try $CC $CFLAGS -o $test $test.c; then
678
    echo "Checking for vsnprintf() in stdio.h... Yes." | tee -a configure.log
M
Mark Adler 已提交
679

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

700
    if try $CC -c $CFLAGS $test.c; then
701
      echo "Checking for return value of vsnprintf()... Yes." | tee -a configure.log
M
Mark Adler 已提交
702 703
    else
      CFLAGS="$CFLAGS -DHAS_vsnprintf_void"
M
Mark Adler 已提交
704
      SFLAGS="$SFLAGS -DHAS_vsnprintf_void"
705 706 707 708
      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 已提交
709 710 711
    fi
  else
    CFLAGS="$CFLAGS -DNO_vsnprintf"
M
Mark Adler 已提交
712
    SFLAGS="$SFLAGS -DNO_vsnprintf"
713 714 715 716
    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 已提交
717

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

738
    if try $CC -c $CFLAGS $test.c; then
739
      echo "Checking for return value of vsprintf()... Yes." | tee -a configure.log
M
Mark Adler 已提交
740 741
    else
      CFLAGS="$CFLAGS -DHAS_vsprintf_void"
M
Mark Adler 已提交
742
      SFLAGS="$SFLAGS -DHAS_vsprintf_void"
743 744 745 746
      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 已提交
747 748 749
    fi
  fi
else
750
  echo "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()." | tee -a configure.log
M
Mark Adler 已提交
751

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

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

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

784
    if try $CC -c $CFLAGS $test.c; then
785
      echo "Checking for return value of snprintf()... Yes." | tee -a configure.log
M
Mark Adler 已提交
786 787
    else
      CFLAGS="$CFLAGS -DHAS_snprintf_void"
M
Mark Adler 已提交
788
      SFLAGS="$SFLAGS -DHAS_snprintf_void"
789 790 791 792
      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 已提交
793 794 795
    fi
  else
    CFLAGS="$CFLAGS -DNO_snprintf"
M
Mark Adler 已提交
796
    SFLAGS="$SFLAGS -DNO_snprintf"
797 798 799 800
    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 已提交
801

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

816
    if try $CC -c $CFLAGS $test.c; then
817
      echo "Checking for return value of sprintf()... Yes." | tee -a configure.log
M
Mark Adler 已提交
818 819
    else
      CFLAGS="$CFLAGS -DHAS_sprintf_void"
M
Mark Adler 已提交
820
      SFLAGS="$SFLAGS -DHAS_sprintf_void"
821 822 823 824
      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 已提交
825 826 827 828
    fi
  fi
fi

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

849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871
# 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
872
echo Z_U4 = $Z_U4 >> configure.log
873
echo SRCDIR = $SRCDIR >> configure.log
874 875 876 877 878 879 880 881
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 已提交
882
# udpate Makefile with the configure results
883
sed < ${SRCDIR}Makefile.in "
M
Mark Adler 已提交
884 885
/^CC *=/s#=.*#=$CC#
/^CFLAGS *=/s#=.*#=$CFLAGS#
M
Mark Adler 已提交
886
/^SFLAGS *=/s#=.*#=$SFLAGS#
M
Mark Adler 已提交
887
/^LDFLAGS *=/s#=.*#=$LDFLAGS#
M
Mark Adler 已提交
888
/^LDSHARED *=/s#=.*#=$LDSHARED#
M
Mark Adler 已提交
889
/^CPP *=/s#=.*#=$CPP#
M
Mark Adler 已提交
890
/^STATICLIB *=/s#=.*#=$STATICLIB#
M
Mark Adler 已提交
891 892 893
/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
894 895
/^AR *=/s#=.*#=$AR#
/^ARFLAGS *=/s#=.*#=$ARFLAGS#
M
Mark Adler 已提交
896
/^RANLIB *=/s#=.*#=$RANLIB#
M
Mark Adler 已提交
897 898
/^LDCONFIG *=/s#=.*#=$LDCONFIG#
/^LDSHAREDLIBC *=/s#=.*#=$LDSHAREDLIBC#
M
Mark Adler 已提交
899
/^EXE *=/s#=.*#=$EXE#
900 901 902
/^SRCDIR *=/s#=.*#=$SRCDIR#
/^ZINC *=/s#=.*#=$ZINC#
/^ZINCOUT *=/s#=.*#=$ZINCOUT#
M
Mark Adler 已提交
903 904 905
/^prefix *=/s#=.*#=$prefix#
/^exec_prefix *=/s#=.*#=$exec_prefix#
/^libdir *=/s#=.*#=$libdir#
M
Mark Adler 已提交
906
/^sharedlibdir *=/s#=.*#=$sharedlibdir#
M
Mark Adler 已提交
907 908
/^includedir *=/s#=.*#=$includedir#
/^mandir *=/s#=.*#=$mandir#
909 910
/^OBJC *=/s#=.*#= $OBJC#
/^PIC_OBJC *=/s#=.*#= $PIC_OBJC#
M
Mark Adler 已提交
911 912
/^all: */s#:.*#: $ALL#
/^test: */s#:.*#: $TEST#
M
Mark Adler 已提交
913
" > Makefile
M
Mark Adler 已提交
914

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

# done
leave 0