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 <tuxoko@gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@clusterhq.com>
Closes #2734
This commit is contained in:
Richard Yao 2014-09-23 13:31:33 -04:00 committed by Tony Hutter
parent e3b28e16ce
commit 0f1ff38476
1 changed files with 25 additions and 18 deletions

View File

@ -6,30 +6,37 @@ AC_DEFUN([ZFS_AC_LICENSE], [
AC_MSG_RESULT([$ZFS_META_LICENSE]) AC_MSG_RESULT([$ZFS_META_LICENSE])
]) ])
AC_DEFUN([ZFS_AC_DEBUG], [ AC_DEFUN([ZFS_AC_DEBUG_ENABLE], [
AC_MSG_CHECKING([whether debugging is enabled])
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[Enable generic debug support @<:@default=no@:>@])],
[],
[enable_debug=no])
AS_IF([test "x$enable_debug" = xyes],
[
KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror" KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror"
HOSTCFLAGS="${HOSTCFLAGS} -DDEBUG -Werror" HOSTCFLAGS="${HOSTCFLAGS} -DDEBUG -Werror"
DEBUG_CFLAGS="-DDEBUG -Werror" DEBUG_CFLAGS="-DDEBUG -Werror"
DEBUG_STACKFLAGS="-fstack-check" DEBUG_STACKFLAGS="-fstack-check"
DEBUG_ZFS="_with_debug" DEBUG_ZFS="_with_debug"
AC_DEFINE(ZFS_DEBUG, 1, [zfs debugging enabled]) AC_DEFINE(ZFS_DEBUG, 1, [zfs debugging enabled])
], ])
[
AC_DEFUN([ZFS_AC_DEBUG_DISABLE], [
KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG " KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG "
HOSTCFLAGS="${HOSTCFLAGS} -DNDEBUG " HOSTCFLAGS="${HOSTCFLAGS} -DNDEBUG "
DEBUG_CFLAGS="-DNDEBUG" DEBUG_CFLAGS="-DNDEBUG"
DEBUG_STACKFLAGS="" DEBUG_STACKFLAGS=""
DEBUG_ZFS="_without_debug" DEBUG_ZFS="_without_debug"
]) ])
AC_DEFUN([ZFS_AC_DEBUG], [
AC_MSG_CHECKING([whether assertion support will be enabled])
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[Enable assertion support @<:@default=no@:>@])],
[],
[enable_debug=no])
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_CFLAGS)
AC_SUBST(DEBUG_STACKFLAGS) AC_SUBST(DEBUG_STACKFLAGS)