configure 27.6 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
# 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

# find the size_t integer type, if needed
M
Mark Adler 已提交
469
if test $need_sizet -eq 1; then
M
Mark Adler 已提交
470 471 472 473 474 475 476 477 478 479
  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");
480
    else puts("z_longlong");
M
Mark Adler 已提交
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
    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

echo >> configure.log

M
Mark Adler 已提交
511
# check for large file support, and if none, check for fseeko()
M
Mark Adler 已提交
512 513 514 515
cat > $test.c <<EOF
#include <sys/types.h>
off64_t dummy = 0;
EOF
516
if try $CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c; then
M
Mark Adler 已提交
517 518
  CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1"
  SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1"
M
Mark Adler 已提交
519 520
  ALL="${ALL} all64"
  TEST="${TEST} test64"
521 522
  echo "Checking for off64_t... Yes." | tee -a configure.log
  echo "Checking for fseeko... Yes." | tee -a configure.log
M
Mark Adler 已提交
523
else
524 525
  echo "Checking for off64_t... No." | tee -a configure.log
  echo >> configure.log
M
Mark Adler 已提交
526 527 528 529 530 531 532
  cat > $test.c <<EOF
#include <stdio.h>
int main(void) {
  fseeko(NULL, 0, 0);
  return 0;
}
EOF
533
  if try $CC $CFLAGS -o $test $test.c; then
534
    echo "Checking for fseeko... Yes." | tee -a configure.log
M
Mark Adler 已提交
535 536 537
  else
    CFLAGS="${CFLAGS} -DNO_FSEEKO"
    SFLAGS="${SFLAGS} -DNO_FSEEKO"
538
    echo "Checking for fseeko... No." | tee -a configure.log
M
Mark Adler 已提交
539
  fi
M
Mark Adler 已提交
540
fi
M
Mark Adler 已提交
541

M
Mark Adler 已提交
542 543
echo >> configure.log

M
Mark Adler 已提交
544
# check for strerror() for use by gz* functions
M
Mark Adler 已提交
545 546 547 548 549 550 551 552 553 554 555 556 557
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 已提交
558
# copy clean zconf.h for subsequent edits
559
cp -p ${SRCDIR}zconf.h.in zconf.h
M
Mark Adler 已提交
560

561 562
echo >> configure.log

M
Mark Adler 已提交
563
# check for unistd.h and save result in zconf.h
M
Mark Adler 已提交
564 565 566 567
cat > $test.c <<EOF
#include <unistd.h>
int main() { return 0; }
EOF
568
if try $CC -c $CFLAGS $test.c; then
M
Mark Adler 已提交
569
  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 已提交
570
  mv zconf.temp.h zconf.h
571
  echo "Checking for unistd.h... Yes." | tee -a configure.log
M
Mark Adler 已提交
572
else
573
  echo "Checking for unistd.h... No." | tee -a configure.log
M
Mark Adler 已提交
574 575
fi

576 577
echo >> configure.log

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

M
Mark Adler 已提交
591
# if the z_ prefix was requested, save that in zconf.h
M
Mark Adler 已提交
592
if test $zprefix -eq 1; then
M
Mark Adler 已提交
593
  sed < zconf.h "/#ifdef Z_PREFIX.* may be/s/def Z_PREFIX\(.*\) may be/ 1\1 was/" > zconf.temp.h
M
Mark Adler 已提交
594
  mv zconf.temp.h zconf.h
595 596
  echo >> configure.log
  echo "Using z_ prefix on all symbols." | tee -a configure.log
M
Mark Adler 已提交
597 598
fi

M
Mark Adler 已提交
599
# if --solo compilation was requested, save that in zconf.h and remove gz stuff from object lists
600 601 602 603 604 605 606 607 608 609
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 已提交
610
# if code coverage testing was requested, use older gcc if defined, e.g. "gcc-4.2" on Mac OS X
611 612
if test $cover -eq 1; then
  CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage"
