aboutsummaryrefslogtreecommitdiffstats
path: root/config/zfs-build.m4
diff options
context:
space:
mode:
authorRichard Yao <[email protected]>2014-09-23 13:31:33 -0400
committerBrian Behlendorf <[email protected]>2017-08-29 13:16:04 -0400
commit6f174823cef105860a11f757f092942653c17869 (patch)
treeb621bb3e7493c4bc10c7aba1efa9039f28630e09 /config/zfs-build.m4
parent1e0457e7f5384b0328ea499083120dd191d80c90 (diff)
Make --enable-debug fail when given bogus args
Currently, bogus options to --enable-debug become --disable-debug. That means that passing --enable-debug=true is analogous to --disable-debug, but the result is counterintuitive. We switch to AS_CASE to allow us to fail when given a bogus option. Also, we modify the text printed to clarify that --enable-debug enables assertions. Reviewed-by: Chunwei Chen <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes #2734
Diffstat (limited to 'config/zfs-build.m4')
-rw-r--r--config/zfs-build.m443
1 files changed, 25 insertions, 18 deletions
diff --git a/config/zfs-build.m4 b/config/zfs-build.m4
index 7651dc2c1..78a87aef7 100644
--- a/config/zfs-build.m4
+++ b/config/zfs-build.m4
@@ -6,30 +6,37 @@ AC_DEFUN([ZFS_AC_LICENSE], [
AC_MSG_RESULT([$ZFS_META_LICENSE])
])
+AC_DEFUN([ZFS_AC_DEBUG_ENABLE], [
+ KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror"
+ HOSTCFLAGS="${HOSTCFLAGS} -DDEBUG -Werror"
+ DEBUG_CFLAGS="-DDEBUG -Werror"
+ DEBUG_STACKFLAGS="-fstack-check"
+ DEBUG_ZFS="_with_debug"
+ AC_DEFINE(ZFS_DEBUG, 1, [zfs debugging enabled])
+])
+
+AC_DEFUN([ZFS_AC_DEBUG_DISABLE], [
+ KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG "
+ HOSTCFLAGS="${HOSTCFLAGS} -DNDEBUG "
+ DEBUG_CFLAGS="-DNDEBUG"
+ DEBUG_STACKFLAGS=""
+ DEBUG_ZFS="_without_debug"
+])
+
AC_DEFUN([ZFS_AC_DEBUG], [
- AC_MSG_CHECKING([whether debugging is enabled])
+ AC_MSG_CHECKING([whether assertion support will be enabled])
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
- [Enable generic debug support @<:@default=no@:>@])],
+ [Enable assertion support @<:@default=no@:>@])],
[],
[enable_debug=no])
- AS_IF([test "x$enable_debug" = xyes],
- [
- KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror"
- HOSTCFLAGS="${HOSTCFLAGS} -DDEBUG -Werror"
- DEBUG_CFLAGS="-DDEBUG -Werror"
- DEBUG_STACKFLAGS="-fstack-check"
- DEBUG_ZFS="_with_debug"
- AC_DEFINE(ZFS_DEBUG, 1, [zfs debugging enabled])
- ],
- [
- KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG "
- HOSTCFLAGS="${HOSTCFLAGS} -DNDEBUG "
- DEBUG_CFLAGS="-DNDEBUG"
- DEBUG_STACKFLAGS=""
- DEBUG_ZFS="_without_debug"
- ])
+ AS_CASE(["x$enable_debug"],
+ ["xyes"],
+ [ZFS_AC_DEBUG_ENABLE],
+ ["xno"],
+ [ZFS_AC_DEBUG_DISABLE],
+ [AC_MSG_ERROR([Unknown option $enable_debug])])
AC_SUBST(DEBUG_CFLAGS)
AC_SUBST(DEBUG_STACKFLAGS)