@@ -87,6 +87,7 @@ build64=0
8787gcc=0
8888warn=0
8989debug=0
90+ sanitize=0
9091old_cc=" $CC "
9192old_cflags=" $CFLAGS "
9293OBJC=' $(OBJZ) $(OBJG)'
@@ -137,6 +138,7 @@ case "$1" in
137138 -c* | --const) zconst=1; shift ;;
138139 -w* | --warn) warn=1; shift ;;
139140 -d* | --debug) debug=1; shift ;;
141+ --sanitize) sanitize=1; shift ;;
140142 * )
141143 echo " unknown option: $1 " | tee -a configure.log
142144 echo " $0 --help for help" | tee -a configure.log
@@ -165,8 +167,14 @@ extern int getchar();
165167int hello() {return getchar();}
166168EOF
167169
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
170178cflags=${CFLAGS-" -O3" }
171179# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
172180case " $cc " in
@@ -199,6 +207,9 @@ if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then
199207 CFLAGS=" ${CFLAGS} -Wall -Wextra -pedantic"
200208 fi
201209 fi
210+ if test $sanitize -eq 1; then
211+ CFLAGS=" ${CFLAGS} -fsanitize=address"
212+ fi
202213 if test $debug -eq 1; then
203214 CFLAGS=" ${CFLAGS} -DZLIB_DEBUG"
204215 SFLAGS=" ${SFLAGS} -DZLIB_DEBUG"
@@ -367,8 +378,11 @@ else
367378 try ()
368379 {
369380 show $*
370- ( $* ) >> configure.log 2>&1
381+ got= ` ( $* ) 2>&1 `
371382 ret=$?
383+ if test " $got " ! = " " ; then
384+ printf " %s\n" " $got " >> configure.log
385+ fi
372386 if test $ret -ne 0; then
373387 echo " (exit code " $ret " )" >> configure.log
374388 fi
@@ -381,8 +395,11 @@ tryboth()
381395 show $*
382396 got=` ( $* ) 2>&1 `
383397 ret=$?
384- printf %s " $got " >> configure.log
398+ if test " $got " ! = " " ; then
399+ printf " %s\n" " $got " >> configure.log
400+ fi
385401 if test $ret -ne 0; then
402+ echo " (exit code " $ret " )" >> configure.log
386403 return $ret
387404 fi
388405 test " $got " = " "
@@ -457,17 +474,11 @@ size_t dummy = 0;
457474EOF
458475if try $CC -c $CFLAGS $test .c; then
459476 echo " Checking for size_t... Yes." | tee -a configure.log
460- need_sizet=0
461477else
462478 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
471482long long dummy = 0;
472483EOF
473484 if try $CC -c $CFLAGS $test .c; then
@@ -495,17 +506,13 @@ EOF
495506 if try $CC $CFLAGS -o $test $test .c; then
496507 sizet=` ./$test `
497508 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} "
498511 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
501513 fi
502514fi
503515
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-
509516echo >> configure.log
510517
511518# check for large file support, and if none, check for fseeko()
@@ -849,7 +856,6 @@ echo SHAREDLIBV = $SHAREDLIBV >> configure.log
849856echo STATICLIB = $STATICLIB >> configure.log
850857echo TEST = $TEST >> configure.log
851858echo VER = $VER >> configure.log
852- echo Z_U4 = $Z_U4 >> configure.log
853859echo SRCDIR = $SRCDIR >> configure.log
854860echo exec_prefix = $exec_prefix >> configure.log
855861echo includedir = $includedir >> configure.log
0 commit comments