613 614 615
  if test -n "$GCC_CLASSIC"; then
    CC=$GCC_CLASSIC
  fi
616 617
fi

618 619
echo >> configure.log

M
Mark Adler 已提交
620 621 622 623
# 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 已提交
624
cat > $test.c <<EOF
M
Mark Adler 已提交
625
#include <stdio.h>
M
Mark Adler 已提交
626 627
#include <stdarg.h>
#include "zconf.h"
M
Mark Adler 已提交
628
int main()
M
Mark Adler 已提交
629 630 631 632 633 634 635
{
#ifndef STDC
  choke me
#endif
  return 0;
}
EOF
636
if try $CC -c $CFLAGS $test.c; then
637
  echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()." | tee -a configure.log
M
Mark Adler 已提交
638

639
  echo >> configure.log
M
Mark Adler 已提交
640 641 642
  cat > $test.c <<EOF
#include <stdio.h>
#include <stdarg.h>
M
Mark Adler 已提交
643
int mytest(const char *fmt, ...)
M
Mark Adler 已提交
644 645 646 647 648 649 650 651 652 653 654 655 656
{
  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
657
  if try $CC $CFLAGS -o $test $test.c; then
658
    echo "Checking for vsnprintf() in stdio.h... Yes." | tee -a configure.log
M
Mark Adler 已提交
659

660
    echo >> configure.log
M
Mark Adler 已提交
661 662 663
    cat >$test.c <<EOF
#include <stdio.h>
#include <stdarg.h>
M
Mark Adler 已提交
664
int mytest(const char *fmt, ...)
M
Mark Adler 已提交
665
{
M
Mark Adler 已提交
666
  int n;
M
Mark Adler 已提交
667 668 669
  char buf[20];
  va_list ap;
  va_start(ap, fmt);
M
Mark Adler 已提交
670
  n = vsnprintf(buf, sizeof(buf), fmt, ap);
M
Mark Adler 已提交
671
  va_end(ap);
M
Mark Adler 已提交
672
  return n;
M
Mark Adler 已提交
673 674 675 676 677 678 679
}
int main()
{
  return (mytest("Hello%d\n", 1));
}
EOF

680
    if try $CC -c $CFLAGS $test.c; then
681
      echo "Checking for return value of vsnprintf()... Yes." | tee -a configure.log
M
Mark Adler 已提交
682 683
    else
      CFLAGS="$CFLAGS -DHAS_vsnprintf_void"
M
Mark Adler 已提交
684
      SFLAGS="$SFLAGS -DHAS_vsnprintf_void"
685 686 687 688
      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 已提交
689 690 691
    fi
  else
    CFLAGS="$CFLAGS -DNO_vsnprintf"
M
Mark Adler 已提交
692
    SFLAGS="$SFLAGS -DNO_vsnprintf"
693 694 695 696
    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 已提交
697

698
    echo >> configure.log
M
Mark Adler 已提交
699 700 701
    cat >$test.c <<EOF
#include <stdio.h>
#include <stdarg.h>
M
Mark Adler 已提交
702
int mytest(const char *fmt, ...)
M
Mark Adler 已提交
703
{
M
Mark Adler 已提交
704
  int n;
M
Mark Adler 已提交
705 706 707
  char buf[20];
  va_list ap;
  va_start(ap, fmt);
M
Mark Adler 已提交
708
  n = vsprintf(buf, fmt, ap);
M
Mark Adler 已提交
709
  va_end(ap);
M
Mark Adler 已提交
710
  return n;
M
Mark Adler 已提交
711
}
M
Mark Adler 已提交
712
int main()
M
Mark Adler 已提交
713 714 715 716 717
{
  return (mytest("Hello%d\n", 1));
}
EOF

718
    if try $CC -c $CFLAGS $test.c; then
719
      echo "Checking for return value of vsprintf()... Yes." | tee -a configure.log
M
Mark Adler 已提交
720 721
    else
      CFLAGS="$CFLAGS -DHAS_vsprintf_void"
M
Mark Adler 已提交
722
      SFLAGS="$SFLAGS -DHAS_vsprintf_void"
723 724 725 726
      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 已提交
727 728 729
    fi
  fi
else
730
  echo "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()." | tee -a configure.log
M
Mark Adler 已提交
731

732
  echo >> configure.log
M
Mark Adler 已提交
733 734
  cat >$test.c <<EOF
#include <stdio.h>
M
Mark Adler 已提交
735
int mytest()
M
Mark Adler 已提交
736 737 738 739 740
{
  char buf[20];
  snprintf(buf, sizeof(buf), "%s", "foo");
  return 0;
}
M
Mark Adler 已提交
741
int main()
M
Mark Adler 已提交
742 743 744 745 746
{
  return (mytest());
}
EOF

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

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

764
    if try $CC -c $CFLAGS $test.c; then
765
      echo "Checking for return value of snprintf()... Yes." | tee -a configure.log
M
Mark Adler 已提交
766 767
    else
      CFLAGS="$CFLAGS -DHAS_snprintf_void"
M
Mark Adler 已提交
768
      SFLAGS="$SFLAGS -DHAS_snprintf_void"
769 770 771 772
      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 已提交
773 774 775
    fi
  else
    CFLAGS="$CFLAGS -DNO_snprintf"
M
Mark Adler 已提交
776
    SFLAGS="$SFLAGS -DNO_snprintf"
777 778 779 780
    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 已提交
781

782
    echo >> configure.log
M
Mark Adler 已提交
783 784
    cat >$test.c <<EOF
#include <stdio.h>
M
Mark Adler 已提交
785
int mytest()
M
Mark Adler 已提交
786 787
{
  char buf[20];
M
Mark Adler 已提交
788
  return sprintf(buf, "%s", "foo");
M
Mark Adler 已提交
789
}
M
Mark Adler 已提交
790
int main()
M
Mark Adler 已提交
791 792 793 794 795
{
  return (mytest());
}
EOF

796
    if try $CC -c $CFLAGS $test.c; then
797
      echo "Checking for return value of sprintf()... Yes." | tee -a configure.log
M
Mark Adler 已提交
798 799
    else
      CFLAGS="$CFLAGS -DHAS_sprintf_void"
M
Mark Adler 已提交
800
      SFLAGS="$SFLAGS -DHAS_sprintf_void"
801 802 803 804
      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 已提交
805 806 807 808
    fi
  fi
fi

M
Mark Adler 已提交
809
# see if we can hide zlib internal symbols that are linked between separate source files
M
Mark Adler 已提交
810
if test "$gcc" -eq 1; then
811
  echo >> configure.log
M
Mark Adler 已提交
812
  cat > $test.c <<EOF
813
#define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
M
Mark Adler 已提交
814
int ZLIB_INTERNAL foo;
M
Mark Adler 已提交
815 816 817 818 819
int main()
{
  return 0;
}
EOF
820
  if tryboth $CC -c $CFLAGS $test.c; then
821 822
    CFLAGS="$CFLAGS -DHAVE_HIDDEN"
    SFLAGS="$SFLAGS -DHAVE_HIDDEN"
823
    echo "Checking for attribute(visibility) support... Yes." | tee -a configure.log
M
Mark Adler 已提交
824
  else
825
    echo "Checking for attribute(visibility) support... No." | tee -a configure.log
M
Mark Adler 已提交
826
  fi
M
Mark Adler 已提交
827 828
fi

829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851
# 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
852
echo Z_U4 = $Z_U4 >> configure.log
853
echo SRCDIR = $SRCDIR >> configure.log
854 855 856 857 858 859 860 861
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 已提交
862
# udpate Makefile with the configure results
863
sed < ${SRCDIR}Makefile.in "
M
Mark Adler 已提交
864 865
/^CC *=/s#=.*#=$CC#
/^CFLAGS *=/s#=.*#=$CFLAGS#
M
Mark Adler 已提交
866
/^SFLAGS *=/s#=.*#=$SFLAGS#
M
Mark Adler 已提交
867
/^LDFLAGS *=/s#=.*#=$LDFLAGS#
M
Mark Adler 已提交
868
/^LDSHARED *=/s#=.*#=$LDSHARED#
M
Mark Adler 已提交
869
/^CPP *=/s#=.*#=$CPP#
M
Mark Adler 已提交
870
/^STATICLIB *=/s#=.*#=$STATICLIB#
M
Mark Adler 已提交
871 872 873
/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
874 875
/^AR *=/s#=.*#=$AR#
/^ARFLAGS *=/s#=.*#=$ARFLAGS#
M
Mark Adler 已提交
876
/^RANLIB *=/s#=.*#=$RANLIB#
M
Mark Adler 已提交
877 878
/^LDCONFIG *=/s#=.*#=$LDCONFIG#
/^LDSHAREDLIBC *=/s#=.*#=$LDSHAREDLIBC#
M
Mark Adler 已提交
879
/^EXE *=/s#=.*#=$EXE#
880 881 882
/^SRCDIR *=/s#=.*#=$SRCDIR#
/^ZINC *=/s#=.*#=$ZINC#
/^ZINCOUT *=/s#=.*#=$ZINCOUT#
M
Mark Adler 已提交
883 884 885
/^prefix *=/s#=.*#=$prefix#
/^exec_prefix *=/s#=.*#=$exec_prefix#
/^libdir *=/s#=.*#=$libdir#
M
Mark Adler 已提交
886
/^sharedlibdir *=/s#=.*#=$sharedlibdir#
M
Mark Adler 已提交
887 888
/^includedir *=/s#=.*#=$includedir#
/^mandir *=/s#=.*#=$mandir#
889 890
/^OBJC *=/s#=.*#= $OBJC#
/^PIC_OBJC *=/s#=.*#= $PIC_OBJC#
M
Mark Adler 已提交
891 892
/^all: */s#:.*#: $ALL#
/^test: */s#:.*#: $TEST#
M
Mark Adler 已提交
893
" > Makefile
M
Mark Adler 已提交
894

M
Mark Adler 已提交
895
# create zlib.pc with the configure results
896
sed < ${SRCDIR}zlib.pc.in "
M
Mark Adler 已提交
897 898 899 900
/^CC *=/s#=.*#=$CC#
/^CFLAGS *=/s#=.*#=$CFLAGS#
/^CPP *=/s#=.*#=$CPP#
/^LDSHARED *=/s#=.*#=$LDSHARED#
M
Mark Adler 已提交
901
/^STATICLIB *=/s#=.*#=$STATICLIB#
M
Mark Adler 已提交
902 903 904
/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
905 906
/^AR *=/s#=.*#=$AR#
/^ARFLAGS *=/s#=.*#=$ARFLAGS#
M
Mark Adler 已提交
907 908 909 910 911
/^RANLIB *=/s#=.*#=$RANLIB#
/^EXE *=/s#=.*#=$EXE#
/^prefix *=/s#=.*#=$prefix#
/^exec_prefix *=/s#=.*#=$exec_prefix#
/^libdir *=/s#=.*#=$libdir#
M
Mark Adler 已提交
912
/^sharedlibdir *=/s#=.*#=$sharedlibdir#
M
Mark Adler 已提交
913 914 915 916 917 918
/^includedir *=/s#=.*#=$includedir#
/^mandir *=/s#=.*#=$mandir#
/^LDFLAGS *=/s#=.*#=$LDFLAGS#
" | sed -e "
s/\@VERSION\@/$VER/g;
" > zlib.pc
919 920 921

# done
leave 0