autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Fix treatment of --enable-assert in AC_HEADER_ASSERT


From: William Pursell
Subject: Re: [PATCH] Fix treatment of --enable-assert in AC_HEADER_ASSERT
Date: Sun, 07 Dec 2008 15:26:58 +0000
User-agent: Thunderbird 2.0.0.18 (Macintosh/20081105)

Eric Blake wrote:

> According to William Pursell on 12/7/2008 12:11 AM:
>> +    Fix AC_HEADER_ASSERT to honor --enable-assert, rather than
>> +    treat --enable-assert and --disable-assert equivalently.
>> +    * lib/autoconf/headers.m4
>> +
> 
> Thanks for the idea; it is certainly a step in the right direction.
> However, would you mind resubmitting with some additional nits fixed?

I've applied your suggestions, and also added a warning
for the pathological case where a user does something like
"--enable-assert=kj".  It seems unnecessary, but probably
doesn't hurt.  How does one typically deal with that
sort of (ab)usage?  And why does "--disable-assert=kj" cause
configure to throw an "invalid feature name" warning,
but "--enable-assert=kj" works okay.  Is that a bug or
expected behavior?


commit b98bf0463331cba1e713c665167298bb9d6aaf75
Author: William Pursell <address@hidden>
Date:   Sun Dec 7 15:22:43 2008 +0000

    Fix AC_HEADER_ASSERT w.r.t. --enable-assert

diff --git a/ChangeLog b/ChangeLog
index a250ee2..bde246f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-12-06  William Pursell  <address@hidden>
+
+       Fix AC_HEADER_ASSERT to honor --enable-assert, rather than
+       treat --enable-assert and --disable-assert equivalently.
+       * lib/autoconf/headers.m4
+
 2008-12-05  William Pursell  <address@hidden>  (tiny change)

        Fix some typos and grammatical errors in documentation.
diff --git a/lib/autoconf/headers.m4 b/lib/autoconf/headers.m4
index f4a4528..1e3b78d 100644
--- a/lib/autoconf/headers.m4
+++ b/lib/autoconf/headers.m4
@@ -435,10 +435,15 @@ AC_DEFUN([AC_HEADER_ASSERT],
 [
   AC_MSG_CHECKING([whether to enable assertions])
   AC_ARG_ENABLE([assert],
-    [  --disable-assert        turn off assertions],
-    [AC_MSG_RESULT([no])
-     AC_DEFINE(NDEBUG, 1, [Define to 1 if assertions should be disabled.])],
-    [AC_MSG_RESULT(yes)])
+    AS_HELP_STRING([--disable-assert],[turn off assertions]),
+    AS_IF([test "x$enableval" = xno],
+      AC_DEFINE([NDEBUG], [1], [Define to 1 if assertions should be 
disabled.]),
+      [test "x$enableval" != xyes],
+      AC_MSG_WARN([invalid argument supplied to --enable-assert.])
+      [enable_assert=no]
+    )dnl
+  )
+  AC_MSG_RESULT([$enable_assert])
 ])


-- 
William Pursell




reply via email to

[Prev in Thread] Current Thread [Next in Thread]