regenerating a script specified in AC_CONFIG_FILES

View: New views
7 Messages — Rating Filter:   Alert me  

regenerating a script specified in AC_CONFIG_FILES

by Adam Mercer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

As part of the configure process I generate a script, git_version,
from a file git_version.in specified in AC_CONFIG_FILES() so that an
appropriate python interpreter is used. However if I modify the
git_version.in file the git_version script is not regenerated when
running make. Is there anyway to ensure that this is regenerated ,if
appropriate, automatically?

Cheers

Adam


_______________________________________________
Autoconf mailing list
Autoconf@...
http://lists.gnu.org/mailman/listinfo/autoconf

Re: regenerating a script specified in AC_CONFIG_FILES

by Ralf Wildenhues :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

* Adam Mercer wrote on Thu, Oct 08, 2009 at 08:12:49PM CEST:
> As part of the configure process I generate a script, git_version,
> from a file git_version.in specified in AC_CONFIG_FILES() so that an
> appropriate python interpreter is used. However if I modify the
> git_version.in file the git_version script is not regenerated when
> running make. Is there anyway to ensure that this is regenerated ,if
> appropriate, automatically?

Are you using Automake?  If yes, and if the arguments to AC_CONFIG_FILES
are shell literals, then automake should produce a rule to regenerate
the file for you.

Otherwise, you can also just add one to your makefile, a la

  git_version: $(top_builddir)/config.status git_version.in
        cd $(top_builddir) && ./config.status $(top_build_prefix)$@

(untested, you could look into the manual if you need more information).

Cheers,
Ralf


_______________________________________________
Autoconf mailing list
Autoconf@...
http://lists.gnu.org/mailman/listinfo/autoconf

Re: regenerating a script specified in AC_CONFIG_FILES

by Adam Mercer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Oct 8, 2009 at 13:59, Ralf Wildenhues <Ralf.Wildenhues@...> wrote:

> Are you using Automake?  If yes, and if the arguments to AC_CONFIG_FILES
> are shell literals, then automake should produce a rule to regenerate
> the file for you.

Yes I'm using automake, I believe the arguments to AC_CONFIG_FILES are
shell literals:

AC_CONFIG_FILES([ \
<snip>
                 lib/git_version
                 lib/Makefile \
<snip>
])

but the script isn't being updated.

> Otherwise, you can also just add one to your makefile, a la
>
>  git_version: $(top_builddir)/config.status git_version.in
>        cd $(top_builddir) && ./config.status $(top_build_prefix)$@
>
> (untested, you could look into the manual if you need more information).

Cheers

Adam


_______________________________________________
Autoconf mailing list
Autoconf@...
http://lists.gnu.org/mailman/listinfo/autoconf

Re: regenerating a script specified in AC_CONFIG_FILES

by Ralf Wildenhues :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

* Adam Mercer wrote on Thu, Oct 08, 2009 at 10:02:32PM CEST:

> On Thu, Oct 8, 2009 at 13:59, Ralf Wildenhues wrote:
>
> > Are you using Automake?  If yes, and if the arguments to AC_CONFIG_FILES
> > are shell literals, then automake should produce a rule to regenerate
> > the file for you.
>
> Yes I'm using automake, I believe the arguments to AC_CONFIG_FILES are
> shell literals:
>
> AC_CONFIG_FILES([ \
> <snip>
>                  lib/git_version
>                  lib/Makefile \
> <snip>
> ])
>
> but the script isn't being updated.

Can you post configure.ac and the Makefile.am, or a small example
package that reproduces the issue?

Thanks,
Ralf


_______________________________________________
Autoconf mailing list
Autoconf@...
http://lists.gnu.org/mailman/listinfo/autoconf

Re: regenerating a script specified in AC_CONFIG_FILES

by Adam Mercer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Oct 8, 2009 at 16:03, Ralf Wildenhues <Ralf.Wildenhues@...> wrote:

> Can you post configure.ac and the Makefile.am, or a small example
> package that reproduces the issue?

I've attached a simple example package that reproduces the problem:

[ram@mimir example]$ autoreconf
[ram@mimir example]$ ./configure
checking for a BSD-compatible install... /opt/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /opt/local/bin/gmkdir -p
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking build system type... i386-apple-darwin10.0.0
checking host system type... i386-apple-darwin10.0.0
checking for a Python interpreter with version >= 2.4... python
checking for python... /opt/local/bin/python
checking for python version... 2.6
checking for python platform... darwin
checking for python script directory... ${prefix}/lib/python2.6/site-packages
checking for python extension module directory...
${exec_prefix}/lib/python2.6/site-packages
configure: creating ./config.status
config.status: creating Makefile
config.status: creating lib/git_version
config.status: creating lib/Makefile
config.status: executing default-1 commands
[ram@mimir example]$ make
Making all in lib
creating LALVCSInfo.h
make  all-am
make[1]: Nothing to be done for `all-am'.
[ram@mimir example]$ vim lib/git_version.in
[ram@mimir example]$ make
Making all in lib
make  all-am
make[2]: Nothing to be done for `all-am'.
make[1]: Nothing to be done for `all-am'.
[ram@mimir example]$

Cheers

Adam


_______________________________________________
Autoconf mailing list
Autoconf@...
http://lists.gnu.org/mailman/listinfo/autoconf

example.tar.bz2 (43K) Download Attachment

Re: regenerating a script specified in AC_CONFIG_FILES

by Ralf Wildenhues :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

* Adam Mercer wrote on Mon, Oct 12, 2009 at 06:21:11PM CEST:
> On Thu, Oct 8, 2009 at 16:03, Ralf Wildenhues wrote:
>
> > Can you post configure.ac and the Makefile.am, or a small example
> > package that reproduces the issue?
>
> I've attached a simple example package that reproduces the problem:

Thanks.  The rebuild rule is generated alright, but nothing depends on
the output file.  So adding
  all-local: git_version

to lib/Makefile.am would be one possibility.  In your case, you should
add git_version as prerequisite to LALVCSInfo.h.

To let rebuilding keep the right file mode, write this in configure.ac:

  AC_CONFIG_FILES([lib/git_version],
                  [chmod +x lib/git_version])

replacing the two parts you currently have for this file.

Cheers,
Ralf


_______________________________________________
Autoconf mailing list
Autoconf@...
http://lists.gnu.org/mailman/listinfo/autoconf

Re: regenerating a script specified in AC_CONFIG_FILES

by Adam Mercer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Oct 12, 2009 at 23:48, Ralf Wildenhues <Ralf.Wildenhues@...> wrote:

> Thanks.  The rebuild rule is generated alright, but nothing depends on
> the output file.  So adding
>  all-local: git_version
>
> to lib/Makefile.am would be one possibility.  In your case, you should
> add git_version as prerequisite to LALVCSInfo.h.
>
> To let rebuilding keep the right file mode, write this in configure.ac:
>
>  AC_CONFIG_FILES([lib/git_version],
>                  [chmod +x lib/git_version])
>
> replacing the two parts you currently have for this file.

Thanks Ralf, thats working great now!

Cheers

Adam


_______________________________________________
Autoconf mailing list
Autoconf@...
http://lists.gnu.org/mailman/listinfo/autoconf