| 1 | #!/bin/shscip-shell filesystem . . `/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 | # start off configure.log |
| 17 | echoscip-shell system . . echo. -------------------- >> configure.log |
| 18 | echoscip-shell system . . echo. $0 $* >> configure.log |
| 19 | datescip-shell system . . date. >> configure.log |
| 20 | |
| 21 | # get source directory |
| 22 | SRCDIR=`dirnamescip-shell system . . dirname. $0` |
| 23 | if testscip-shell system . . test. $SRCDIR = "."; then |
| 24 | ZINC="" |
| 25 | ZINCOUT="-I." |
| 26 | SRCDIR="" |
| 27 | else |
| 28 | ZINC='-include zconf.h' |
| 29 | ZINCOUT='-I. -I$(SRCDIR)' |
| 30 | SRCDIR="$SRCDIR/" |
| 31 | fi |
| 32 | |
| 33 | # set command prefix for cross-compilation |
| 34 | if [scip-shell system . . `[`. -n "${CHOST}" ]; then |
| 35 | uname="`echoscip-shell system . . echo. "${CHOST}" | sedscip-shell system . . sed. -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/'`" |
| 36 | CROSS_PREFIX="${CHOST}-" |
| 37 | fi |
| 38 | |
| 39 | # destination name for static library |
| 40 | STATICLIB=libz.a |
| 41 | |
| 42 | # extract zlib version numbers from zlib.h |
| 43 | VER=`sedscip-shell system . . sed. -n -e '/VERSION "/s/.*"\(.*\)".*/\1/pscip-shell filesystem . . `/VERSION "/s/.*"\(.*\)".*/\1/p`.' < ${SRCDIR}zlib.h` |
| 44 | VER3=`sedscip-shell system . . sed. -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/pscip-shell filesystem . . `/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p`.' < ${SRCDIR}zlib.h` |
| 45 | VER2=`sedscip-shell system . . sed. -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/pscip-shell filesystem . . `/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p`.' < ${SRCDIR}zlib.h` |
| 46 | VER1=`sedscip-shell system . . sed. -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/pscip-shell filesystem . . `/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p`.' < ${SRCDIR}zlib.h` |
| 47 | |
| 48 | # establish commands for library building |
| 49 | if "${CROSS_PREFIX}ar" --version >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`. || testscip-shell system . . test. $? -lt 126; then |
| 50 | AR=${AR-"${CROSS_PREFIX}ar"} |
| 51 | testscip-shell system . . test. -n "${CROSS_PREFIX}" && echoscip-shell system . . echo. Using ${AR} | teescip-shell system . . tee. -a configure.log |
| 52 | else |
| 53 | AR=${AR-"ar"} |
| 54 | testscip-shell system . . test. -n "${CROSS_PREFIX}" && echoscip-shell system . . echo. Using ${AR} | teescip-shell system . . tee. -a configure.log |
| 55 | fi |
| 56 | ARFLAGS=${ARFLAGS-"rc"} |
| 57 | if "${CROSS_PREFIX}ranlib" --version >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`. || testscip-shell system . . test. $? -lt 126; then |
| 58 | RANLIB=${RANLIB-"${CROSS_PREFIX}ranlib"} |
| 59 | testscip-shell system . . test. -n "${CROSS_PREFIX}" && echoscip-shell system . . echo. Using ${RANLIB} | teescip-shell system . . tee. -a configure.log |
| 60 | else |
| 61 | RANLIB=${RANLIB-"ranlib"} |
| 62 | fi |
| 63 | if "${CROSS_PREFIX}nm" --version >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`. || testscip-shell system . . test. $? -lt 126; then |
| 64 | NM=${NM-"${CROSS_PREFIX}nm"} |
| 65 | testscip-shell system . . test. -n "${CROSS_PREFIX}" && echoscip-shell system . . echo. Using ${NM} | teescip-shell system . . tee. -a configure.log |
| 66 | else |
| 67 | NM=${NM-"nm"} |
| 68 | fi |
| 69 | |
| 70 | # set defaults before processing command line options |
| 71 | LDCONFIG=${LDCONFIG-"ldconfig"} |
| 72 | LDSHAREDLIBC="${LDSHAREDLIBC--lc}" |
| 73 | ARCHS= |
| 74 | prefix=${prefix-/usr/local} |
| 75 | exec_prefix=${exec_prefix-'${prefix}'} |
| 76 | libdir=${libdir-'${exec_prefix}/lib'} |
| 77 | sharedlibdir=${sharedlibdir-'${libdir}'} |
| 78 | includedir=${includedir-'${prefix}/include'} |
| 79 | mandir=${mandir-'${prefix}/share/man'} |
| 80 | shared_ext='.so' |
| 81 | shared=1 |
| 82 | solo=0 |
| 83 | cover=0 |
| 84 | zprefix=0 |
| 85 | zconst=0 |
| 86 | build64=0 |
| 87 | gcc=0 |
| 88 | warn=0 |
| 89 | debug=0 |
| 90 | old_cc="$CC" |
| 91 | old_cflags="$CFLAGS" |
| 92 | OBJC='$(OBJZ) $(OBJG)' |
| 93 | PIC_OBJC='$(PIC_OBJZ) $(PIC_OBJG)' |
| 94 | |
| 95 | # leave this script, optionally in a bad way |
| 96 | leavescip-shell shell shell-project 0.0.0 leave().() |
| 97 | { |
| 98 | if testscip-shell system . . test. "$*" != "0"; then |
| 99 | echoscip-shell system . . echo. "** $0 aborting." | teescip-shell system . . tee. -a configure.log |
| 100 | fi |
| 101 | rmscip-shell system . . rm. -f $test.[co] $test $test$shared_ext $test.gcno ./--version |
| 102 | echoscip-shell system . . echo. -------------------- >> configure.log |
| 103 | echoscip-shell system . . echo. >> configure.log |
| 104 | echoscip-shell system . . echo. >> configure.log |
| 105 | exit $1 |
| 106 | } |
| 107 | |
| 108 | # process command line options |
| 109 | while testscip-shell system . . test. $# -ge 1 |
| 110 | do |
| 111 | case "$1" in |
| 112 | -h* | --help) |
| 113 | echoscip-shell system . . echo. 'usage:' | teescip-shell system . . tee. -a configure.log |
| 114 | echoscip-shell system . . echo. ' configure [--const] [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' | teescip-shell system . . tee. -a configure.log |
| 115 | echoscip-shell system . . echo. ' [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | teescip-shell system . . tee. -a configure.log |
| 116 | echoscip-shell system . . echo. ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | teescip-shell system . . tee. -a configure.log |
| 117 | exit 0 ;; |
| 118 | -p*=* | --prefix=*) prefix=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's/.*=//'`; shift ;; |
| 119 | -e*=* | --eprefix=*) exec_prefix=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's/.*=//'`; shift ;; |
| 120 | -l*=* | --libdir=*) libdir=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's/.*=//'`; shift ;; |
| 121 | --sharedlibdir=*) sharedlibdir=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's/.*=//'`; shift ;; |
| 122 | -i*=* | --includedir=*) includedir=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's/.*=//'`;shift ;; |
| 123 | -u*=* | --uname=*) uname=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's/.*=//'`;shift ;; |
| 124 | -p* | --prefix) prefix="$2"; shift; shift ;; |
| 125 | -e* | --eprefix) exec_prefix="$2"; shift; shift ;; |
| 126 | -l* | --libdir) libdir="$2"; shift; shift ;; |
| 127 | -i* | --includedir) includedir="$2"; shift; shift ;; |
| 128 | -s* | --shared | --enable-shared) shared=1; shift ;; |
| 129 | -t | --static) shared=0; shift ;; |
| 130 | --solo) solo=1; shift ;; |
| 131 | --cover) cover=1; shift ;; |
| 132 | -z* | --zprefix) zprefix=1; shift ;; |
| 133 | -6* | --64) build64=1; shift ;; |
| 134 | -a*=* | --archs=*) ARCHS=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's/.*=//'`; shift ;; |
| 135 | --sysconfdir=*) echoscip-shell system . . echo. "ignored option: --sysconfdir" | teescip-shell system . . tee. -a configure.log; shift ;; |
| 136 | --localstatedir=*) echoscip-shell system . . echo. "ignored option: --localstatedir" | teescip-shell system . . 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 | echoscip-shell system . . echo. "unknown option: $1" | teescip-shell system . . tee. -a configure.log |
| 142 | echoscip-shell system . . echo. "$0 --help for help" | teescip-shell system . . tee. -a configure.log |
| 143 | leavescip-shell shell shell-project 0.0.0 leave(). 1;; |
| 144 | esac |
| 145 | done |
| 146 | |
| 147 | # temporary file name |
| 148 | test=ztest$$ |
| 149 | |
| 150 | # put arguments in log, also put test file in log if used in arguments |
| 151 | showscip-shell shell shell-project 0.0.0 show().() |
| 152 | { |
| 153 | case "$*" in |
| 154 | *$test.c*) |
| 155 | echoscip-shell system . . echo. === $test.c === >> configure.log |
| 156 | catscip-shell system . . cat. $test.c >> configure.log |
| 157 | echoscip-shell system . . echo. === >> configure.log;; |
| 158 | esac |
| 159 | echoscip-shell system . . echo. $* >> configure.log |
| 160 | } |
| 161 | |
| 162 | # check for gcc vs. cc and set compile and link flags based on the system identified by uname |
| 163 | catscip-shell system . . cat. > $test.c <<EOF |
| 164 | extern int getchar(); |
| 165 | int hello() {return getchar();} |
| 166 | EOF |
| 167 | |
| 168 | testscip-shell system . . test. -z "$CC" && echoscip-shell system . . echo. Checking for ${CROSS_PREFIX}gcc... | teescip-shell system . . tee. -a configure.log |
| 169 | cc=${CC-${CROSS_PREFIX}gcc} |
| 170 | cflags=${CFLAGS-"-O3"} |
| 171 | # to force the asm version use: CFLAGS="-O3 -DASMV" ./configure |
| 172 | case "$cc" in |
| 173 | *gcc*) gcc=1 ;; |
| 174 | *clang*) gcc=1 ;; |
| 175 | esac |
| 176 | case `$cc -v 2>&1` in |
| 177 | *gcc*) gcc=1 ;; |
| 178 | *clang*) gcc=1 ;; |
| 179 | esac |
| 180 | |
| 181 | showscip-shell shell shell-project 0.0.0 show(). $cc -c $test.c |
| 182 | if testscip-shell system . . test. "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then |
| 183 | echoscip-shell system . . echo. ... using gcc >> configure.log |
| 184 | CC="$cc" |
| 185 | CFLAGS="${CFLAGS--O3}" |
| 186 | SFLAGS="${CFLAGS--O3} -fPIC" |
| 187 | if testscip-shell system . . test. "$ARCHS"; then |
| 188 | CFLAGS="${CFLAGS} ${ARCHS}" |
| 189 | LDFLAGS="${LDFLAGS} ${ARCHS}" |
| 190 | fi |
| 191 | if testscip-shell system . . test. $build64 -eq 1; then |
| 192 | CFLAGS="${CFLAGS} -m64" |
| 193 | SFLAGS="${SFLAGS} -m64" |
| 194 | fi |
| 195 | if testscip-shell system . . test. "$warn" -eq 1; then |
| 196 | if testscip-shell system . . test. "$zconst" -eq 1; then |
| 197 | CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -pedantic -DZLIB_CONST" |
| 198 | else |
| 199 | CFLAGS="${CFLAGS} -Wall -Wextra -pedantic" |
| 200 | fi |
| 201 | fi |
| 202 | if testscip-shell system . . test. $debug -eq 1; then |
| 203 | CFLAGS="${CFLAGS} -DZLIB_DEBUG" |
| 204 | SFLAGS="${SFLAGS} -DZLIB_DEBUG" |
| 205 | fi |
| 206 | if testscip-shell system . . test. -z "$uname"; then |
| 207 | uname=`(unamescip-shell system . . uname. -s || echoscip-shell system . . echo. unknown) 2>/dev/nullscip-shell filesystem . . `/dev/null`.` |
| 208 | fi |
| 209 | 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" ;; |
| 215 | CYGWIN* | Cygwin* | cygwin* | OS/2*) |
| 216 | EXE='.exe' ;; |
| 217 | MINGW* | mingw*) |
| 218 | # temporary bypass |
| 219 | rmscip-shell system . . rm. -f $test.[co] $test $test$shared_ext |
| 220 | echoscip-shell system . . echo. "Please use win32/Makefile.gcc instead." | teescip-shell system . . tee. -a configure.log |
| 221 | leavescip-shell shell shell-project 0.0.0 leave(). 1 |
| 222 | LDSHARED=${LDSHARED-"$cc -shared"} |
| 223 | LDSHAREDLIBC="" |
| 224 | EXE='.exe' ;; |
| 225 | QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4 |
| 226 | # ([email protected]) |
| 227 | LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"} ;; |
| 228 | HP-UX*) |
| 229 | LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"} |
| 230 | case `(unamescip-shell system . . uname. -m || echoscip-shell system . . echo. unknown) 2>/dev/nullscip-shell filesystem . . `/dev/null`.` in |
| 231 | ia64) |
| 232 | shared_ext='.so' |
| 233 | SHAREDLIB='libz.so' ;; |
| 234 | *) |
| 235 | shared_ext='.sl' |
| 236 | SHAREDLIB='libz.sl' ;; |
| 237 | esac ;; |
| 238 | Darwin* | darwin*) |
| 239 | shared_ext='.dylib' |
| 240 | SHAREDLIB=libz$shared_ext |
| 241 | SHAREDLIBV=libz.$VER$shared_ext |
| 242 | SHAREDLIBM=libz.$VER1$shared_ext |
| 243 | LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"} |
| 244 | if libtool -V 2>&1 | grepscip-shell system . . grep. Apple > /dev/nullscip-shell filesystem . . `/dev/null`.; then |
| 245 | AR="libtool" |
| 246 | else |
| 247 | AR="/usr/bin/libtoolscip-shell filesystem . . `/usr/bin/libtool`." |
| 248 | fi |
| 249 | ARFLAGS="-o" ;; |
| 250 | *) LDSHARED=${LDSHARED-"$cc -shared"} ;; |
| 251 | esac |
| 252 | else |
| 253 | # find system name and corresponding cc options |
| 254 | CC=${CC-cc} |
| 255 | gcc=0 |
| 256 | echoscip-shell system . . echo. ... using $CC >> configure.log |
| 257 | if testscip-shell system . . test. -z "$uname"; then |
| 258 | uname=`(unamescip-shell system . . uname. -sr || echoscip-shell system . . echo. unknown) 2>/dev/nullscip-shell filesystem . . `/dev/null`.` |
| 259 | fi |
| 260 | case "$uname" in |
| 261 | HP-UX*) SFLAGS=${CFLAGS-"-O +z"} |
| 262 | CFLAGS=${CFLAGS-"-O"} |
| 263 | # LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"} |
| 264 | LDSHARED=${LDSHARED-"ld -b"} |
| 265 | case `(unamescip-shell system . . uname. -m || echoscip-shell system . . echo. unknown) 2>/dev/nullscip-shell filesystem . . `/dev/null`.` in |
| 266 | ia64) |
| 267 | shared_ext='.so' |
| 268 | SHAREDLIB='libz.so' ;; |
| 269 | *) |
| 270 | shared_ext='.sl' |
| 271 | SHAREDLIB='libz.sl' ;; |
| 272 | esac ;; |
| 273 | IRIX*) SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."} |
| 274 | CFLAGS=${CFLAGS-"-ansi -O2"} |
| 275 | LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;; |
| 276 | OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"} |
| 277 | CFLAGS=${CFLAGS-"-O -std1"} |
| 278 | LDFLAGS="${LDFLAGS} -Wl,-rpath,." |
| 279 | LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"} ;; |
| 280 | OSF1*) SFLAGS=${CFLAGS-"-O -std1"} |
| 281 | CFLAGS=${CFLAGS-"-O -std1"} |
| 282 | LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;; |
| 283 | QNX*) SFLAGS=${CFLAGS-"-4 -O"} |
| 284 | CFLAGS=${CFLAGS-"-4 -O"} |
| 285 | LDSHARED=${LDSHARED-"cc"} |
| 286 | RANLIB=${RANLIB-"true"} |
| 287 | AR="cc" |
| 288 | ARFLAGS="-A" ;; |
| 289 | SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "} |
| 290 | CFLAGS=${CFLAGS-"-O3"} |
| 291 | LDSHARED=${LDSHARED-"cc -dy -KPIC -G"} ;; |
| 292 | SunOS\ 5* | solaris*) |
| 293 | LDSHARED=${LDSHARED-"cc -G -h libz$shared_ext.$VER1"} |
| 294 | SFLAGS=${CFLAGS-"-fast -KPIC"} |
| 295 | CFLAGS=${CFLAGS-"-fast"} |
| 296 | if testscip-shell system . . test. $build64 -eq 1; then |
| 297 | # old versions of SunPRO/Workshop/Studio don't support -m64, |
| 298 | # but newer ones do. Check for it. |
| 299 | flag64=`$CC -flags | egrepscip-shell system . . egrep. -- '^-m64'` |
| 300 | if testscip-shell system . . test. x"$flag64" != x"" ; then |
| 301 | CFLAGS="${CFLAGS} -m64" |
| 302 | SFLAGS="${SFLAGS} -m64" |
| 303 | else |
| 304 | case `(unamescip-shell system . . uname. -m || echoscip-shell system . . echo. unknown) 2>/dev/nullscip-shell filesystem . . `/dev/null`.` in |
| 305 | i86*) |
| 306 | SFLAGS="$SFLAGS -xarch=amd64" |
| 307 | CFLAGS="$CFLAGS -xarch=amd64" ;; |
| 308 | *) |
| 309 | SFLAGS="$SFLAGS -xarch=v9" |
| 310 | CFLAGS="$CFLAGS -xarch=v9" ;; |
| 311 | esac |
| 312 | fi |
| 313 | fi |
| 314 | if testscip-shell system . . test. -n "$ZINC"; then |
| 315 | ZINC='-I- -I. -I$(SRCDIR)' |
| 316 | fi |
| 317 | ;; |
| 318 | SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"} |
| 319 | CFLAGS=${CFLAGS-"-O2"} |
| 320 | LDSHARED=${LDSHARED-"ld"} ;; |
| 321 | SunStudio\ 9*) SFLAGS=${CFLAGS-"-fast -xcode=pic32 -xtarget=ultra3 -xarch=v9b"} |
| 322 | CFLAGS=${CFLAGS-"-fast -xtarget=ultra3 -xarch=v9b"} |
| 323 | LDSHARED=${LDSHARED-"cc -xarch=v9b"} ;; |
| 324 | UNIX_System_V\ 4.2.0) |
| 325 | SFLAGS=${CFLAGS-"-KPIC -O"} |
| 326 | CFLAGS=${CFLAGS-"-O"} |
| 327 | LDSHARED=${LDSHARED-"cc -G"} ;; |
| 328 | UNIX_SV\ 4.2MP) |
| 329 | SFLAGS=${CFLAGS-"-Kconform_pic -O"} |
| 330 | CFLAGS=${CFLAGS-"-O"} |
| 331 | LDSHARED=${LDSHARED-"cc -G"} ;; |
| 332 | OpenUNIX\ 5) |
| 333 | SFLAGS=${CFLAGS-"-KPIC -O"} |
| 334 | CFLAGS=${CFLAGS-"-O"} |
| 335 | LDSHARED=${LDSHARED-"cc -G"} ;; |
| 336 | AIX*) # Courtesy of [email protected] |
| 337 | SFLAGS=${CFLAGS-"-O -qmaxmem=8192"} |
| 338 | CFLAGS=${CFLAGS-"-O -qmaxmem=8192"} |
| 339 | LDSHARED=${LDSHARED-"xlc -G"} ;; |
| 340 | # send working options for other systems to [email protected] |
| 341 | *) SFLAGS=${CFLAGS-"-O"} |
| 342 | CFLAGS=${CFLAGS-"-O"} |
| 343 | LDSHARED=${LDSHARED-"cc -shared"} ;; |
| 344 | esac |
| 345 | fi |
| 346 | |
| 347 | # destination names for shared library if not defined above |
| 348 | SHAREDLIB=${SHAREDLIB-"libz$shared_ext"} |
| 349 | SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"} |
| 350 | SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"} |
| 351 | |
| 352 | echoscip-shell system . . echo. >> configure.log |
| 353 | |
| 354 | # define functions for testing compiler and library characteristics and logging the results |
| 355 | |
| 356 | catscip-shell system . . cat. > $test.c <<EOF |
| 357 | #error error |
| 358 | EOF |
| 359 | if ($CC -c $CFLAGS $test.c) 2>/dev/nullscip-shell filesystem . . `/dev/null`.; then |
| 360 | tryscip-shell shell shell-project 0.0.0 try().() |
| 361 | { |
| 362 | showscip-shell shell shell-project 0.0.0 show(). $* |
| 363 | testscip-shell system . . test. "`( $* ) 2>&1 | teescip-shell system . . tee. -a configure.log`" = "" |
| 364 | } |
| 365 | echoscip-shell system . . echo. - using any output from compiler to indicate an error >> configure.log |
| 366 | else |
| 367 | tryscip-shell shell shell-project 0.0.0 try().() |
| 368 | { |
| 369 | showscip-shell shell shell-project 0.0.0 show(). $* |
| 370 | ( $* ) >> configure.log 2>&1 |
| 371 | ret=$? |
| 372 | if testscip-shell system . . test. $ret -ne 0; then |
| 373 | echoscip-shell system . . echo. "(exit code "$ret")" >> configure.log |
| 374 | fi |
| 375 | return $ret |
| 376 | } |
| 377 | fi |
| 378 | |
| 379 | trybothscip-shell shell shell-project 0.0.0 tryboth().() |
| 380 | { |
| 381 | showscip-shell shell shell-project 0.0.0 show(). $* |
| 382 | got=`( $* ) 2>&1` |
| 383 | ret=$? |
| 384 | printfscip-shell system . . printf. %s "$got" >> configure.log |
| 385 | if testscip-shell system . . test. $ret -ne 0; then |
| 386 | return $ret |
| 387 | fi |
| 388 | testscip-shell system . . test. "$got" = "" |
| 389 | } |
| 390 | |
| 391 | catscip-shell system . . cat. > $test.c << EOF |
| 392 | int foo() { return 0; } |
| 393 | EOF |
| 394 | echoscip-shell system . . echo. "Checking for obsessive-compulsive compiler options..." >> configure.log |
| 395 | if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS $test.c; then |
| 396 | : |
| 397 | else |
| 398 | echoscip-shell system . . echo. "Compiler error reporting is too harsh for $0 (perhaps remove -Werror)." | teescip-shell system . . tee. -a configure.log |
| 399 | leavescip-shell shell shell-project 0.0.0 leave(). 1 |
| 400 | fi |
| 401 | |
| 402 | echoscip-shell system . . echo. >> configure.log |
| 403 | |
| 404 | # see if shared library build supported |
| 405 | catscip-shell system . . cat. > $test.c <<EOF |
| 406 | extern int getchar(); |
| 407 | int hello() {return getchar();} |
| 408 | EOF |
| 409 | if testscip-shell system . . test. $shared -eq 1; then |
| 410 | echoscip-shell system . . echo. Checking for shared library support... | teescip-shell system . . tee. -a configure.log |
| 411 | # we must test in two steps (cc then ld), required at least on SunOS 4.x |
| 412 | if tryscip-shell shell shell-project 0.0.0 try(). $CC -w -c $SFLAGS $test.c && |
| 413 | tryscip-shell shell shell-project 0.0.0 try(). $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then |
| 414 | echoscip-shell system . . echo. Building shared library $SHAREDLIBV with $CC. | teescip-shell system . . tee. -a configure.log |
| 415 | elif testscip-shell system . . test. -z "$old_cc" -a -z "$old_cflags"; then |
| 416 | echoscip-shell system . . echo. No shared library support. | teescip-shell system . . tee. -a configure.log |
| 417 | shared=0; |
| 418 | else |
| 419 | echoscip-shell system . . echo. 'No shared library support; try without defining CC and CFLAGS' | teescip-shell system . . tee. -a configure.log |
| 420 | shared=0; |
| 421 | fi |
| 422 | fi |
| 423 | if testscip-shell system . . test. $shared -eq 0; then |
| 424 | LDSHARED="$CC" |
| 425 | ALL="static" |
| 426 | TEST="all teststatic" |
| 427 | SHAREDLIB="" |
| 428 | SHAREDLIBV="" |
| 429 | SHAREDLIBM="" |
| 430 | echoscip-shell system . . echo. Building static library $STATICLIB version $VER with $CC. | teescip-shell system . . tee. -a configure.log |
| 431 | else |
| 432 | ALL="static shared" |
| 433 | TEST="all teststatic testshared" |
| 434 | fi |
| 435 | |
| 436 | # check for underscores in external names for use by assembler code |
| 437 | CPP=${CPP-"$CC -E"} |
| 438 | case $CFLAGS in |
| 439 | *ASMV*) |
| 440 | echoscip-shell system . . echo. >> configure.log |
| 441 | showscip-shell shell shell-project 0.0.0 show(). "$NM $test.o | grep _hello" |
| 442 | if testscip-shell system . . test. "`$NM $test.o | grepscip-shell system . . grep. _hello | teescip-shell system . . tee. -a configure.log`" = ""; then |
| 443 | CPP="$CPP -DNO_UNDERLINE" |
| 444 | echoscip-shell system . . echo. Checking for underline in external names... No. | teescip-shell system . . tee. -a configure.log |
| 445 | else |
| 446 | echoscip-shell system . . echo. Checking for underline in external names... Yes. | teescip-shell system . . tee. -a configure.log |
| 447 | fi ;; |
| 448 | esac |
| 449 | |
| 450 | echoscip-shell system . . echo. >> configure.log |
| 451 | |
| 452 | # check for size_t |
| 453 | catscip-shell system . . cat. > $test.c <<EOF |
| 454 | #include <stdio.h> |
| 455 | #include <stdlib.h> |
| 456 | size_t dummy = 0; |
| 457 | EOF |
| 458 | if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS $test.c; then |
| 459 | echoscip-shell system . . echo. "Checking for size_t... Yes." | teescip-shell system . . tee. -a configure.log |
| 460 | need_sizet=0 |
| 461 | else |
| 462 | echoscip-shell system . . echo. "Checking for size_t... No." | teescip-shell system . . tee. -a configure.log |
| 463 | need_sizet=1 |
| 464 | fi |
| 465 | |
| 466 | echoscip-shell system . . echo. >> configure.log |
| 467 | |
| 468 | # find the size_t integer type, if needed |
| 469 | if testscip-shell system . . test. $need_sizet -eq 1; then |
| 470 | catscip-shell system . . cat. > $test.c <<EOF |
| 471 | long long dummy = 0; |
| 472 | EOF |
| 473 | if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS $test.c; then |
| 474 | echoscip-shell system . . echo. "Checking for long long... Yes." | teescip-shell system . . tee. -a configure.log |
| 475 | catscip-shell system . . cat. > $test.c <<EOF |
| 476 | #include <stdio.h> |
| 477 | int main(void) { |
| 478 | if (sizeof(void *) <= sizeof(int)) puts("int"); |
| 479 | else if (sizeof(void *) <= sizeof(long)) puts("long"); |
| 480 | else puts("z_longlong"); |
| 481 | return 0; |
| 482 | } |
| 483 | EOF |
| 484 | else |
| 485 | echoscip-shell system . . echo. "Checking for long long... No." | teescip-shell system . . tee. -a configure.log |
| 486 | catscip-shell system . . cat. > $test.c <<EOF |
| 487 | #include <stdio.h> |
| 488 | int main(void) { |
| 489 | if (sizeof(void *) <= sizeof(int)) puts("int"); |
| 490 | else puts("long"); |
| 491 | return 0; |
| 492 | } |
| 493 | EOF |
| 494 | fi |
| 495 | if tryscip-shell shell shell-project 0.0.0 try(). $CC $CFLAGS -o $test $test.c; then |
| 496 | sizet=`./$test` |
| 497 | echoscip-shell system . . echo. "Checking for a pointer-size integer type..." $sizet"." | teescip-shell system . . tee. -a configure.log |
| 498 | else |
| 499 | echoscip-shell system . . echo. "Failed to find a pointer-size integer type." | teescip-shell system . . tee. -a configure.log |
| 500 | leavescip-shell shell shell-project 0.0.0 leave(). 1 |
| 501 | fi |
| 502 | fi |
| 503 | |
| 504 | if testscip-shell system . . test. $need_sizet -eq 1; then |
| 505 | CFLAGS="${CFLAGS} -DNO_SIZE_T=${sizet}" |
| 506 | SFLAGS="${SFLAGS} -DNO_SIZE_T=${sizet}" |
| 507 | fi |
| 508 | |
| 509 | echoscip-shell system . . echo. >> configure.log |
| 510 | |
| 511 | # check for large file support, and if none, check for fseeko() |
| 512 | catscip-shell system . . cat. > $test.c <<EOF |
| 513 | #include <sys/types.h> |
| 514 | off64_t dummy = 0; |
| 515 | EOF |
| 516 | if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c; then |
| 517 | CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1" |
| 518 | SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1" |
| 519 | ALL="${ALL} all64" |
| 520 | TEST="${TEST} test64" |
| 521 | echoscip-shell system . . echo. "Checking for off64_t... Yes." | teescip-shell system . . tee. -a configure.log |
| 522 | echoscip-shell system . . echo. "Checking for fseeko... Yes." | teescip-shell system . . tee. -a configure.log |
| 523 | else |
| 524 | echoscip-shell system . . echo. "Checking for off64_t... No." | teescip-shell system . . tee. -a configure.log |
| 525 | echoscip-shell system . . echo. >> configure.log |
| 526 | catscip-shell system . . cat. > $test.c <<EOF |
| 527 | #include <stdio.h> |
| 528 | int main(void) { |
| 529 | fseeko(NULL, 0, 0); |
| 530 | return 0; |
| 531 | } |
| 532 | EOF |
| 533 | if tryscip-shell shell shell-project 0.0.0 try(). $CC $CFLAGS -o $test $test.c; then |
| 534 | echoscip-shell system . . echo. "Checking for fseeko... Yes." | teescip-shell system . . tee. -a configure.log |
| 535 | else |
| 536 | CFLAGS="${CFLAGS} -DNO_FSEEKO" |
| 537 | SFLAGS="${SFLAGS} -DNO_FSEEKO" |
| 538 | echoscip-shell system . . echo. "Checking for fseeko... No." | teescip-shell system . . tee. -a configure.log |
| 539 | fi |
| 540 | fi |
| 541 | |
| 542 | echoscip-shell system . . echo. >> configure.log |
| 543 | |
| 544 | # check for strerror() for use by gz* functions |
| 545 | catscip-shell system . . cat. > $test.c <<EOF |
| 546 | #include <string.h> |
| 547 | #include <errno.h> |
| 548 | int main() { return strlen(strerror(errno)); } |
| 549 | EOF |
| 550 | if tryscip-shell shell shell-project 0.0.0 try(). $CC $CFLAGS -o $test $test.c; then |
| 551 | echoscip-shell system . . echo. "Checking for strerror... Yes." | teescip-shell system . . tee. -a configure.log |
| 552 | else |
| 553 | CFLAGS="${CFLAGS} -DNO_STRERROR" |
| 554 | SFLAGS="${SFLAGS} -DNO_STRERROR" |
| 555 | echoscip-shell system . . echo. "Checking for strerror... No." | teescip-shell system . . tee. -a configure.log |
| 556 | fi |
| 557 | |
| 558 | # copy clean zconf.h for subsequent edits |
| 559 | cpscip-shell system . . cp. -p ${SRCDIR}zconf.h.in zconf.h |
| 560 | |
| 561 | echoscip-shell system . . echo. >> configure.log |
| 562 | |
| 563 | # check for unistd.h and save result in zconf.h |
| 564 | catscip-shell system . . cat. > $test.c <<EOF |
| 565 | #include <unistd.h> |
| 566 | int main() { return 0; } |
| 567 | EOF |
| 568 | if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS $test.c; then |
| 569 | sedscip-shell system . . sed. < zconf.h "/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be/ 1\1 was/" > zconf.temp.h |
| 570 | mvscip-shell system . . mv. zconf.temp.h zconf.h |
| 571 | echoscip-shell system . . echo. "Checking for unistd.h... Yes." | teescip-shell system . . tee. -a configure.log |
| 572 | else |
| 573 | echoscip-shell system . . echo. "Checking for unistd.h... No." | teescip-shell system . . tee. -a configure.log |
| 574 | fi |
| 575 | |
| 576 | echoscip-shell system . . echo. >> configure.log |
| 577 | |
| 578 | # check for stdarg.h and save result in zconf.h |
| 579 | catscip-shell system . . cat. > $test.c <<EOF |
| 580 | #include <stdarg.h> |
| 581 | int main() { return 0; } |
| 582 | EOF |
| 583 | if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS $test.c; then |
| 584 | sedscip-shell system . . sed. < zconf.h "/^#ifdef HAVE_STDARG_H.* may be/s/def HAVE_STDARG_H\(.*\) may be/ 1\1 was/" > zconf.temp.h |
| 585 | mvscip-shell system . . mv. zconf.temp.h zconf.h |
| 586 | echoscip-shell system . . echo. "Checking for stdarg.h... Yes." | teescip-shell system . . tee. -a configure.log |
| 587 | else |
| 588 | echoscip-shell system . . echo. "Checking for stdarg.h... No." | teescip-shell system . . tee. -a configure.log |
| 589 | fi |
| 590 | |
| 591 | # if the z_ prefix was requested, save that in zconf.h |
| 592 | if testscip-shell system . . test. $zprefix -eq 1; then |
| 593 | sedscip-shell system . . sed. < zconf.h "/#ifdef Z_PREFIX.* may be/s/def Z_PREFIX\(.*\) may be/ 1\1 was/" > zconf.temp.h |
| 594 | mvscip-shell system . . mv. zconf.temp.h zconf.h |
| 595 | echoscip-shell system . . echo. >> configure.log |
| 596 | echoscip-shell system . . echo. "Using z_ prefix on all symbols." | teescip-shell system . . tee. -a configure.log |
| 597 | fi |
| 598 | |
| 599 | # if --solo compilation was requested, save that in zconf.h and remove gz stuff from object lists |
| 600 | if testscip-shell system . . test. $solo -eq 1; then |
| 601 | sedscip-shell system . . sed. '/#define ZCONF_H/a\ |
| 602 | #define Z_SOLO |
| 603 | |
| 604 | ' < zconf.h > zconf.temp.h |
| 605 | mvscip-shell system . . mv. zconf.temp.h zconf.h |
| 606 | OBJC='$(OBJZ)' |
| 607 | PIC_OBJC='$(PIC_OBJZ)' |
| 608 | fi |
| 609 | |
| 610 | # if code coverage testing was requested, use older gcc if defined, e.g. "gcc-4.2" on Mac OS X |
| 611 | if testscip-shell system . . test. $cover -eq 1; then |
| 612 | CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage" |
| 613 | if testscip-shell system . . test. -n "$GCC_CLASSIC"; then |
| 614 | CC=$GCC_CLASSIC |
| 615 | fi |
| 616 | fi |
| 617 | |
| 618 | echoscip-shell system . . echo. >> configure.log |
| 619 | |
| 620 | # conduct a series of tests to resolve eight possible cases of using "vs" or "s" printf functions |
| 621 | # (using stdarg or not), with or without "n" (proving size of buffer), and with or without a |
| 622 | # return value. The most secure result is vsnprintf() with a return value. snprintf() with a |
| 623 | # return value is secure as well, but then gzprintf() will be limited to 20 arguments. |
| 624 | catscip-shell system . . cat. > $test.c <<EOF |
| 625 | #include <stdio.h> |
| 626 | #include <stdarg.h> |
| 627 | #include "zconf.h" |
| 628 | int main() |
| 629 | { |
| 630 | #ifndef STDC |
| 631 | choke me |
| 632 | #endif |
| 633 | return 0; |
| 634 | } |
| 635 | EOF |
| 636 | if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS $test.c; then |
| 637 | echoscip-shell system . . echo. "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()." | teescip-shell system . . tee. -a configure.log |
| 638 | |
| 639 | echoscip-shell system . . echo. >> configure.log |
| 640 | catscip-shell system . . cat. > $test.c <<EOF |
| 641 | #include <stdio.h> |
| 642 | #include <stdarg.h> |
| 643 | int mytest(const char *fmt, ...) |
| 644 | { |
| 645 | char buf[20]; |
| 646 | va_list ap; |
| 647 | va_start(ap, fmt); |
| 648 | vsnprintf(buf, sizeof(buf), fmt, ap); |
| 649 | va_end(ap); |
| 650 | return 0; |
| 651 | } |
| 652 | int main() |
| 653 | { |
| 654 | return (mytest("Hello%d\n", 1)); |
| 655 | } |
| 656 | EOF |
| 657 | if tryscip-shell shell shell-project 0.0.0 try(). $CC $CFLAGS -o $test $test.c; then |
| 658 | echoscip-shell system . . echo. "Checking for vsnprintf() in stdio.h... Yes." | teescip-shell system . . tee. -a configure.log |
| 659 | |
| 660 | echoscip-shell system . . echo. >> configure.log |
| 661 | catscip-shell system . . cat. >$test.c <<EOF |
| 662 | #include <stdio.h> |
| 663 | #include <stdarg.h> |
| 664 | int mytest(const char *fmt, ...) |
| 665 | { |
| 666 | int n; |
| 667 | char buf[20]; |
| 668 | va_list ap; |
| 669 | va_start(ap, fmt); |
| 670 | n = vsnprintf(buf, sizeof(buf), fmt, ap); |
| 671 | va_end(ap); |
| 672 | return n; |
| 673 | } |
| 674 | int main() |
| 675 | { |
| 676 | return (mytest("Hello%d\n", 1)); |
| 677 | } |
| 678 | EOF |
| 679 | |
| 680 | if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS $test.c; then |
| 681 | echoscip-shell system . . echo. "Checking for return value of vsnprintf()... Yes." | teescip-shell system . . tee. -a configure.log |
| 682 | else |
| 683 | CFLAGS="$CFLAGS -DHAS_vsnprintf_void" |
| 684 | SFLAGS="$SFLAGS -DHAS_vsnprintf_void" |
| 685 | echoscip-shell system . . echo. "Checking for return value of vsnprintf()... No." | teescip-shell system . . tee. -a configure.log |
| 686 | echoscip-shell system . . echo. " WARNING: apparently vsnprintf() does not return a value. zlib" | teescip-shell system . . tee. -a configure.log |
| 687 | echoscip-shell system . . echo. " can build but will be open to possible string-format security" | teescip-shell system . . tee. -a configure.log |
| 688 | echoscip-shell system . . echo. " vulnerabilities." | teescip-shell system . . tee. -a configure.log |
| 689 | fi |
| 690 | else |
| 691 | CFLAGS="$CFLAGS -DNO_vsnprintf" |
| 692 | SFLAGS="$SFLAGS -DNO_vsnprintf" |
| 693 | echoscip-shell system . . echo. "Checking for vsnprintf() in stdio.h... No." | teescip-shell system . . tee. -a configure.log |
| 694 | echoscip-shell system . . echo. " WARNING: vsnprintf() not found, falling back to vsprintf(). zlib" | teescip-shell system . . tee. -a configure.log |
| 695 | echoscip-shell system . . echo. " can build but will be open to possible buffer-overflow security" | teescip-shell system . . tee. -a configure.log |
| 696 | echoscip-shell system . . echo. " vulnerabilities." | teescip-shell system . . tee. -a configure.log |
| 697 | |
| 698 | echoscip-shell system . . echo. >> configure.log |
| 699 | catscip-shell system . . cat. >$test.c <<EOF |
| 700 | #include <stdio.h> |
| 701 | #include <stdarg.h> |
| 702 | int mytest(const char *fmt, ...) |
| 703 | { |
| 704 | int n; |
| 705 | char buf[20]; |
| 706 | va_list ap; |
| 707 | va_start(ap, fmt); |
| 708 | n = vsprintf(buf, fmt, ap); |
| 709 | va_end(ap); |
| 710 | return n; |
| 711 | } |
| 712 | int main() |
| 713 | { |
| 714 | return (mytest("Hello%d\n", 1)); |
| 715 | } |
| 716 | EOF |
| 717 | |
| 718 | if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS $test.c; then |
| 719 | echoscip-shell system . . echo. "Checking for return value of vsprintf()... Yes." | teescip-shell system . . tee. -a configure.log |
| 720 | else |
| 721 | CFLAGS="$CFLAGS -DHAS_vsprintf_void" |
| 722 | SFLAGS="$SFLAGS -DHAS_vsprintf_void" |
| 723 | echoscip-shell system . . echo. "Checking for return value of vsprintf()... No." | teescip-shell system . . tee. -a configure.log |
| 724 | echoscip-shell system . . echo. " WARNING: apparently vsprintf() does not return a value. zlib" | teescip-shell system . . tee. -a configure.log |
| 725 | echoscip-shell system . . echo. " can build but will be open to possible string-format security" | teescip-shell system . . tee. -a configure.log |
| 726 | echoscip-shell system . . echo. " vulnerabilities." | teescip-shell system . . tee. -a configure.log |
| 727 | fi |
| 728 | fi |
| 729 | else |
| 730 | echoscip-shell system . . echo. "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()." | teescip-shell system . . tee. -a configure.log |
| 731 | |
| 732 | echoscip-shell system . . echo. >> configure.log |
| 733 | catscip-shell system . . cat. >$test.c <<EOF |
| 734 | #include <stdio.h> |
| 735 | int mytest() |
| 736 | { |
| 737 | char buf[20]; |
| 738 | snprintf(buf, sizeof(buf), "%s", "foo"); |
| 739 | return 0; |
| 740 | } |
| 741 | int main() |
| 742 | { |
| 743 | return (mytest()); |
| 744 | } |
| 745 | EOF |
| 746 | |
| 747 | if tryscip-shell shell shell-project 0.0.0 try(). $CC $CFLAGS -o $test $test.c; then |
| 748 | echoscip-shell system . . echo. "Checking for snprintf() in stdio.h... Yes." | teescip-shell system . . tee. -a configure.log |
| 749 | |
| 750 | echoscip-shell system . . echo. >> configure.log |
| 751 | catscip-shell system . . cat. >$test.c <<EOF |
| 752 | #include <stdio.h> |
| 753 | int mytest() |
| 754 | { |
| 755 | char buf[20]; |
| 756 | return snprintf(buf, sizeof(buf), "%s", "foo"); |
| 757 | } |
| 758 | int main() |
| 759 | { |
| 760 | return (mytest()); |
| 761 | } |
| 762 | EOF |
| 763 | |
| 764 | if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS $test.c; then |
| 765 | echoscip-shell system . . echo. "Checking for return value of snprintf()... Yes." | teescip-shell system . . tee. -a configure.log |
| 766 | else |
| 767 | CFLAGS="$CFLAGS -DHAS_snprintf_void" |
| 768 | SFLAGS="$SFLAGS -DHAS_snprintf_void" |
| 769 | echoscip-shell system . . echo. "Checking for return value of snprintf()... No." | teescip-shell system . . tee. -a configure.log |
| 770 | echoscip-shell system . . echo. " WARNING: apparently snprintf() does not return a value. zlib" | teescip-shell system . . tee. -a configure.log |
| 771 | echoscip-shell system . . echo. " can build but will be open to possible string-format security" | teescip-shell system . . tee. -a configure.log |
| 772 | echoscip-shell system . . echo. " vulnerabilities." | teescip-shell system . . tee. -a configure.log |
| 773 | fi |
| 774 | else |
| 775 | CFLAGS="$CFLAGS -DNO_snprintf" |
| 776 | SFLAGS="$SFLAGS -DNO_snprintf" |
| 777 | echoscip-shell system . . echo. "Checking for snprintf() in stdio.h... No." | teescip-shell system . . tee. -a configure.log |
| 778 | echoscip-shell system . . echo. " WARNING: snprintf() not found, falling back to sprintf(). zlib" | teescip-shell system . . tee. -a configure.log |
| 779 | echoscip-shell system . . echo. " can build but will be open to possible buffer-overflow security" | teescip-shell system . . tee. -a configure.log |
| 780 | echoscip-shell system . . echo. " vulnerabilities." | teescip-shell system . . tee. -a configure.log |
| 781 | |
| 782 | echoscip-shell system . . echo. >> configure.log |
| 783 | catscip-shell system . . cat. >$test.c <<EOF |
| 784 | #include <stdio.h> |
| 785 | int mytest() |
| 786 | { |
| 787 | char buf[20]; |
| 788 | return sprintf(buf, "%s", "foo"); |
| 789 | } |
| 790 | int main() |
| 791 | { |
| 792 | return (mytest()); |
| 793 | } |
| 794 | EOF |
| 795 | |
| 796 | if tryscip-shell shell shell-project 0.0.0 try(). $CC -c $CFLAGS $test.c; then |
| 797 | echoscip-shell system . . echo. "Checking for return value of sprintf()... Yes." | teescip-shell system . . tee. -a configure.log |
| 798 | else |
| 799 | CFLAGS="$CFLAGS -DHAS_sprintf_void" |
| 800 | SFLAGS="$SFLAGS -DHAS_sprintf_void" |
| 801 | echoscip-shell system . . echo. "Checking for return value of sprintf()... No." | teescip-shell system . . tee. -a configure.log |
| 802 | echoscip-shell system . . echo. " WARNING: apparently sprintf() does not return a value. zlib" | teescip-shell system . . tee. -a configure.log |
| 803 | echoscip-shell system . . echo. " can build but will be open to possible string-format security" | teescip-shell system . . tee. -a configure.log |
| 804 | echoscip-shell system . . echo. " vulnerabilities." | teescip-shell system . . tee. -a configure.log |
| 805 | fi |
| 806 | fi |
| 807 | fi |
| 808 | |
| 809 | # see if we can hide zlib internal symbols that are linked between separate source files |
| 810 | if testscip-shell system . . test. "$gcc" -eq 1; then |
| 811 | echoscip-shell system . . echo. >> configure.log |
| 812 | catscip-shell system . . cat. > $test.c <<EOF |
| 813 | #define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) |
| 814 | int ZLIB_INTERNAL foo; |
| 815 | int main() |
| 816 | { |
| 817 | return 0; |
| 818 | } |
| 819 | EOF |
| 820 | if trybothscip-shell shell shell-project 0.0.0 tryboth(). $CC -c $CFLAGS $test.c; then |
| 821 | CFLAGS="$CFLAGS -DHAVE_HIDDEN" |
| 822 | SFLAGS="$SFLAGS -DHAVE_HIDDEN" |
| 823 | echoscip-shell system . . echo. "Checking for attribute(visibility) support... Yes." | teescip-shell system . . tee. -a configure.log |
| 824 | else |
| 825 | echoscip-shell system . . echo. "Checking for attribute(visibility) support... No." | teescip-shell system . . tee. -a configure.log |
| 826 | fi |
| 827 | fi |
| 828 | |
| 829 | # show the results in the log |
| 830 | echoscip-shell system . . echo. >> configure.log |
| 831 | echoscip-shell system . . echo. ALL = $ALL >> configure.log |
| 832 | echoscip-shell system . . echo. AR = $AR >> configure.log |
| 833 | echoscip-shell system . . echo. ARFLAGS = $ARFLAGS >> configure.log |
| 834 | echoscip-shell system . . echo. CC = $CC >> configure.log |
| 835 | echoscip-shell system . . echo. CFLAGS = $CFLAGS >> configure.log |
| 836 | echoscip-shell system . . echo. CPP = $CPP >> configure.log |
| 837 | echoscip-shell system . . echo. EXE = $EXE >> configure.log |
| 838 | echoscip-shell system . . echo. LDCONFIG = $LDCONFIG >> configure.log |
| 839 | echoscip-shell system . . echo. LDFLAGS = $LDFLAGS >> configure.log |
| 840 | echoscip-shell system . . echo. LDSHARED = $LDSHARED >> configure.log |
| 841 | echoscip-shell system . . echo. LDSHAREDLIBC = $LDSHAREDLIBC >> configure.log |
| 842 | echoscip-shell system . . echo. OBJC = $OBJC >> configure.log |
| 843 | echoscip-shell system . . echo. PIC_OBJC = $PIC_OBJC >> configure.log |
| 844 | echoscip-shell system . . echo. RANLIB = $RANLIB >> configure.log |
| 845 | echoscip-shell system . . echo. SFLAGS = $SFLAGS >> configure.log |
| 846 | echoscip-shell system . . echo. SHAREDLIB = $SHAREDLIB >> configure.log |
| 847 | echoscip-shell system . . echo. SHAREDLIBM = $SHAREDLIBM >> configure.log |
| 848 | echoscip-shell system . . echo. SHAREDLIBV = $SHAREDLIBV >> configure.log |
| 849 | echoscip-shell system . . echo. STATICLIB = $STATICLIB >> configure.log |
| 850 | echoscip-shell system . . echo. TEST = $TEST >> configure.log |
| 851 | echoscip-shell system . . echo. VER = $VER >> configure.log |
| 852 | echoscip-shell system . . echo. Z_U4 = $Z_U4 >> configure.log |
| 853 | echoscip-shell system . . echo. SRCDIR = $SRCDIR >> configure.log |
| 854 | echoscip-shell system . . echo. exec_prefix = $exec_prefix >> configure.log |
| 855 | echoscip-shell system . . echo. includedir = $includedir >> configure.log |
| 856 | echoscip-shell system . . echo. libdir = $libdir >> configure.log |
| 857 | echoscip-shell system . . echo. mandir = $mandir >> configure.log |
| 858 | echoscip-shell system . . echo. prefix = $prefix >> configure.log |
| 859 | echoscip-shell system . . echo. sharedlibdir = $sharedlibdir >> configure.log |
| 860 | echoscip-shell system . . echo. uname = $uname >> configure.log |
| 861 | |
| 862 | # udpate Makefile with the configure results |
| 863 | sedscip-shell system . . sed. < ${SRCDIR}Makefile.in " |
| 864 | /^CC *=/s#=.*#=$CC# |
| 865 | /^CFLAGS *=/s#=.*#=$CFLAGS# |
| 866 | /^SFLAGS *=/s#=.*#=$SFLAGS# |
| 867 | /^LDFLAGS *=/s#=.*#=$LDFLAGS# |
| 868 | /^LDSHARED *=/s#=.*#=$LDSHARED# |
| 869 | /^CPP *=/s#=.*#=$CPP# |
| 870 | /^STATICLIB *=/s#=.*#=$STATICLIB# |
| 871 | /^SHAREDLIB *=/s#=.*#=$SHAREDLIB# |
| 872 | /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV# |
| 873 | /^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM# |
| 874 | /^AR *=/s#=.*#=$AR# |
| 875 | /^ARFLAGS *=/s#=.*#=$ARFLAGS# |
| 876 | /^RANLIB *=/s#=.*#=$RANLIB# |
| 877 | /^LDCONFIG *=/s#=.*#=$LDCONFIG# |
| 878 | /^LDSHAREDLIBC *=/s#=.*#=$LDSHAREDLIBC# |
| 879 | /^EXE *=/s#=.*#=$EXE# |
| 880 | /^SRCDIR *=/s#=.*#=$SRCDIR# |
| 881 | /^ZINC *=/s#=.*#=$ZINC# |
| 882 | /^ZINCOUT *=/s#=.*#=$ZINCOUT# |
| 883 | /^prefix *=/s#=.*#=$prefix# |
| 884 | /^exec_prefix *=/s#=.*#=$exec_prefix# |
| 885 | /^libdir *=/s#=.*#=$libdir# |
| 886 | /^sharedlibdir *=/s#=.*#=$sharedlibdir# |
| 887 | /^includedir *=/s#=.*#=$includedir# |
| 888 | /^mandir *=/s#=.*#=$mandir# |
| 889 | /^OBJC *=/s#=.*#= $OBJC# |
| 890 | /^PIC_OBJC *=/s#=.*#= $PIC_OBJC# |
| 891 | /^all: */s#:.*#: $ALL# |
| 892 | /^test: */s#:.*#: $TEST# |
| 893 | " > Makefile |
| 894 | |
| 895 | # create zlib.pc with the configure results |
| 896 | sedscip-shell system . . sed. < ${SRCDIR}zlib.pc.in " |
| 897 | /^CC *=/s#=.*#=$CC# |
| 898 | /^CFLAGS *=/s#=.*#=$CFLAGS# |
| 899 | /^CPP *=/s#=.*#=$CPP# |
| 900 | /^LDSHARED *=/s#=.*#=$LDSHARED# |
| 901 | /^STATICLIB *=/s#=.*#=$STATICLIB# |
| 902 | /^SHAREDLIB *=/s#=.*#=$SHAREDLIB# |
| 903 | /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV# |
| 904 | /^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM# |
| 905 | /^AR *=/s#=.*#=$AR# |
| 906 | /^ARFLAGS *=/s#=.*#=$ARFLAGS# |
| 907 | /^RANLIB *=/s#=.*#=$RANLIB# |
| 908 | /^EXE *=/s#=.*#=$EXE# |
| 909 | /^prefix *=/s#=.*#=$prefix# |
| 910 | /^exec_prefix *=/s#=.*#=$exec_prefix# |
| 911 | /^libdir *=/s#=.*#=$libdir# |
| 912 | /^sharedlibdir *=/s#=.*#=$sharedlibdir# |
| 913 | /^includedir *=/s#=.*#=$includedir# |
| 914 | /^mandir *=/s#=.*#=$mandir# |
| 915 | /^LDFLAGS *=/s#=.*#=$LDFLAGS# |
| 916 | " | sedscip-shell system . . sed. -e " |
| 917 | s/\@VERSION\@/$VER/g; |
| 918 | " > zlib.pc |
| 919 | |
| 920 | # done |
| 921 | leavescip-shell shell shell-project 0.0.0 leave(). 0 |