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 23:27:48 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

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

> I'll apply your patch later,
> 
> >    AC_ARG_ENABLE([assert],
> > +    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])

Paolo, did you run this through the testsuite?  I ran my version through, and 
noticed a couple of problems: if the user didn't specify --{en,dis}able-assert, 
then the AC_MSG_RESULT prints nothing.  Also, AC_MSG_WARN must be quoted.

Here's the incremental patch I committed to match the final results posted in 
my earlier mail.  In addition to providing a fourth argument to AC_ARG_ENABLE 
to guarantee a printout, I also had to change the name of the variable to live 
in the ac_ namespace to pass the testsuite.

diff --git a/ChangeLog b/ChangeLog
index 8a18ebf..17eadc7 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-06  William Pursell  <address@hidden>  (tiny change)
 
        Fix AC_HEADER_ASSERT to honor --enable-assert, rather than
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 7b3b9d3..7fe94af 100644
--- a/lib/autoconf/headers.m4
+++ b/lib/autoconf/headers.m4
@@ -436,13 +436,15 @@ AC_DEFUN([AC_HEADER_ASSERT],
   AC_MSG_CHECKING([whether to enable assertions])
   AC_ARG_ENABLE([assert],
     [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.]),
+    [ac_enable_assert=$enableval
+     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]
-  ])])
-  AC_MSG_RESULT([$enable_assert])
+      [AC_MSG_WARN([invalid argument supplied to --enable-assert])
+      ac_enable_assert=no])],
+    [ac_enable_assert=no])
+  AC_MSG_RESULT([$ac_enable_assert])
 ])
 
 






reply via email to

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