autoconf-patches
[Top][All Lists]
Advanced

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

Re: AC_DEFINE_UNQUOTED and autoheader


From: Ralf Wildenhues
Subject: Re: AC_DEFINE_UNQUOTED and autoheader
Date: Sat, 27 May 2006 14:06:40 +0200
User-agent: Mutt/1.5.11

* Ben Pfaff wrote on Thu, May 25, 2006 at 08:42:30PM CEST:
> Debian Bug #179086 (CC'd) states the following:
> 
>     I have code like
> 
>         ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
>         -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
>         AC_DEFINE_UNQUOTED($ac_tr_lib)
> 
>     which, is intended to define certain preprocessor variables
>     depending on the value it is given.

It does 

>                                           Under recent versions of
>     autoconf, there is no acconfig.h

This is true.

>                                       so the information it would
>     have provided is now provided by autoheader.

This conclusion is not right.  There exist AH_TOP, AH_BOTTOM,
AH_TEMPLATE, and AH_VERBATIM now.

>     According to the autoconf manual, AC_DEFINE_UNQUOTED is able
>     to handle variables as its first argument.  Yet it appears it
>     cannot.  Perhaps autoheader must extrapolate what possible
>     values will be defined, and it just fails to do that here.
>     Regardless, the result is that the value does not get
>     defined, causing (in this case) an obscure bug.
> 
> I believe that this is a documentation bug.

Yes, but not in the way that your change suggests: autoheader cannot do
its job with an AC_DEFINE_UNQUOTED which gets a non-literal first
argument.  But the rest of the machinery very well can, and it has
explicit code in place to cope with non-literal first argument.  We even
have an example in the manual that does this.

You simply need to provide a template elsewhere.

* Paul Eggert wrote on Sat, May 27, 2006 at 02:05:54AM CEST:
> Ben Pfaff <address@hidden> writes:
> 
> > I believe that the second mention of @code{AC_DEFINE} should be
> > followed by "or @code{AC_DEFINED_UNQUOTED}".
> 
> Thanks; I installed a patch for that.

The ChangeLog entry states:
|        * doc/autoconf.texi (autoheader Invocation): Mention that the
|       first arg of AC_DEFINE_UNQUOTED must not be a literal.
|       Problem reported by Ben Pfaff in
|       <http://lists.gnu.org/archive/html/bug-autoconf/2006-05/msg00090.html>.

The `not' is wrong.

I suggest the following change:

        * doc/autoconf.texi (autoheader Invocation): There is no need
        that the first argument to `AC_DEFINE_UNQUOTED' be a literal.
        Clarify this and add a footnote to what else is needed.

Index: ChangeLog
===================================================================
RCS file: /cvsroot/autoconf/autoconf/ChangeLog,v
retrieving revision 1.2912
diff -u -r1.2912 ChangeLog
--- ChangeLog   27 May 2006 03:21:15 -0000      1.2912
+++ ChangeLog   27 May 2006 12:04:27 -0000
@@ -17,7 +17,7 @@
        changes, since MKDIR_P now might end in "/mkdir -p".
 
        * doc/autoconf.texi (autoheader Invocation): Mention that the
-       first arg of AC_DEFINE_UNQUOTED must not be a literal.
+       first arg of AC_DEFINE_UNQUOTED must be a literal.
        Problem reported by Ben Pfaff in
        <http://lists.gnu.org/archive/html/bug-autoconf/2006-05/msg00090.html>.
 
Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.1028
diff -u -r1.1028 autoconf.texi
--- doc/autoconf.texi   27 May 2006 02:54:33 -0000      1.1028
+++ doc/autoconf.texi   27 May 2006 12:04:27 -0000
@@ -2889,9 +2889,12 @@
 @code{AC_DEFINE} or one @code{AC_DEFINE_UNQUOTED} call with a third
 argument for each symbol (@pxref{Defining Symbols}).  An additional
 constraint is that the first argument of @code{AC_DEFINE}
-or @code{AC_DEFINE_UNQUOTED} must be a
-literal.  Note that all symbols defined by Autoconf's builtin tests are
-already documented properly; you only need to document those that you
+or @code{AC_DEFINE_UNQUOTED} must be a literal; if not, the user
+needs to make sure a suitable template for the definition is in
address@hidden may be achieved by using @code{AH_VERBATIM}, or
+supplying a suitable input file for a subsequent configuration header
+file, for example.}  Note that all symbols defined by Autoconf's builtin tests
+are already documented properly; you only need to document those that you
 define yourself.
 
 You might wonder why @command{autoheader} is needed: after all, why




reply via email to

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