summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2020-06-02 20:53:58 (GMT)
committerLarry Knox <lrknox@hdfgroup.org>2020-06-02 20:53:58 (GMT)
commitf7bc306c19a3bd8f9a31a78d81a7bb5160bbbaf8 (patch)
tree9d65d1c99634e6bdd9cdcc969f96a12127b7ed6f /configure.ac
parent0b9979f0752caf7283a0bc367d3bcd4d0b151480 (diff)
downloadhdf5-f7bc306c19a3bd8f9a31a78d81a7bb5160bbbaf8.zip
hdf5-f7bc306c19a3bd8f9a31a78d81a7bb5160bbbaf8.tar.gz
hdf5-f7bc306c19a3bd8f9a31a78d81a7bb5160bbbaf8.tar.bz2
Add files for adding warning flags for clang compilers in autotools
configure.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac52
1 files changed, 52 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index db0cddf..50f823e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -289,6 +289,58 @@ while test -n "$hname"; do
test "$hname_tmp" = "$hname" && break
done
+##
+## Enable/disable sanitizer checks for clang compilers, initially address sanitizer
+##
+AC_MSG_CHECKING([for clang sanitizer checks])
+AC_ARG_ENABLE([sanitize-checks],
+ [AS_HELP_STRING([--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]
+ ])],
+ [CLANG_SANITIZE_CHECKS=$enableval])
+
+# Set default
+if test "X-$CLANG_SANITIZE_CHECKS" = X- ; then
+ CLANG_SANITIZE_CHECKS=none
+fi
+
+if test "X$CC_BASENAME" = "Xclang"; then
+ AC_SUBST([CLANG_SANITIZE_CHECKS])
+
+ ## These are all the packages that use H5*_DEBUG.
+ ## There is no harm in specifying a package not in this list;
+ ## you'll just get an unused H5<pkg>_DEBUG symbol.
+ ##
+ ## Some packages that define debug checks or output are
+ ## too specialized or have huge performance hits. These
+ ## are not listed in the "all" packages list.
+ ##
+ ##all_packages="Address"
+
+ case "X-$CLANG_SANITIZE_CHECKS" in
+ X-no|X-none)
+ CLANG_SANITIZE_CHECKS=none
+ CLANG_SANITIZE_LIST=
+ ;;
+ *)
+ CLANG_SANITIZE_LIST=$CLANG_SANITIZE_CHECKS
+ ;;
+ esac
+ AC_MSG_RESULT([$CLANG_SANITIZE_CHECKS])
+
+ ## Define H5*_DEBUG symbols that control package output
+ ## NOTE: No sanity checking done here!
+ if test -n "$CLANG_SANITIZE_LIST"; then
+ H5_CFLAGS="$H5_CFLAGS -fno-omit-frame-pointer"
+ for sanitizer in `echo $CLANG_SANITIZE_LIST`; do
+ H5_CFLAGS="$H5_CFLAGS -fsanitize=${sanitizer}"
+ done
+ fi
+fi
## ----------------------------------------------------------------------
## Determine build mode (debug, production, clean).