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