summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorRich Ercolani <[email protected]>2021-06-07 15:29:27 -0400
committerBrian Behlendorf <[email protected]>2021-06-09 13:05:34 -0700
commit2f23f0f940774a3470689eef2b583cf5ab901020 (patch)
tree866f93225ab9a56950d9d1a5ce4d8e48b56cf459 /config
parenta377bde727cbda26288851d055a9f95db0559bfa (diff)
Force --enable-debug on FreeBSD if INVARIANTS is set
There's already logic to force INVARIANTS on for building if it's present in the running kernel; however, not having DEBUG enabled when DEBUG and INVARIANTS are can cause strange panics. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Rich Ercolani <[email protected]> Closes #12185 Closes #12163
Diffstat (limited to 'config')
-rw-r--r--config/zfs-build.m417
1 files changed, 17 insertions, 0 deletions
diff --git a/config/zfs-build.m4 b/config/zfs-build.m4
index c4fe07c81..1af4356cd 100644
--- a/config/zfs-build.m4
+++ b/config/zfs-build.m4
@@ -34,6 +34,9 @@ dnl # When debugging is enabled:
dnl # - Enable all ASSERTs (-DDEBUG)
dnl # - Promote all compiler warnings to errors (-Werror)
dnl #
+dnl # (If INVARIANTS is detected, we need to force DEBUG, or strange panics
+dnl # can ensue.)
+dnl #
AC_DEFUN([ZFS_AC_DEBUG], [
AC_MSG_CHECKING([whether assertion support will be enabled])
AC_ARG_ENABLE([debug],
@@ -49,6 +52,20 @@ AC_DEFUN([ZFS_AC_DEBUG], [
[ZFS_AC_DEBUG_DISABLE],
[AC_MSG_ERROR([Unknown option $enable_debug])])
+ AS_CASE(["x$enable_invariants"],
+ ["xyes"],
+ [],
+ ["xno"],
+ [],
+ [ZFS_AC_DEBUG_INVARIANTS_DETECT])
+
+ AS_CASE(["x$enable_invariants"],
+ ["xyes"],
+ [ZFS_AC_DEBUG_ENABLE],
+ ["xno"],
+ [],
+ [AC_MSG_ERROR([Unknown option $enable_invariants])])
+
AC_SUBST(DEBUG_CFLAGS)
AC_SUBST(DEBUG_CPPFLAGS)
AC_SUBST(DEBUG_LDFLAGS)