Re: AC_CONFIG_HEADERS & AC_CONFIG_FILES combo

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

 



On Fri, 16 Oct 2009, Sam Steingold wrote:

I have a header file avcall.h which collects the results of autoconf tests, so it is mentioned in AC_CONFIG_HEADERS.
I also want it to define the package version cpp macro, so I added

#if !defined(LIBFFCALL_VERSION)
# define LIBFFCALL_VERSION @PACKAGE_VERSION@
#endif

to it (there are several such headers, each has these 3 lines).
however, configure did not substitute @PACKAGE_VERSION@.
thus I added avcall.h to AC_CONFIG_FILES.
nothing changed, no warning or error on configure generation.
so I added this to configure.in:

AC_CONFIG_HEADERS([avcall.h],
[sed "s/@PACKAGE_VERSION@/${PACKAGE_VERSION}/" avcall.h > tmp
mv -f tmp avcall.h])

now @PACKAGE_VERSION@ is removed, nothing is inserted.

That is because the sed command is executed by config.status where
PACKAGE_VERSION not undefined.  You should try

AC_CONFIG_HEADERS([avcall.h],
[sed "s/@PACKAGE_VERSION@/$my_PACKAGE_VERSION/" avcall.h > tmp
mv -f tmp avcall.h],
[my_PACKAGE_VERSION=$PACKAGE_VERSION])

(the changed variable name is to avoid conflicts, may not be needed).

Regards
Peter Breitenlohner <peb@xxxxxxxxxxxx>


_______________________________________________
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