Add memory sanitizer to configure (--memory).
This also adds --address for the address sanitizer, in addition to
the existing --sanitizer. -fno-omit-frame-pointer has been added
for both sanitizers to improve the error reporting.
diff --git a/configure b/configure
index 633b0f4..2b6993c 100755
--- a/configure
+++ b/configure
@@ -90,7 +90,8 @@
gcc=0
warn=0
debug=0
-sanitize=0
+address=0
+memory=0
old_cc="$CC"
old_cflags="$CFLAGS"
OBJC='$(OBJZ) $(OBJG)'
@@ -102,7 +103,7 @@
if test "$*" != "0"; then
echo "** $0 aborting." | tee -a configure.log
fi
- rm -f $test.[co] $test $test$shared_ext $test.gcno ./--version
+ rm -rf $test.[co] $test $test$shared_ext $test.gcno $test.dSYM ./--version
echo -------------------- >> configure.log
echo >> configure.log
echo >> configure.log
@@ -141,7 +142,9 @@
-c* | --const) zconst=1; shift ;;
-w* | --warn) warn=1; shift ;;
-d* | --debug) debug=1; shift ;;
- --sanitize) sanitize=1; shift ;;
+ --sanitize) address=1; shift ;;
+ --address) address=1; shift ;;
+ --memory) memory=1; shift ;;
*)
echo "unknown option: $1" | tee -a configure.log
echo "$0 --help for help" | tee -a configure.log
@@ -211,8 +214,11 @@
CFLAGS="${CFLAGS} -Wall -Wextra"
fi
fi
- if test $sanitize -eq 1; then
- CFLAGS="${CFLAGS} -g -fsanitize=address"
+ if test $address -eq 1; then
+ CFLAGS="${CFLAGS} -g -fsanitize=address -fno-omit-frame-pointer"
+ fi
+ if test $memory -eq 1; then
+ CFLAGS="${CFLAGS} -g -fsanitize=memory -fno-omit-frame-pointer"
fi
if test $debug -eq 1; then
CFLAGS="${CFLAGS} -DZLIB_DEBUG"