summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2020-11-25 03:57:48 (GMT)
committerGitHub <noreply@github.com>2020-11-25 03:57:48 (GMT)
commit7b9c5e124ba8e5ca4a44fa57e90f291b043a0eb2 (patch)
tree6783fe7872225ea7a6c770ed6d965a2c1de43ca7 /configure.ac
parentc56464fc36a78167c22b84e4cfef0e0c2aafce80 (diff)
downloadhdf5-7b9c5e124ba8e5ca4a44fa57e90f291b043a0eb2.zip
hdf5-7b9c5e124ba8e5ca4a44fa57e90f291b043a0eb2.tar.gz
hdf5-7b9c5e124ba8e5ca4a44fa57e90f291b043a0eb2.tar.bz2
Adds a configure/CMake option to control -Werror behavior (#119)
* Works in both Autotools and CMake * OFF by default * Reverts "always on" -Werror behavior released in 1.10.7
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac45
1 files changed, 37 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac
index f6b8423..2a02109 100644
--- a/configure.ac
+++ b/configure.ac
@@ -104,14 +104,10 @@ 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 (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])
@@ -2248,10 +2244,6 @@ if test "X-$DEV_WARNINGS" = X- ; then
DEV_WARNINGS=no
fi
-## Allow this variable to be substituted in
-## other files (src/libhdf5.settings.in, etc.)
-AC_SUBST([DEV_WARNINGS])
-
case "X-$DEV_WARNINGS" in
X-yes)
H5_CFLAGS="$H5_CFLAGS $DEVELOPER_WARNING_CFLAGS"
@@ -2267,6 +2259,43 @@ case "X-$DEV_WARNINGS" in
esac
## ----------------------------------------------------------------------
+## Check if we should consider certain compiler warnings as errors
+##
+## These should NOT be on by default as the risk of breakage is high
+## when compiling HDF5 on new (or new versions) of platforms and
+## compilers. It can also cause failures when header files we have no
+## control over (e.g. MPI, HDFS) raise warnings.
+##
+AC_MSG_CHECKING([enable warnings as errors])
+AC_ARG_ENABLE([warnings-as-errors],
+ [AS_HELP_STRING([--enable-warnings-as-errors],
+ [Determines whether certain warnings will be
+ considered errors. This is mainly for use
+ by HDF5 library developers.
+ [default=no]
+ ])],
+ [WARNINGS_AS_ERRORS=$enableval])
+
+## Set default
+if test "X-$WARNINGS_AS_ERRORS" = X- ; then
+ WARNINGS_AS_ERRORS=no
+fi
+
+case "X-$WARNINGS_AS_ERRORS" in
+ X-yes)
+ H5_CFLAGS="$H5_CFLAGS $H5_ECFLAGS"
+ H5_CXXFLAGS="$H5_CXXFLAGS $H5_ECXXFLAGS"
+ AC_MSG_RESULT([yes])
+ ;;
+ X-no)
+ AC_MSG_RESULT([no])
+ ;;
+ *)
+ AC_MSG_ERROR([Unrecognized value: $WARNINGS_AS_ERRORS])
+ ;;
+esac
+
+## ----------------------------------------------------------------------
## Check if the compiler should use profiling flags/settings
##
AC_MSG_CHECKING([profiling])