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:20:04 (GMT) |
commit | 1be58902bb8e8bd9a6b18a1d0610e690daf8b8e0 (patch) | |
tree | 7f62ca4f9462f120819bdd48c0e04cd3a531390c /configure.ac | |
parent | f9f131040baee643b0a458261dd0fd051cf8f520 (diff) | |
parent | 538b1317646f52658c2a896bbde4dce4246a9761 (diff) | |
download | hdf5-1be58902bb8e8bd9a6b18a1d0610e690daf8b8e0.zip hdf5-1be58902bb8e8bd9a6b18a1d0610e690daf8b8e0.tar.gz hdf5-1be58902bb8e8bd9a6b18a1d0610e690daf8b8e0.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:
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 59 |
1 files changed, 58 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index a74cd78..8585f5c 100644 --- a/configure.ac +++ b/configure.ac @@ -104,13 +104,14 @@ AC_SUBST([AR_FLAGS]) ## H5_CFLAGS (and company) are for CFLAGS that should be used on HDF5, but ## not exported to h5cc (or h5fc, etc.) ## -## H5_ECFLAGS is for warnings that should be treated as errors. +## H5_ECFLAGS (and company) are for warnings that should be treated as errors. ## AC_SUBST([H5_CFLAGS]) AC_SUBST([H5_ECFLAGS]) AC_SUBST([H5_CPPFLAGS]) AC_SUBST([H5_FCFLAGS]) AC_SUBST([H5_CXXFLAGS]) +AC_SUBST([H5_ECXXFLAGS]) AC_SUBST([H5_JNIFLAGS]) AC_SUBST([H5_JAVACFLAGS]) AC_SUBST([H5_JAVAFLAGS]) @@ -288,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). |