bug-autoconf
[Top][All Lists]
Advanced

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

Re: Problem with AC_CONFIG_FILES targets that contain variables


From: Sander Niemeijer
Subject: Re: Problem with AC_CONFIG_FILES targets that contain variables
Date: Fri, 22 Aug 2008 10:35:19 +0200

Hi Ralf,

I must admit that I have not RTFM on this ;)

After reading the section you mentioned, there is already quite some information on the topic.

Currently the part that may be misleading is the part where it says that one is encouraged to avoid using 'AC_CONFIG_FOOS([$my_foos])'. This phrasing of the sentence suggests that it may still be valid to do so. In fact, it is not. Running configure works. But, just as my example, a config.status on either fooo or foooo does not. Even adding an initialisation of my_foos to init-cmds wont help. I would have guessed that maybe running "config.status 'fooo foooo'" would then still have worked, but even that doesn't seem to (config.status apparently splits up all command line arguments, even if they were quoted, so it gives an 'error: invalid argument: fooo'.).

I would rephrase the section to explicitly forbid users to use the my_foos construct as is currently mentioned and generally advise users not to use variables in the tag section. It would be good to mention what users can expect if they would still try to do it (i.e. configure works, but config.status wont).

In addition Section 4.6 could describe the workaround example for using variables as you provided. A suggestion for rephrasing the example would be:

FOO_VERSION=1.0
AC_CONFIG_FOOS([foo-$FOO_VERSION], [], [FOO_VERSION='$FOO_VERSION'])

The case in my project where I was using variables also doesn't use PACKAGE_VERSION (I just used that variable to make my example to you as short as possible).

Anyway. Thanks for the response. I can now at least get my config.status to work again.

Best regards,
Sander


On 22 aug 2008, at 09:16, Ralf Wildenhues wrote:

Hi Sander,

thanks for the report. Your reports always make for some good thinking.

* Sander Niemeijer wrote on Thu, Aug 21, 2008 at 05:24:08PM CEST:
AC_INIT(foo, 1.0)
AC_CONFIG_FILES([foo-$PACKAGE_VERSION:foo.in])
AC_OUTPUT

When running configure it correctly creates the file 'foo-1.0'.

However when I then try to run config.status for the file I get:
----
$ config.status foo-1.0
config.status: error: invalid argument: foo-1.0

Yes, in this case you have to pass the variable to config.status,
as hinted in the manual, but probably not clear enough:
<http://www.gnu.org/software/autoconf/manual/html_node/Configuration-Actions.html >

So this should work:
 AC_CONFIG_FILES([foo-$PACKAGE_VERSION:foo.in], [],
                 [PACKAGE_VERSION='$PACKAGE_VERSION'])

Note that the weird quoting works because the third argument is expanded inside a here document. FWIW, I'd recommend using a different variable
than PACKAGE_VERSION to avoid potential clashes.

I don't think we will fix this (because I think fixing it /right/ is
probably hard), but if you have suggestions (or a patch) on how to
improve the manual here so that it is clearer, that would be nice.

Cheers,
Ralf





reply via email to

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