Re: unexpected editing of argument to AH_BOTTOM

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

 



Hello Paul,

On Thu, Oct 12, 2006 at 02:52:05PM -0700, Paul Eggert wrote:
> "John W. Eaton" <jwe@xxxxxxxxxxxxxxxxx> writes:
> > I'm wondering whether this behavior is a bug or feature.

Well, in any case, this is a trap which many people fell into.
At least the documentation has to be improved; a proposed patch
attached for a review.

> I'd say it's a bug.  Fixing it coherently may not be that easy,
> though.

I'm not sure how the ``fixed'' behaviour should look like.

Imagine you want to ``correct'' the detectes defines, and add the
following at the end of config.h.in:

/* For HP/UX with gcc */
#if defined(hpux) || defined(_HPUX_SOURCE)
#undef HAVE_TZSET
#define HAVE_TZSET 1
#define _TZSET 1
#endif

It is inevitable that if HAVE_TZSET was AC_DEFINEd, then the #undef
get's replaced.  So this trap will inevitably be there.

At the end of the proceesing of the template, all remaining #undef's
get commented out.  A comment in status.m4 explains that:

# Then replace #undef with comments.  This is necessary, for example,
# in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it.

So at least _some_ #undef's have to be commented out.

We could perhaps comment out only the #undef's corresponding to the
AC_DEFINEs in configure sources.   (But that would not help with the
above example.)

Have a nice day,
	Stepan
2006-10-13  Stepan Kasal  <kasal@xxxxxx>

	* doc/autoconf.texi (Autoheader Macros): Warn that the text
	added to the template can get mangled.

Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.1093
diff -u -r1.1093 autoconf.texi
--- doc/autoconf.texi	11 Oct 2006 22:38:42 -0000	1.1093
+++ doc/autoconf.texi	13 Oct 2006 09:34:16 -0000
@@ -3137,27 +3137,12 @@
 symbol, you must define a template for it.  If there are missing
 templates, @command{autoheader} fails with an error message.
 
-The simplest way to create a template for a @var{symbol} is to supply
-the @var{description} argument to an @samp{AC_DEFINE(@var{symbol})}; see
-@ref{Defining Symbols}.  You may also use one of the following macros.
+The template for a @var{symbol} is created
+by @command{autoheader} from
+the @var{description} argument to an @code{AC_DEFINE};
+see @ref{Defining Symbols}.
 
-@defmac AH_VERBATIM (@var{key}, @var{template})
-@ahindex{VERBATIM}
-Tell @command{autoheader} to include the @var{template} as-is in the header
-template file.  This @var{template} is associated with the @var{key},
-which is used to sort all the different templates and guarantee their
-uniqueness.  It should be a symbol that can be defined via @code{AC_DEFINE}.
-
-For example:
-
-@example
-AH_VERBATIM([_GNU_SOURCE],
-[/* Enable GNU extensions on systems that have them.  */
-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE
-#endif])
-@end example
-@end defmac
+For special needs, you can use the following macros.
 
 
 @defmac AH_TEMPLATE (@var{key}, @var{description})
@@ -3189,6 +3174,14 @@
 @end defmac
 
 
+@defmac AH_VERBATIM (@var{key}, @var{template})
+@ahindex{VERBATIM}
+Tell @command{autoheader} to include the @var{template} as-is in the header
+template file.  This @var{template} is associated with the @var{key},
+which is used to sort all the different templates and guarantee their
+uniqueness.  It should be a symbol that can be defined via @code{AC_DEFINE}.
+
+
 @defmac AH_TOP (@var{text})
 @ahindex{TOP}
 Include @var{text} at the top of the header template file.
@@ -3201,6 +3194,16 @@
 @end defmac
 
 
+Please note that @var{text} gets included ``verbatim'' to the template file,
+not to the resulting config header, so it can easily get mangled when the
+template is processed.  There is rarely a need for something else than
+
+@example
+AH_BOTTOM([#include <custom.h>])
+@end example
+
+
+
 @node Configuration Commands
 @section Running Arbitrary Configuration Commands
 @cindex Configuration commands
_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux