VirtualBox

source: vbox/trunk/src/libs/zlib-1.2.6/configure@ 53428

Last change on this file since 53428 was 40354, checked in by vboxsync, 13 years ago

libs/zlib-1.2.6: fix OSE

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 21.8 KB
Line 
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
16echo -------------------- >> configure.log
17echo $0 $* >> configure.log
18date >> configure.log
19
20if [ -n "${CHOST}" ]; then
21 uname="`echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/'`"
22 CROSS_PREFIX="${CHOST}-"
23fi
24
25STATICLIB=libz.a
26VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
27VER3=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < zlib.h`
28VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h`
29VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h`
30if "${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
33else
34 AR=${AR-"ar"}
35 test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log
36fi
37ARFLAGS=${ARFLAGS-"rc"}
38if "${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
41else
42 RANLIB=${RANLIB-"ranlib"}
43fi
44if "${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
47else
48 NM=${NM-"nm"}
49fi
50LDCONFIG=${LDCONFIG-"ldconfig"}
51LDSHAREDLIBC="${LDSHAREDLIBC--lc}"
52ARCHS=
53prefix=${prefix-/usr/local}
54exec_prefix=${exec_prefix-'${prefix}'}
55libdir=${libdir-'${exec_prefix}/lib'}
56sharedlibdir=${sharedlibdir-'${libdir}'}
57includedir=${includedir-'${prefix}/include'}
58mandir=${mandir-'${prefix}/share/man'}
59shared_ext='.so'
60shared=1
61solo=0
62cover=0
63zprefix=0
64build64=0
65gcc=0
66old_cc="$CC"
67old_cflags="$CFLAGS"
68OBJC='$(OBJZ) $(OBJG)'
69PIC_OBJC='$(PIC_OBJZ) $(PIC_OBJG)'
70
71while test $# -ge 1
72do
73case "$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
101done
102
103test=ztest$$
104
105show()
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
116cat > $test.c <<EOF
117#error error
118EOF
119if ($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
126else
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 }
137fi
138
139echo >> configure.log
140
141cat > $test.c <<EOF
142extern int getchar();
143int hello() {return getchar();}
144EOF
145
146test -z "$CC" && echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log
147cc=${CC-${CROSS_PREFIX}gcc}
148cflags=${CFLAGS-"-O3"}
149# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
150case "$cc" in
151 *gcc*) gcc=1 ;;
152esac
153case `$cc -v 2>&1` in
154 *gcc*) gcc=1 ;;
155esac
156
157show $cc -c $cflags $test.c
158if 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 # ([email protected])
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
213else
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 [email protected]
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 [email protected]
286 *) SFLAGS=${CFLAGS-"-O"}
287 CFLAGS=${CFLAGS-"-O"}
288 LDSHARED=${LDSHARED-"cc -shared"} ;;
289 esac
290fi
291
292SHAREDLIB=${SHAREDLIB-"libz$shared_ext"}
293SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"}
294SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"}
295
296echo >> configure.log
297
298if 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
311fi
312if 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
320else
321 ALL="static shared"
322 TEST="all teststatic testshared"
323fi
324
325CPP=${CPP-"$CC -E"}
326case $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 ;;
336esac
337
338echo >> configure.log
339
340cat > $test.c <<EOF
341#include <sys/types.h>
342off64_t dummy = 0;
343EOF
344if 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
351else
352 echo "Checking for off64_t... No." | tee -a configure.log
353 echo >> configure.log
354 cat > $test.c <<EOF
355#include <stdio.h>
356int main(void) {
357 fseeko(NULL, 0, 0);
358 return 0;
359}
360EOF
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
368fi
369
370cp -p zconf.h.in zconf.h
371
372echo >> configure.log
373
374cat > $test.c <<EOF
375#include <unistd.h>
376int main() { return 0; }
377EOF
378if 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
382else
383 echo "Checking for unistd.h... No." | tee -a configure.log
384fi
385
386echo >> configure.log
387
388cat > $test.c <<EOF
389#include <stdarg.h>
390int main() { return 0; }
391EOF
392if 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
396else
397 echo "Checking for stdarg.h... No." | tee -a configure.log
398fi
399
400if 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
405fi
406
407if 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
413OBJC='$(OBJZ)'
414PIC_OBJC='$(PIC_OBJZ)'
415fi
416
417if test $cover -eq 1; then
418 CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage"
419fi
420
421echo >> configure.log
422
423cat > $test.c <<EOF
424#include <stdio.h>
425#include <stdarg.h>
426#include "zconf.h"
427int main()
428{
429#ifndef STDC
430 choke me
431#endif
432 return 0;
433}
434EOF
435
436if 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>
443int 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}
452int main()
453{
454 return (mytest("Hello%d\n", 1));
455}
456EOF
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>
464int 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}
474int main()
475{
476 return (mytest("Hello%d\n", 1));
477}
478EOF
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>
502int 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}
512int main()
513{
514 return (mytest("Hello%d\n", 1));
515}
516EOF
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
529else
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>
535int mytest()
536{
537 char buf[20];
538 snprintf(buf, sizeof(buf), "%s", "foo");
539 return 0;
540}
541int main()
542{
543 return (mytest());
544}
545EOF
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>
553int mytest()
554{
555 char buf[20];
556 return snprintf(buf, sizeof(buf), "%s", "foo");
557}
558int main()
559{
560 return (mytest());
561}
562EOF
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>
585int mytest()
586{
587 char buf[20];
588 return sprintf(buf, "%s", "foo");
589}
590int main()
591{
592 return (mytest());
593}
594EOF
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
607fi
608
609if 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
617int ZLIB_INTERNAL foo;
618int main()
619{
620 return 0;
621}
622EOF
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
630fi
631
632rm -f $test.[co] $test $test$shared_ext $test.gcno
633
634# show the results in the log
635echo >> configure.log
636echo ALL = $ALL >> configure.log
637echo AR = $AR >> configure.log
638echo ARFLAGS = $ARFLAGS >> configure.log
639echo CC = $CC >> configure.log
640echo CFLAGS = $CFLAGS >> configure.log
641echo CPP = $CPP >> configure.log
642echo EXE = $EXE >> configure.log
643echo LDCONFIG = $LDCONFIG >> configure.log
644echo LDFLAGS = $LDFLAGS >> configure.log
645echo LDSHARED = $LDSHARED >> configure.log
646echo LDSHAREDLIBC = $LDSHAREDLIBC >> configure.log
647echo OBJC = $OBJC >> configure.log
648echo PIC_OBJC = $PIC_OBJC >> configure.log
649echo RANLIB = $RANLIB >> configure.log
650echo SFLAGS = $SFLAGS >> configure.log
651echo SHAREDLIB = $SHAREDLIB >> configure.log
652echo SHAREDLIBM = $SHAREDLIBM >> configure.log
653echo SHAREDLIBV = $SHAREDLIBV >> configure.log
654echo STATICLIB = $STATICLIB >> configure.log
655echo TEST = $TEST >> configure.log
656echo VER = $VER >> configure.log
657echo exec_prefix = $exec_prefix >> configure.log
658echo includedir = $includedir >> configure.log
659echo libdir = $libdir >> configure.log
660echo mandir = $mandir >> configure.log
661echo prefix = $prefix >> configure.log
662echo sharedlibdir = $sharedlibdir >> configure.log
663echo uname = $uname >> configure.log
664echo -------------------- >> configure.log
665echo >> configure.log
666echo >> configure.log
667
668# udpate Makefile
669sed < 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
698sed < 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 "
719s/\@VERSION\@/$VER/g;
720" > zlib.pc
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette