diff options
Diffstat (limited to 'configure')
| -rwxr-xr-x | configure | 219 |
1 files changed, 216 insertions, 3 deletions
| @@ -72,8 +72,11 @@ if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then | |||
| 72 | SFLAGS=${CFLAGS-"-fPIC -O3"} | 72 | SFLAGS=${CFLAGS-"-fPIC -O3"} |
| 73 | CFLAGS="$cflags" | 73 | CFLAGS="$cflags" |
| 74 | case `(uname -s || echo unknown) 2>/dev/null` in | 74 | case `(uname -s || echo unknown) 2>/dev/null` in |
| 75 | Linux | linux) LDSHARED=${LDSHARED-"gcc -shared -Wl,-soname,libz.so.1"};; | 75 | Linux | linux) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1"};; |
| 76 | *) LDSHARED=${LDSHARED-"gcc -shared"};; | 76 | HP-UX*) LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"} |
| 77 | shared_ext='.sl' | ||
| 78 | SHAREDLIB='libz.sl';; | ||
| 79 | *) LDSHARED=${LDSHARED-"$cc -shared"};; | ||
| 77 | esac | 80 | esac |
| 78 | else | 81 | else |
| 79 | # find system name and corresponding cc options | 82 | # find system name and corresponding cc options |
| @@ -116,6 +119,10 @@ else | |||
| 116 | SFLAGS=${CFLAGS-"-Kconform_pic -O"} | 119 | SFLAGS=${CFLAGS-"-Kconform_pic -O"} |
| 117 | CFLAGS=${CFLAGS-"-O"} | 120 | CFLAGS=${CFLAGS-"-O"} |
| 118 | LDSHARED=${LDSHARED-"cc -G"};; | 121 | LDSHARED=${LDSHARED-"cc -G"};; |
| 122 | OpenUNIX\ 5) | ||
| 123 | SFLAGS=${CFLAGS-"-KPIC -O"} | ||
| 124 | CFLAGS=${CFLAGS-"-O"} | ||
| 125 | LDSHARED=${LDSHARED-"cc -G"};; | ||
| 119 | # send working options for other systems to support@gzip.org | 126 | # send working options for other systems to support@gzip.org |
| 120 | *) SFLAGS=${CFLAGS-"-O"} | 127 | *) SFLAGS=${CFLAGS-"-O"} |
| 121 | CFLAGS=${CFLAGS-"-O"} | 128 | CFLAGS=${CFLAGS-"-O"} |
| @@ -149,13 +156,219 @@ cat > $test.c <<EOF | |||
| 149 | int main() { return 0; } | 156 | int main() { return 0; } |
| 150 | EOF | 157 | EOF |
| 151 | if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then | 158 | if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then |
| 152 | CFLAGS="$CFLAGS -DHAVE_UNISTD_H" | 159 | sed < zconf.in.h "/HAVE_UNISTD_H/s%0%1%" > zconf.h |
| 153 | echo "Checking for unistd.h... Yes." | 160 | echo "Checking for unistd.h... Yes." |
| 154 | else | 161 | else |
| 162 | cp -p zconf.in.h zconf.h | ||
| 155 | echo "Checking for unistd.h... No." | 163 | echo "Checking for unistd.h... No." |
| 156 | fi | 164 | fi |
| 157 | 165 | ||
| 158 | cat > $test.c <<EOF | 166 | cat > $test.c <<EOF |
| 167 | #include <stdio.h> | ||
| 168 | #include <stdlib.h> | ||
| 169 | |||
| 170 | #if (defined(__MSDOS__) || defined(_WINDOWS) || defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__STDC__) || defined(__cplusplus) || defined(__OS2__)) && !defined(STDC) | ||
| 171 | # define STDC | ||
| 172 | #endif | ||
| 173 | |||
| 174 | int main() | ||
| 175 | { | ||
| 176 | #ifndef STDC | ||
| 177 | choke me | ||
| 178 | #endif | ||
| 179 | |||
| 180 | return 0; | ||
| 181 | } | ||
| 182 | EOF | ||
| 183 | |||
| 184 | if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then | ||
| 185 | echo "Checking whether to use vsnprintf() or snprintf()... using vsnprintf()" | ||
| 186 | |||
| 187 | cat > $test.c <<EOF | ||
| 188 | #include <stdio.h> | ||
| 189 | #include <stdarg.h> | ||
| 190 | |||
| 191 | int mytest(char *fmt, ...) | ||
| 192 | { | ||
| 193 | char buf[20]; | ||
| 194 | va_list ap; | ||
| 195 | |||
| 196 | va_start(ap, fmt); | ||
| 197 | vsnprintf(buf, sizeof(buf), fmt, ap); | ||
| 198 | va_end(ap); | ||
| 199 | return 0; | ||
| 200 | } | ||
| 201 | |||
| 202 | int main() | ||
| 203 | { | ||
| 204 | return (mytest("Hello%d\n", 1)); | ||
| 205 | } | ||
| 206 | EOF | ||
| 207 | |||
| 208 | if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then | ||
| 209 | echo "Checking for vsnprintf() in stdio.h... Yes." | ||
| 210 | |||
| 211 | cat >$test.c <<EOF | ||
| 212 | #include <stdio.h> | ||
| 213 | #include <stdarg.h> | ||
| 214 | |||
| 215 | int mytest(char *fmt, ...) | ||
| 216 | { | ||
| 217 | int i; | ||
| 218 | char buf[20]; | ||
| 219 | va_list ap; | ||
| 220 | |||
| 221 | va_start(ap, fmt); | ||
| 222 | i = vsnprintf(buf, sizeof(buf), fmt, ap); | ||
| 223 | va_end(ap); | ||
| 224 | return 0; | ||
| 225 | } | ||
| 226 | |||
| 227 | int main() | ||
| 228 | { | ||
| 229 | return (mytest("Hello%d\n", 1)); | ||
| 230 | } | ||
| 231 | EOF | ||
| 232 | |||
| 233 | if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then | ||
| 234 | echo "Checking for return value of vsnprintf()... Yes." | ||
| 235 | else | ||
| 236 | CFLAGS="$CFLAGS -DHAS_vsnprintf_void" | ||
| 237 | echo "Checking for return value of vsnprintf()... No." | ||
| 238 | echo " WARNING: apparently vsnprintf() does not return a value. zlib" | ||
| 239 | echo " can build but will be open to possible string-format security" | ||
| 240 | echo " vulnerabilities." | ||
| 241 | fi | ||
| 242 | else | ||
| 243 | CFLAGS="$CFLAGS -DNO_vsnprintf" | ||
| 244 | echo "Checking for vsnprintf() in stdio.h... No." | ||
| 245 | echo " WARNING: vsnprintf() not found, falling back to vsprintf(). zlib" | ||
| 246 | echo " can build but will be open to possible buffer-overflow security" | ||
| 247 | echo " vulnerabilities." | ||
| 248 | |||
| 249 | cat >$test.c <<EOF | ||
| 250 | #include <stdio.h> | ||
| 251 | #include <stdarg.h> | ||
| 252 | |||
| 253 | int mytest(char *fmt, ...) | ||
| 254 | { | ||
| 255 | int i; | ||
| 256 | char buf[20]; | ||
| 257 | va_list ap; | ||
| 258 | |||
| 259 | va_start(ap, fmt); | ||
| 260 | i = vsprintf(buf, fmt, ap); | ||
| 261 | va_end(ap); | ||
| 262 | return 0; | ||
| 263 | } | ||
| 264 | |||
| 265 | int main() | ||
| 266 | { | ||
| 267 | return (mytest("Hello%d\n", 1)); | ||
| 268 | } | ||
| 269 | EOF | ||
| 270 | |||
| 271 | if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then | ||
| 272 | echo "Checking for return value of vsprintf()... Yes." | ||
| 273 | else | ||
| 274 | CFLAGS="$CFLAGS -DHAS_vsprintf_void" | ||
| 275 | echo "Checking for return value of vsprintf()... No." | ||
| 276 | echo " WARNING: apparently vsprintf() does not return a value. zlib" | ||
| 277 | echo " can build but will be open to possible string-format security" | ||
| 278 | echo " vulnerabilities." | ||
| 279 | fi | ||
| 280 | fi | ||
| 281 | else | ||
| 282 | echo "Checking whether to use vsnprintf() or snprintf()... using snprintf()" | ||
| 283 | |||
| 284 | cat >$test.c <<EOF | ||
| 285 | #include <stdio.h> | ||
| 286 | #include <stdarg.h> | ||
| 287 | |||
| 288 | int mytest() | ||
| 289 | { | ||
| 290 | char buf[20]; | ||
| 291 | |||
| 292 | snprintf(buf, sizeof(buf), "%s", "foo"); | ||
| 293 | return 0; | ||
| 294 | } | ||
| 295 | |||
| 296 | int main() | ||
| 297 | { | ||
| 298 | return (mytest()); | ||
| 299 | } | ||
| 300 | EOF | ||
| 301 | |||
| 302 | if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then | ||
| 303 | echo "Checking for snprintf() in stdio.h... Yes." | ||
| 304 | |||
| 305 | cat >$test.c <<EOF | ||
| 306 | #include <stdio.h> | ||
| 307 | #include <stdarg.h> | ||
| 308 | |||
| 309 | int mytest(char *fmt, ...) | ||
| 310 | { | ||
| 311 | int i; | ||
| 312 | char buf[20]; | ||
| 313 | |||
| 314 | i = snprintf(buf, sizeof(buf), "%s", "foo"); | ||
| 315 | return 0; | ||
| 316 | } | ||
| 317 | |||
| 318 | int main() | ||
| 319 | { | ||
| 320 | return (mytest()); | ||
| 321 | } | ||
| 322 | EOF | ||
| 323 | |||
| 324 | if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then | ||
| 325 | echo "Checking for return value of snprintf()... Yes." | ||
| 326 | else | ||
| 327 | CFLAGS="$CFLAGS -DHAS_snprintf_void" | ||
| 328 | echo "Checking for return value of snprintf()... No." | ||
| 329 | echo " WARNING: apparently snprintf() does not return a value. zlib" | ||
| 330 | echo " can build but will be open to possible string-format security" | ||
| 331 | echo " vulnerabilities." | ||
| 332 | fi | ||
| 333 | else | ||
| 334 | CFLAGS="$CFLAGS -DNO_snprintf" | ||
| 335 | echo "Checking for snprintf() in stdio.h... No." | ||
| 336 | echo " WARNING: snprintf() not found, falling back to sprintf(). zlib" | ||
| 337 | echo " can build but will be open to possible buffer-overflow security" | ||
| 338 | echo " vulnerabilities." | ||
| 339 | |||
| 340 | cat >$test.c <<EOF | ||
| 341 | #include <stdio.h> | ||
| 342 | #include <stdarg.h> | ||
| 343 | |||
| 344 | int mytest(char *fmt, ...) | ||
| 345 | { | ||
| 346 | int i; | ||
| 347 | char buf[20]; | ||
| 348 | |||
| 349 | i = sprintf(buf, "%s", "foo"); | ||
| 350 | return 0; | ||
| 351 | } | ||
| 352 | |||
| 353 | int main() | ||
| 354 | { | ||
| 355 | return (mytest()); | ||
| 356 | } | ||
| 357 | EOF | ||
| 358 | |||
| 359 | if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then | ||
| 360 | echo "Checking for return value of sprintf()... Yes." | ||
| 361 | else | ||
| 362 | CFLAGS="$CFLAGS -DHAS_sprintf_void" | ||
| 363 | echo "Checking for return value of sprintf()... No." | ||
| 364 | echo " WARNING: apparently sprintf() does not return a value. zlib" | ||
| 365 | echo " can build but will be open to possible string-format security" | ||
| 366 | echo " vulnerabilities." | ||
| 367 | fi | ||
| 368 | fi | ||
| 369 | fi | ||
| 370 | |||
| 371 | cat >$test.c <<EOF | ||
| 159 | #include <errno.h> | 372 | #include <errno.h> |
| 160 | int main() { return 0; } | 373 | int main() { return 0; } |
| 161 | EOF | 374 | EOF |
