[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AC_CONFIG_HEADERS vs. AC_CONFIG_FILES
From: |
Ralf Corsepius |
Subject: |
Re: AC_CONFIG_HEADERS vs. AC_CONFIG_FILES |
Date: |
Sun, 18 Dec 2005 07:21:52 +0100 |
On Sat, 2005-12-17 at 22:16 -0500, David Fang wrote:
> > > What I'd like is AC_CONFIG_FILES to also perform a difference
> > > check on the output files before overwriting them, just the way
> > > AC_CONFIG_HEADERS does. (Is this a safe and easy request to accommodate?)
> >
> > Maybe you can have an intermediate file created from config.status
> > (AC_CONFIG_FILES), and then use move-if-change to the header, in
> > conjunction with a stamp file. I'm not sure whether there are make
> > implementations that don't cope well with this scheme, nor whether
> > that is due to bugs in them.
>
> Hi,
> I tried my own AC_CONFIG_FILES like this:
>
> AC_CONFIG_FILES([foo.h:foo.h.in],
> [
> dnl ... create foo.h.tmp from foo.h.in
> dnl ... move-if-change foo.h.tmp foo.h
> ]
> )
>
> However, the configure process would always *first* clobber
> foo.h from foo.h.in before executing any of my own commands,
Have you tried
AC_CONFIG_FILES([foo.h.tmp:foo.h.in]),
[
move-if-change foo.h.tmp foo.h
])
Another approach would be "to do everything by yourself" in your
configure.ac. I am using a construct similar to this, in one configure
script (Very shortened, the real world code is much more larger):
# Create cpuopts.h using echo, cat etc.
...
echo "#ifndef ...." > cpuopts.tmp
echo "#define bar 1" >> cpuopts.tmp
...
AS_MKDIR_P(foo)
AS_IF([test -f foo/cpuopts.h],
[
AS_IF([cmp -s foo/cpuopts.h cpuopts.tmp 2>/dev/null],
[
AC_MSG_NOTICE([foo/cpuopts.h is unchanged])
rm -f cpuopts.tmp
],[
AC_MSG_NOTICE([creating foo/cpuopts.h])
rm -f foo/cpuopts.h
mv cpuopts.tmp foo/cpuopts.h
])
],[
AC_MSG_NOTICE([creating foo/cpuopts.h])
rm -f foo/cpuopts.h
mv cpuopts.tmp foo/cpuopts.h
])
Basically, what I am doing is to create a file (here cpuopts.tmp) in
configure.ac using standard /bin/sh tools (echo, cat and
"here"-documents) and then to update foo/cpuopts.h mimicking the
"move-if-change"-logic as internally being used for AC_CONFIG_HEADERS
inside of autoconf.
Ralf
- AC_CONFIG_HEADERS vs. AC_CONFIG_FILES, David Fang, 2005/12/12
- Re: AC_CONFIG_HEADERS vs. AC_CONFIG_FILES, Ralf Wildenhues, 2005/12/15
- Re: AC_CONFIG_HEADERS vs. AC_CONFIG_FILES, David Fang, 2005/12/17
- Re: AC_CONFIG_HEADERS vs. AC_CONFIG_FILES, Ralf Corsepius, 2005/12/19
- Re: AC_CONFIG_HEADERS vs. AC_CONFIG_FILES, Harlan Stenn, 2005/12/19
- Re: AC_CONFIG_HEADERS vs. AC_CONFIG_FILES, Bruce Korb, 2005/12/19
- Re: AC_CONFIG_HEADERS vs. AC_CONFIG_FILES, Bob Friesenhahn, 2005/12/19
- Re: AC_CONFIG_HEADERS vs. AC_CONFIG_FILES, Bruce Korb, 2005/12/19
- Re: AC_CONFIG_HEADERS vs. AC_CONFIG_FILES, Ralf Corsepius, 2005/12/19
- Re: AC_CONFIG_HEADERS vs. AC_CONFIG_FILES, Harlan Stenn, 2005/12/19