summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure65
1 files changed, 64 insertions, 1 deletions
diff --git a/configure b/configure
index 924fcf0..8165a52 100755
--- a/configure
+++ b/configure
@@ -789,6 +789,7 @@ ac_ct_CC
LDFLAGS
CFLAGS
CC
+CLANG_SANITIZE_CHECKS
UNAME_INFO
enable_static
enable_shared
@@ -902,6 +903,7 @@ ac_user_opts='
enable_option_checking
enable_silent_rules
enable_maintainer_mode
+enable_sanitize_checks
enable_dependency_tracking
enable_unsupported
enable_fortran
@@ -1592,6 +1594,12 @@ Optional Features:
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
+ --enable-sanitize-checks=address
+ (clang/clang++ compilers only) Enable sanitize
+ checks. Address is useful for detecting issues
+ dealing with memory. See AddressSanitizer in
+ config/sanitizer/README.md for more information.
+ [default=none]
--enable-dependency-tracking
do not reject slow dependency extractors
--disable-dependency-tracking
@@ -3897,7 +3905,7 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
## H5_CFLAGS (and company) are for CFLAGS that should be used on HDF5, but
## not exported to h5cc (or h5fc, etc.)
##
-## H5_ECFLAGS and H5_ECXXFLAGS are for warnings that should be treated as errors.
+## H5_ECFLAGS (and company) are for warnings that should be treated as errors.
##
@@ -4121,6 +4129,61 @@ $as_echo "no" >&6; }
test "$hname_tmp" = "$hname" && break
done
+##
+## Enable/disable sanitizer checks for clang compilers, initially address sanitizer
+##
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for clang sanitizer checks" >&5
+$as_echo_n "checking for clang sanitizer checks... " >&6; }
+# Check whether --enable-sanitize-checks was given.
+if test "${enable_sanitize_checks+set}" = set; then :
+ enableval=$enable_sanitize_checks; CLANG_SANITIZE_CHECKS=$enableval
+fi
+
+
+# Set default
+if test "X-$CLANG_SANITIZE_CHECKS" = X- ; then
+ CLANG_SANITIZE_CHECKS=none
+fi
+
+if test "X$CC_BASENAME" = "Xclang"; then
+
+
+ # There are several sanitizer tools. At present we are testing
+ # and describing only -fsanitizer=address with autotools.
+ case "X-$CLANG_SANITIZE_CHECKS" in
+ X-no|X-none)
+ CLANG_SANITIZE_CHECKS=none
+ CLANG_SANITIZE_LIST=
+ ;;
+ *)
+ CLANG_SANITIZE_LIST=$CLANG_SANITIZE_CHECKS
+ ;;
+ esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CLANG_SANITIZE_CHECKS" >&5
+$as_echo "$CLANG_SANITIZE_CHECKS" >&6; }
+
+ # Other tools can be added to the list of checks
+ # The clang compiler doesn't support some of them; they should be
+ # checked before adding them to the list in the help message.
+ # The sanitizers/sanitizers.cmake file lists these options:
+ # address, memory, memoryWithOrigins, undefined, thread, leak,
+ # 'address;undefined'. Which and which combinations of these are
+ # supported varies by compiler version, but unsupported options
+ # or combinations will result in configure errors reported in config.log.
+ # Comma separated lists of sanitize options wil be entered intact in
+ # one -fsanitize=<list> flag. Space separated lists will be entered in
+ # separate -fsanitize=<item> flags.
+ # NOTE: No sanity checking done here!
+ if test -n "$CLANG_SANITIZE_LIST"; then
+ H5_CFLAGS="$H5_CFLAGS -fno-omit-frame-pointer"
+ H5_CXXFLAGS="$H5_CXXFLAGS -fno-omit-frame-pointer"
+ for sanitizer in `echo $CLANG_SANITIZE_LIST`; do
+ H5_CFLAGS="$H5_CFLAGS -fsanitize=${sanitizer}"
+ H5_CXXFLAGS="$H5_CXXFLAGS -fsanitize=${sanitizer}"
+ done
+ fi
+fi
+
## ----------------------------------------------------------------------
## Some built-in configure checks can only see CFLAGS (not AM_CFLAGS), so
## we need to add this in so configure works as intended. We will need to