diff options
author | Larry Knox <lrknox@hdfgroup.org> | 2020-06-21 22:20:04 (GMT) |
---|---|---|
committer | Larry Knox <lrknox@hdfgroup.org> | 2020-06-21 22:42:59 (GMT) |
commit | e64ed323db7c98a246d3386a146f87003886040a (patch) | |
tree | 370d5edd9c2bd8310d1a04866bafdb26eb87700f /configure.ac | |
parent | 8e62f1fe7b38b630f1a41007a03341cb66dec4b3 (diff) | |
download | hdf5-e64ed323db7c98a246d3386a146f87003886040a.zip hdf5-e64ed323db7c98a246d3386a146f87003886040a.tar.gz hdf5-e64ed323db7c98a246d3386a146f87003886040a.tar.bz2 |
Merge pull request #2656 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:changes_1_12_merge to hdf5_1_12
* commit '538b1317646f52658c2a896bbde4dce4246a9761':
Squashed commit of the following:
Addition of clang-warnings flags
Update examples/teth5cc.sh.in for version 1.10.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index fee80b0..74dd933 100644 --- a/configure.ac +++ b/configure.ac @@ -289,6 +289,62 @@ 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]) + + # 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 + AC_MSG_RESULT([$CLANG_SANITIZE_CHECKS]) + + # 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 ## ---------------------------------------------------------------------- ## Determine build mode (debug, production, clean). |