90 lines
2.8 KiB
Diff
90 lines
2.8 KiB
Diff
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||
|
From: Richard Yao <richard.yao@clusterhq.com>
|
||
|
Date: Tue, 23 Sep 2014 13:31:33 -0400
|
||
|
Subject: [PATCH] Make --enable-debug fail when given bogus args
|
||
|
MIME-Version: 1.0
|
||
|
Content-Type: text/plain; charset=UTF-8
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
|
||
|
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 <tuxoko@gmail.com>
|
||
|
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||
|
Signed-off-by: Richard Yao <richard.yao@clusterhq.com>
|
||
|
Closes #2734
|
||
|
(cherry picked from commit 0f1ff38476ba255eb1f066f675c8721168ff2295)
|
||
|
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
|
||
|
---
|
||
|
config/zfs-build.m4 | 43 +++++++++++++++++++++++++------------------
|
||
|
1 file 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)
|
||
|
--
|
||
|
2.14.2
|
||
|
|