>>>>> "Peter" == Peter Eisentraut <[EMAIL PROTECTED]> writes:

Peter> Akim Demaille writes:
>> I know what you are going to say: we don't need autoheader, we
>> should just spit a cleaned up version of confdefs.h, as your patch
>> does.  But I don't share this opinion, so yes, it is important to
>> run autoheader.

Peter> Just for my enlightenment: Why is it actually important to run
Peter> autoheader before configure, rather than just having configure
Peter> do that job?

See the patch in the queue :)

| Index: ChangeLog
| from  Akim Demaille  <[EMAIL PROTECTED]>
|         * doc/autoconf.texi (autoheader Invocation): Explain the purpose
|         of autoheader.
|         
|         
| Index: doc/autoconf.texi
| --- 0.420/doc/autoconf.texi Mon, 17 Jul 2000 21:25:15 +0200 akim (ace/16_autoconf.t 
|1.61.2.66 644)
| +++ 0.420(w)/doc/autoconf.texi Mon, 17 Jul 2000 21:44:15 +0200 akim 
|(ace/16_autoconf.t 1.61.2.66 644)
| @@ -1982,16 +1982,44 @@ @node autoheader Invocation, Autoheader 
|  @subsection Using @code{autoheader} to Create @file{config.h.in}
|  @cindex @code{autoheader}
|  
| -The @code{autoheader} program can create a template file of C
| +The @command{autoheader} program can create a template file of C
|  @samp{#define} statements for @code{configure} to use.  If
|  @file{configure.in} invokes @code{AC_CONFIG_HEADERS(@var{file})},
| -@code{autoheader} creates @file{@var{file}.in}; if multiple file
| +@command{autoheader} creates @file{@var{file}.in}; if multiple file
|  arguments are given, the first one is used.  Otherwise,
| -@code{autoheader} creates @file{config.h.in}.
| +@command{autoheader} creates @file{config.h.in}.
|  
| -If you give @code{autoheader} an argument, it uses that file instead of
| -@file{configure.in} and writes the header file to the standard output
| -instead of to @file{config.h.in}.  If you give @code{autoheader} an
| +In order to do its job @command{autoheader} needs that you document all
| +the symbols that you might use, i.e., that there is at least one
| +@code{AC_DEFINE} or one @code{AC_DEFINE_UNQUOTED} using its third
| +argument, see @ref{Defining Symbols}.  An additional constraint is that
| +the first argument must be a literal.
| +
| +You might wonder why @command{autoheader} is needed: after all, why
| +would @command{configure} need to ``patch'' a @file{config.h.in} to
| +produce a @file{config.h} instead of just creating @file{config.h} from
| +scratch?
| +
| +Well, when everything rocks the answer is just that we are losing our
| +time maintaining @command{autoheader}: generating directly
| +@file{config.h} is just what is needed.
| +
| +But when things go wrong, you'll thanks the Autoconf team for
| +@command{autoheader}...
| +
| +The fact that the symbols are documented is precious to @emph{check}
| +that @file{config.h} makes sense.
| +
| +The fact that there is a well defined list of symbols which should be
| +@code{#define}'d (or not) is also precious for people who are porting
| +packages to environments where @command{configure} cannot be run: they
| +just have to @emph{fill in the blanks}.
| +
| +But let's come back to the point: @command{autoheader}'s invocation...
| +
| +If you give @command{autoheader} an argument, it uses that file instead
| +of @file{configure.in} and writes the header file to the standard output
| +instead of to @file{config.h.in}.  If you give @command{autoheader} an
|  argument of @option{-}, it reads the standard input instead of
|  @file{configure.in} and writes the header file to the standard output.
|  
| @@ -6766,7 +6794,7 @@ @node Coding Style,  , Obsoleting Macros
|  not escape when it is unneeded.  Common examples of useless quotation
|  are @samp{[$]$1} (write @samp{$$1}), @samp{[$]var} (use @samp{$var}),
|  etc.  If you add portability issues to the picture, you'll prefer
| -@samp{${1+"$[@@]"}} to @samp{"[$]@@"}, and you'll prefer do something
| +@samp{$@{1+"$[@@]"@}} to @samp{"[$]@@"}, and you'll prefer do something
|  better than hacking Autoconf @code{:-)}.
|  
|  When using @command{sed}, don't use @option{-e} but for indenting

Yes, it is a constraint to live with autoheader, but I think it is a
sane constraint.

In addition, I never saw any real life example where autoheader proves
to be a true limitations.

Something else I have not said in the documentation above is that this
(patching a template instead of mv confdefs.h config.h) allows you to
select which are the symbols which will be expanded.  Some people seem
to rely on such things.

        Akim

Reply via email to