Debian Codegraph @

PNG/zlib/configure

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2 # configure script for zlib. This script is needed only if
3 # you wish to build a shared library and your system supports them,
4 # of if you need special compiler, flags or install directory.
5 # Otherwise, you can just use directly "make test; make install"
6 #
7 # To create a shared library, use "configure --shared"; by default a static
8 # library is created. If the primitive shared library support provided here
9 # does not work, use ftp://prep.ai.mit.edu/pub/gnu/libtool-*.tar.gz
10 #
11 # To impose specific compiler or flags or install directory, use for example:
12 # prefix=$HOME CC=cc CFLAGS="-O4" ./configure
13 # or for csh/tcsh users:
14 # (setenv prefix $HOME; setenv CC cc; setenv CFLAGS "-O4"; ./configure)
15 # LDSHARED is the command to be used to create a shared library
16
17 # Incorrect settings of CC or CFLAGS may prevent creating a shared library.
18 # If you have problems, try without defining CC and CFLAGS before reporting
19 # an error.
20
21 LIBS=libz.a
22 LDFLAGS="-L. ${LIBS}"
23 VER=`sedscip-shell system . . sed. -n -e '/VERSION "/s/.*"\(.*\)".*/\1/pscip-shell filesystem . . `/VERSION "/s/.*"\(.*\)".*/\1/p`.' < zlib.h`
24 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`.' < zlib.h`
25 VER1=`sedscip-shell system . . sed. -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/pscip-shell filesystem . . `/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p`.' < zlib.h`
26 AR=${AR-"ar rc"}
27 RANLIB=${RANLIB-"ranlib"}
28 prefix=${prefix-/usr/local}
29 exec_prefix=${exec_prefix-'${prefix}'}
30 libdir=${libdir-'${exec_prefix}/lib'}
31 includedir=${includedir-'${prefix}/include'}
32 mandir=${mandir-'${prefix}/share/man'}
33 shared_ext='.so'
34 shared=0
35 gcc=0
36 old_cc="$CC"
37 old_cflags="$CFLAGS"
38
39 while testscip-shell system . . test. $# -ge 1
40 do
41 case "$1" in
42 -h* | --h*)
43 echoscip-shell system . . echo. 'usage:'
44 echoscip-shell system . . echo. ' configure [--shared] [--prefix=PREFIX] [--exec_prefix=EXPREFIX]'
45 echoscip-shell system . . echo. ' [--libdir=LIBDIR] [--includedir=INCLUDEDIR]'
46 exit 0;;
47 -p*=* | --p*=*) prefix=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's/[-a-z_]*=//'`; shift;;
48 -e*=* | --e*=*) exec_prefix=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's/[-a-z_]*=//'`; shift;;
49 -l*=* | --libdir=*) libdir=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's/[-a-z_]*=//'`; shift;;
50 -i*=* | --includedir=*) includedir=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's/[-a-z_]*=//'`;shift;;
51 -p* | --p*) prefix="$2"; shift; shift;;
52 -e* | --e*) exec_prefix="$2"; shift; shift;;
53 -l* | --l*) libdir="$2"; shift; shift;;
54 -i* | --i*) includedir="$2"; shift; shift;;
55 -s* | --s*) shared=1; shift;;
56 *) echoscip-shell system . . echo. "unknown option: $1"; echoscip-shell system . . echo. "$0 --help for help"; exit 1;;
57 esac
58 done
59
60 test=ztest$$
61 catscip-shell system . . cat. > $test.c <<EOF
62 extern int getchar();
63 int hello() {return getchar();}
64 EOF
65
66 testscip-shell system . . test. -z "$CC" && echoscip-shell system . . echo. Checking for gcc...
67 cc=${CC-gcc}
68 cflags=${CFLAGS-"-O3"}
69 # to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
70 case "$cc" in
71 *gcc*) gcc=1;;
72 esac
73
74 if testscip-shell system . . test. "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/nullscip-shell filesystem . . `/dev/null`.; then
75 CC="$cc"
76 SFLAGS=${CFLAGS-"-fPIC -O3"}
77 CFLAGS="$cflags"
78 case `(unamescip-shell system . . uname. -s || echoscip-shell system . . echo. unknown) 2>/dev/nullscip-shell filesystem . . `/dev/null`.` in
79 Linux | linux | GNU | GNU/*) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1"};;
80 CYGWIN* | Cygwin* | cygwin* | OS/2* )
81 EXE='.exe';;
82 QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4
83 # ([email protected])
84 LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"};;
85 HP-UX*)
86 LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"}
87 case `(unamescip-shell system . . uname. -m || echoscip-shell system . . echo. unknown) 2>/dev/nullscip-shell filesystem . . `/dev/null`.` in
88 ia64)
89 shared_ext='.so'
90 SHAREDLIB='libz.so';;
91 *)
92 shared_ext='.sl'
93 SHAREDLIB='libz.sl';;
94 esac;;
95 Darwin*) shared_ext='.dylib'
96 SHAREDLIB=libz$shared_ext
97 SHAREDLIBV=libz.$VER$shared_ext
98 SHAREDLIBM=libz.$VER1$shared_ext
99 LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER"};;
100 *) LDSHARED=${LDSHARED-"$cc -shared"};;
101 esac
102 else
103 # find system name and corresponding cc options
104 CC=${CC-cc}
105 case `(unamescip-shell system . . uname. -sr || echoscip-shell system . . echo. unknown) 2>/dev/nullscip-shell filesystem . . `/dev/null`.` in
106 HP-UX*) SFLAGS=${CFLAGS-"-O +z"}
107 CFLAGS=${CFLAGS-"-O"}
108 # LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"}
109 LDSHARED=${LDSHARED-"ld -b"}
110 case `(unamescip-shell system . . uname. -m || echoscip-shell system . . echo. unknown) 2>/dev/nullscip-shell filesystem . . `/dev/null`.` in
111 ia64)
112 shared_ext='.so'
113 SHAREDLIB='libz.so';;
114 *)
115 shared_ext='.sl'
116 SHAREDLIB='libz.sl';;
117 esac;;
118 IRIX*) SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."}
119 CFLAGS=${CFLAGS-"-ansi -O2"}
120 LDSHARED=${LDSHARED-"cc -shared"};;
121 OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"}
122 CFLAGS=${CFLAGS-"-O -std1"}
123 LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"};;
124 OSF1*) SFLAGS=${CFLAGS-"-O -std1"}
125 CFLAGS=${CFLAGS-"-O -std1"}
126 LDSHARED=${LDSHARED-"cc -shared"};;
127 QNX*) SFLAGS=${CFLAGS-"-4 -O"}
128 CFLAGS=${CFLAGS-"-4 -O"}
129 LDSHARED=${LDSHARED-"cc"}
130 RANLIB=${RANLIB-"true"}
131 AR="cc -A";;
132 SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "}
133 CFLAGS=${CFLAGS-"-O3"}
134 LDSHARED=${LDSHARED-"cc -dy -KPIC -G"};;
135 SunOS\ 5*) SFLAGS=${CFLAGS-"-fast -xcg89 -KPIC -R."}
136 CFLAGS=${CFLAGS-"-fast -xcg89"}
137 LDSHARED=${LDSHARED-"cc -G"};;
138 SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"}
139 CFLAGS=${CFLAGS-"-O2"}
140 LDSHARED=${LDSHARED-"ld"};;
141 SunStudio\ 9*) SFLAGS=${CFLAGS-"-DUSE_MMAP -fast -xcode=pic32 -xtarget=ultra3 -xarch=v9b"}
142 CFLAGS=${CFLAGS-"-DUSE_MMAP -fast -xtarget=ultra3 -xarch=v9b"}
143 LDSHARED=${LDSHARED-"cc -xarch=v9b"};;
144 UNIX_System_V\ 4.2.0)
145 SFLAGS=${CFLAGS-"-KPIC -O"}
146 CFLAGS=${CFLAGS-"-O"}
147 LDSHARED=${LDSHARED-"cc -G"};;
148 UNIX_SV\ 4.2MP)
149 SFLAGS=${CFLAGS-"-Kconform_pic -O"}
150 CFLAGS=${CFLAGS-"-O"}
151 LDSHARED=${LDSHARED-"cc -G"};;
152 OpenUNIX\ 5)
153 SFLAGS=${CFLAGS-"-KPIC -O"}
154 CFLAGS=${CFLAGS-"-O"}
155 LDSHARED=${LDSHARED-"cc -G"};;
156 AIX*) # Courtesy of [email protected]
157 SFLAGS=${CFLAGS-"-O -qmaxmem=8192"}
158 CFLAGS=${CFLAGS-"-O -qmaxmem=8192"}
159 LDSHARED=${LDSHARED-"xlc -G"};;
160 # send working options for other systems to [email protected]
161 *) SFLAGS=${CFLAGS-"-O"}
162 CFLAGS=${CFLAGS-"-O"}
163 LDSHARED=${LDSHARED-"cc -shared"};;
164 esac
165 fi
166
167 SHAREDLIB=${SHAREDLIB-"libz$shared_ext"}
168 SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"}
169 SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"}
170
171 if testscip-shell system . . test. $shared -eq 1; then
172 echoscip-shell system . . echo. Checking for shared library support...
173 # we must test in two steps (cc then ld), required at least on SunOS 4.x
174 if testscip-shell system . . test. "`($CC -c $SFLAGS $test.c) 2>&1`" = "" &&
175 testscip-shell system . . test. "`($LDSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then
176 CFLAGS="$SFLAGS"
177 LIBS="$SHAREDLIBV"
178 echoscip-shell system . . echo. Building shared library $SHAREDLIBV with $CC.
179 elif testscip-shell system . . test. -z "$old_cc" -a -z "$old_cflags"; then
180 echoscip-shell system . . echo. No shared library support.
181 shared=0;
182 else
183 echoscip-shell system . . echo. 'No shared library support; try without defining CC and CFLAGS'
184 shared=0;
185 fi
186 fi
187 if testscip-shell system . . test. $shared -eq 0; then
188 LDSHARED="$CC"
189 echoscip-shell system . . echo. Building static library $LIBS version $VER with $CC.
190 else
191 LDFLAGS="-L. ${SHAREDLIBV}"
192 fi
193
194 catscip-shell system . . cat. > $test.c <<EOF
195 #include <unistd.h>
196 int main() { return 0; }
197 EOF
198 if testscip-shell system . . test. "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
199 sedscip-shell system . . sed. < zconf.in.h "/HAVE_UNISTD_H/s%0%1%scip-shell filesystem . . `/HAVE_UNISTD_H/s%0%1%`." > zconf.h
200 echoscip-shell system . . echo. "Checking for unistd.h... Yes."
201 else
202 cpscip-shell system . . cp. -p zconf.in.h zconf.h
203 echoscip-shell system . . echo. "Checking for unistd.h... No."
204 fi
205
206 catscip-shell system . . cat. > $test.c <<EOF
207 #include <stdio.h>
208 #include <stdarg.h>
209 #include "zconf.h"
210
211 int main()
212 {
213 #ifndef STDC
214 choke me
215 #endif
216
217 return 0;
218 }
219 EOF
220
221 if testscip-shell system . . test. "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
222 echoscip-shell system . . echo. "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()"
223
224 catscip-shell system . . cat. > $test.c <<EOF
225 #include <stdio.h>
226 #include <stdarg.h>
227
228 int mytest(char *fmt, ...)
229 {
230 char buf[20];
231 va_list ap;
232
233 va_start(ap, fmt);
234 vsnprintf(buf, sizeof(buf), fmt, ap);
235 va_end(ap);
236 return 0;
237 }
238
239 int main()
240 {
241 return (mytest("Hello%d\n", 1));
242 }
243 EOF
244
245 if testscip-shell system . . test. "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then
246 echoscip-shell system . . echo. "Checking for vsnprintf() in stdio.h... Yes."
247
248 catscip-shell system . . cat. >$test.c <<EOF
249 #include <stdio.h>
250 #include <stdarg.h>
251
252 int mytest(char *fmt, ...)
253 {
254 int n;
255 char buf[20];
256 va_list ap;
257
258 va_start(ap, fmt);
259 n = vsnprintf(buf, sizeof(buf), fmt, ap);
260 va_end(ap);
261 return n;
262 }
263
264 int main()
265 {
266 return (mytest("Hello%d\n", 1));
267 }
268 EOF
269
270 if testscip-shell system . . test. "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
271 echoscip-shell system . . echo. "Checking for return value of vsnprintf()... Yes."
272 else
273 CFLAGS="$CFLAGS -DHAS_vsnprintf_void"
274 echoscip-shell system . . echo. "Checking for return value of vsnprintf()... No."
275 echoscip-shell system . . echo. " WARNING: apparently vsnprintf() does not return a value. zlib"
276 echoscip-shell system . . echo. " can build but will be open to possible string-format security"
277 echoscip-shell system . . echo. " vulnerabilities."
278 fi
279 else
280 CFLAGS="$CFLAGS -DNO_vsnprintf"
281 echoscip-shell system . . echo. "Checking for vsnprintf() in stdio.h... No."
282 echoscip-shell system . . echo. " WARNING: vsnprintf() not found, falling back to vsprintf(). zlib"
283 echoscip-shell system . . echo. " can build but will be open to possible buffer-overflow security"
284 echoscip-shell system . . echo. " vulnerabilities."
285
286 catscip-shell system . . cat. >$test.c <<EOF
287 #include <stdio.h>
288 #include <stdarg.h>
289
290 int mytest(char *fmt, ...)
291 {
292 int n;
293 char buf[20];
294 va_list ap;
295
296 va_start(ap, fmt);
297 n = vsprintf(buf, fmt, ap);
298 va_end(ap);
299 return n;
300 }
301
302 int main()
303 {
304 return (mytest("Hello%d\n", 1));
305 }
306 EOF
307
308 if testscip-shell system . . test. "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
309 echoscip-shell system . . echo. "Checking for return value of vsprintf()... Yes."
310 else
311 CFLAGS="$CFLAGS -DHAS_vsprintf_void"
312 echoscip-shell system . . echo. "Checking for return value of vsprintf()... No."
313 echoscip-shell system . . echo. " WARNING: apparently vsprintf() does not return a value. zlib"
314 echoscip-shell system . . echo. " can build but will be open to possible string-format security"
315 echoscip-shell system . . echo. " vulnerabilities."
316 fi
317 fi
318 else
319 echoscip-shell system . . echo. "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()"
320
321 catscip-shell system . . cat. >$test.c <<EOF
322 #include <stdio.h>
323
324 int mytest()
325 {
326 char buf[20];
327
328 snprintf(buf, sizeof(buf), "%s", "foo");
329 return 0;
330 }
331
332 int main()
333 {
334 return (mytest());
335 }
336 EOF
337
338 if testscip-shell system . . test. "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then
339 echoscip-shell system . . echo. "Checking for snprintf() in stdio.h... Yes."
340
341 catscip-shell system . . cat. >$test.c <<EOF
342 #include <stdio.h>
343
344 int mytest()
345 {
346 char buf[20];
347
348 return snprintf(buf, sizeof(buf), "%s", "foo");
349 }
350
351 int main()
352 {
353 return (mytest());
354 }
355 EOF
356
357 if testscip-shell system . . test. "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
358 echoscip-shell system . . echo. "Checking for return value of snprintf()... Yes."
359 else
360 CFLAGS="$CFLAGS -DHAS_snprintf_void"
361 echoscip-shell system . . echo. "Checking for return value of snprintf()... No."
362 echoscip-shell system . . echo. " WARNING: apparently snprintf() does not return a value. zlib"
363 echoscip-shell system . . echo. " can build but will be open to possible string-format security"
364 echoscip-shell system . . echo. " vulnerabilities."
365 fi
366 else
367 CFLAGS="$CFLAGS -DNO_snprintf"
368 echoscip-shell system . . echo. "Checking for snprintf() in stdio.h... No."
369 echoscip-shell system . . echo. " WARNING: snprintf() not found, falling back to sprintf(). zlib"
370 echoscip-shell system . . echo. " can build but will be open to possible buffer-overflow security"
371 echoscip-shell system . . echo. " vulnerabilities."
372
373 catscip-shell system . . cat. >$test.c <<EOF
374 #include <stdio.h>
375
376 int mytest()
377 {
378 char buf[20];
379
380 return sprintf(buf, "%s", "foo");
381 }
382
383 int main()
384 {
385 return (mytest());
386 }
387 EOF
388
389 if testscip-shell system . . test. "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
390 echoscip-shell system . . echo. "Checking for return value of sprintf()... Yes."
391 else
392 CFLAGS="$CFLAGS -DHAS_sprintf_void"
393 echoscip-shell system . . echo. "Checking for return value of sprintf()... No."
394 echoscip-shell system . . echo. " WARNING: apparently sprintf() does not return a value. zlib"
395 echoscip-shell system . . echo. " can build but will be open to possible string-format security"
396 echoscip-shell system . . echo. " vulnerabilities."
397 fi
398 fi
399 fi
400
401 catscip-shell system . . cat. >$test.c <<EOF
402 #include <errno.h>
403 int main() { return 0; }
404 EOF
405 if testscip-shell system . . test. "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
406 echoscip-shell system . . echo. "Checking for errno.h... Yes."
407 else
408 echoscip-shell system . . echo. "Checking for errno.h... No."
409 CFLAGS="$CFLAGS -DNO_ERRNO_H"
410 fi
411
412 catscip-shell system . . cat. > $test.c <<EOF
413 #include <sys/types.h>
414 #include <sys/mman.h>
415 #include <sys/stat.h>
416 caddr_t hello() {
417 return mmap((caddr_t)0, (off_t)0, PROT_READ, MAP_SHARED, 0, (off_t)0);
418 }
419 EOF
420 if testscip-shell system . . test. "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
421 CFLAGS="$CFLAGS -DUSE_MMAP"
422 echoscip-shell system . . echo. Checking for mmap support... Yes.
423 else
424 echoscip-shell system . . echo. Checking for mmap support... No.
425 fi
426
427 CPP=${CPP-"$CC -E"}
428 case $CFLAGS in
429 *ASMV*)
430 if testscip-shell system . . test. "`nmscip-shell system . . nm. $test.o | grepscip-shell system . . grep. _hello`" = ""; then
431 CPP="$CPP -DNO_UNDERLINE"
432 echoscip-shell system . . echo. Checking for underline in external names... No.
433 else
434 echoscip-shell system . . echo. Checking for underline in external names... Yes.
435 fi;;
436 esac
437
438 rmscip-shell system . . rm. -f $test.[co] $test $test$shared_ext
439
440 # udpate Makefile
441 sedscip-shell system . . sed. < Makefile.in "
442 /^CC *=/s#=.*#=$CC#
443 /^CFLAGS *=/s#=.*#=$CFLAGS#
444 /^CPP *=/s#=.*#=$CPP#
445 /^LDSHARED *=/s#=.*#=$LDSHARED#
446 /^LIBS *=/s#=.*#=$LIBS#
447 /^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
448 /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
449 /^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
450 /^AR *=/s#=.*#=$AR#
451 /^RANLIB *=/s#=.*#=$RANLIB#
452 /^EXE *=/s#=.*#=$EXE#
453 /^prefix *=/s#=.*#=$prefix#
454 /^exec_prefix *=/s#=.*#=$exec_prefix#
455 /^libdir *=/s#=.*#=$libdir#
456 /^includedir *=/s#=.*#=$includedir#
457 /^mandir *=/s#=.*#=$mandir#
458 /^LDFLAGS *=/s#=.*#=$LDFLAGS#
459 " > Makefile