@@ -87,6 +87,7 @@ build64=0
87
87
gcc=0
88
88
warn=0
89
89
debug=0
90
+ sanitize=0
90
91
old_cc=" $CC "
91
92
old_cflags=" $CFLAGS "
92
93
OBJC=' $(OBJZ) $(OBJG)'
@@ -137,6 +138,7 @@ case "$1" in
137
138
-c* | --const) zconst=1; shift ;;
138
139
-w* | --warn) warn=1; shift ;;
139
140
-d* | --debug) debug=1; shift ;;
141
+ --sanitize) sanitize=1; shift ;;
140
142
* )
141
143
echo " unknown option: $1 " | tee -a configure.log
142
144
echo " $0 --help for help" | tee -a configure.log
@@ -165,8 +167,14 @@ extern int getchar();
165
167
int hello() {return getchar();}
166
168
EOF
167
169
168
- test -z " $CC " && echo Checking for ${CROSS_PREFIX} gcc... | tee -a configure.log
169
- cc=${CC-${CROSS_PREFIX} gcc}
170
+ if test -z " $CC " ; then
171
+ echo Checking for ${CROSS_PREFIX} gcc... | tee -a configure.log
172
+ if ${CROSS_PREFIX} gcc -v > /dev/null 2>&1 ; then
173
+ cc=${CROSS_PREFIX} gcc
174
+ else
175
+ cc=${CROSS_PREFIX} cc
176
+ fi
177
+ fi
170
178
cflags=${CFLAGS-" -O3" }
171
179
# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
172
180
case " $cc " in
@@ -199,6 +207,9 @@ if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then
199
207
CFLAGS=" ${CFLAGS} -Wall -Wextra -pedantic"
200
208
fi
201
209
fi
210
+ if test $sanitize -eq 1; then
211
+ CFLAGS=" ${CFLAGS} -fsanitize=address"
212
+ fi
202
213
if test $debug -eq 1; then
203
214
CFLAGS=" ${CFLAGS} -DZLIB_DEBUG"
204
215
SFLAGS=" ${SFLAGS} -DZLIB_DEBUG"
@@ -367,8 +378,11 @@ else
367
378
try ()
368
379
{
369
380
show $*
370
- ( $* ) >> configure.log 2>&1
381
+ got= ` ( $* ) 2>&1 `
371
382
ret=$?
383
+ if test " $got " ! = " " ; then
384
+ printf " %s\n" " $got " >> configure.log
385
+ fi
372
386
if test $ret -ne 0; then
373
387
echo " (exit code " $ret " )" >> configure.log
374
388
fi
@@ -381,8 +395,11 @@ tryboth()
381
395
show $*
382
396
got=` ( $* ) 2>&1 `
383
397
ret=$?
384
- printf %s " $got " >> configure.log
398
+ if test " $got " ! = " " ; then
399
+ printf " %s\n" " $got " >> configure.log
400
+ fi
385
401
if test $ret -ne 0; then
402
+ echo " (exit code " $ret " )" >> configure.log
386
403
return $ret
387
404
fi
388
405
test " $got " = " "
@@ -457,17 +474,11 @@ size_t dummy = 0;
457
474
EOF
458
475
if try $CC -c $CFLAGS $test .c; then
459
476
echo " Checking for size_t... Yes." | tee -a configure.log
460
- need_sizet=0
461
477
else
462
478
echo " Checking for size_t... No." | tee -a configure.log
463
- need_sizet=1
464
- fi
465
-
466
- echo >> configure.log
467
-
468
- # find the size_t integer type, if needed
469
- if test $need_sizet -eq 1; then
470
- cat > $test .c << EOF
479
+ # find a size_t integer type
480
+ # check for long long
481
+ cat > $test .c << EOF
471
482
long long dummy = 0;
472
483
EOF
473
484
if try $CC -c $CFLAGS $test .c; then
@@ -495,17 +506,13 @@ EOF
495
506
if try $CC $CFLAGS -o $test $test .c; then
496
507
sizet=` ./$test `
497
508
echo " Checking for a pointer-size integer type..." $sizet " ." | tee -a configure.log
509
+ CFLAGS=" ${CFLAGS} -DNO_SIZE_T=${sizet} "
510
+ SFLAGS=" ${SFLAGS} -DNO_SIZE_T=${sizet} "
498
511
else
499
- echo " Failed to find a pointer-size integer type." | tee -a configure.log
500
- leave 1
512
+ echo " Checking for a pointer-size integer type... not found." | tee -a configure.log
501
513
fi
502
514
fi
503
515
504
- if test $need_sizet -eq 1; then
505
- CFLAGS=" ${CFLAGS} -DNO_SIZE_T=${sizet} "
506
- SFLAGS=" ${SFLAGS} -DNO_SIZE_T=${sizet} "
507
- fi
508
-
509
516
echo >> configure.log
510
517
511
518
# check for large file support, and if none, check for fseeko()
@@ -849,7 +856,6 @@ echo SHAREDLIBV = $SHAREDLIBV >> configure.log
849
856
echo STATICLIB = $STATICLIB >> configure.log
850
857
echo TEST = $TEST >> configure.log
851
858
echo VER = $VER >> configure.log
852
- echo Z_U4 = $Z_U4 >> configure.log
853
859
echo SRCDIR = $SRCDIR >> configure.log
854
860
echo exec_prefix = $exec_prefix >> configure.log
855
861
echo includedir = $includedir >> configure.log
0 commit comments