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: Eric Blake
Subject: Re: [PATCH] Fix treatment of --enable-assert in AC_HEADER_ASSERT
Date: Mon, 8 Dec 2008 22:14:09 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Paolo Bonzini <bonzini <at> gnu.org> writes:

> 
> The error message is a bug, but the error is right because
> --disable-assert is just a synonym for --enable-assert=no (and as such
> cannot accept parameters).

We'll have to fix the poor error message separately.

> 
> I'll apply your patch later, just note that...
> 
> >    AC_ARG_ENABLE([assert],
> > +    AS_HELP_STRING([--disable-assert],[turn off assertions]),
> 
> ... all arguments of AC_ARG_ENABLE have to be quoted (the number of
> cases in which you do not quote arguments that invoke macros, can be
> counted on a single hand probably).

Here's the final patch that I will be pushing, which uses proper quoting.  I'm 
also syncing this over to gnulib's m4/assert.m4.

>From 902370dae0e29a0fad59fc5111fe0644d6ee943e Mon Sep 17 00:00:00 2001
From: William Pursell <address@hidden>
Date: Mon, 8 Dec 2008 14:16:38 -0700
Subject: [PATCH] Fix AC_HEADER_ASSERT w.r.t. --enable-assert.

* lib/autoconf/headers.m4 (AC_HEADER_ASSERT): Honor --enable-assert,
rather than treating it as a synonym for --disable-assert.
* NEWS: Document the fix.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog               |    8 ++++++++
 NEWS                    |    3 +++
 lib/autoconf/headers.m4 |   13 +++++++++----
 3 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a250ee2..16e8660 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-12-08  William Pursell  <address@hidden>  (tiny change)
+       and Eric Blake  <address@hidden>
+
+       Fix AC_HEADER_ASSERT w.r.t. --enable-assert.
+       * lib/autoconf/headers.m4 (AC_HEADER_ASSERT): Honor --enable-assert,
+       rather than treating it as a synonym for --disable-assert.
+       * NEWS: Document the fix.
+
 2008-12-05  William Pursell  <address@hidden>  (tiny change)
 
        Fix some typos and grammatical errors in documentation.
diff --git a/NEWS b/NEWS
index 86bf8d5..65e5486 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,9 @@ GNU Autoconf NEWS - User visible changes.
 
 ** AC_LANG_ERLANG works once again (regression introduced in 2.61a).
 
+** AC_HEADER_ASSERT is fixed so that './configure --enable-assert' no
+   longer mistakenly disables assertions.
+
 ** Autotest testsuites accept an option --jobs[=N] for parallel testing.
 
 ** Autotest testsuites do not attempt to write startup error messages
diff --git a/lib/autoconf/headers.m4 b/lib/autoconf/headers.m4
index f4a4528..91eea23 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])],
+    [enable_assert=no])
+  AC_MSG_RESULT([$enable_assert])
 ])
 
 
-- 
1.6.0.4








reply via email to

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