]> git.lizzy.rs Git - zlib.git/commitdiff
Separate out address sanitizing from warnings in configure.
authorMark Adler <madler@alumni.caltech.edu>
Sun, 27 Mar 2022 08:05:08 +0000 (01:05 -0700)
committerMark Adler <madler@alumni.caltech.edu>
Sun, 27 Mar 2022 08:54:17 +0000 (01:54 -0700)
configure

index 1cd4fe57a15060b418eb8f53580d7a2ce641a557..98156e77ac0c29deb0d7cc73707652cad8db07f6 100755 (executable)
--- a/configure
+++ b/configure
@@ -87,6 +87,7 @@ build64=0
 gcc=0
 warn=0
 debug=0
+sanitize=0
 old_cc="$CC"
 old_cflags="$CFLAGS"
 OBJC='$(OBJZ) $(OBJG)'
@@ -137,6 +138,7 @@ case "$1" in
     -c* | --const) zconst=1; shift ;;
     -w* | --warn) warn=1; shift ;;
     -d* | --debug) debug=1; shift ;;
+    --sanitize) sanitize=1; shift ;;
     *)
       echo "unknown option: $1" | tee -a configure.log
       echo "$0 --help for help" | tee -a configure.log
@@ -194,11 +196,14 @@ if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then
   fi
   if test "$warn" -eq 1; then
     if test "$zconst" -eq 1; then
-      CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -pedantic -DZLIB_CONST -fsanitize=address"
+      CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -pedantic -DZLIB_CONST"
     else
-      CFLAGS="${CFLAGS} -Wall -Wextra -pedantic -fsanitize=address"
+      CFLAGS="${CFLAGS} -Wall -Wextra -pedantic"
     fi
   fi
+  if test $sanitize -eq 1; then
+    CFLAGS="${CFLAGS} -fsanitize=address"
+  fi
   if test $debug -eq 1; then
     CFLAGS="${CFLAGS} -DZLIB_DEBUG"
     SFLAGS="${SFLAGS} -DZLIB_DEBUG"