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