obsoleted by AX_PREFIX_CONFIG_H
* this is a new variant from ac_prefix_config_
this one will use a lowercase-prefix if
the config-define was starting with a lowercase-char, e.g.
#define const or #define restrict or #define off_t
(and this one can live in another directory, e.g. testpkg/config.h
therefore I decided to move the output-header to be the first arg)
takes the usual config.h generated header file; looks for each of
the generated "#define SOMEDEF" lines, and prefixes the defined name
(ie. makes it "#define PREFIX_SOMEDEF". The result is written to
the output config.header file. The PREFIX is converted to uppercase
for the conversions.
- default OUTPUT-HEADER = $PACKAGE-config.h
- default PREFIX = $PACKAGE
- default ORIG-HEADER, derived from OUTPUT-HEADER
if OUTPUT-HEADER has a "/", use the basename
if OUTPUT-HEADER has a "-", use the section after it.
otherwise, just config.h
In most cases, the configure.in will contain a line saying
AC_CONFIG_HEADER(config.h)
somewhere *before* AC_OUTPUT and a simple line saying
AC_PREFIX_CONFIG_HEADER
somewhere *after* AC_OUTPUT.
example:
AC_INIT(config.h.in) # config.h.in as created by "autoheader"
AM_INIT_AUTOMAKE(testpkg, 0.1.1) # "#undef VERSION" and "PACKAGE"
AM_CONFIG_HEADER(config.h) # in config.h.in
AC_MEMORY_H # "#undef NEED_MEMORY_H"
AC_C_CONST_H # "#undef const"
AC_OUTPUT(Makefile) # creates the "config.h" now
AC_CREATE_PREFIX_CONFIG_H # creates "testpkg-config.h"
and the resulting "testpkg-config.h" contains lines like
#ifndef TESTPKG_VERSION
#define TESTPKG_VERSION "0.1.1"
#endif
#ifndef TESTPKG_NEED_MEMORY_H
#define TESTPKG_NEED_MEMORY_H 1
#endif
#ifndef _testpkg_const
#define _testpkg_const const
#endif
and this "testpkg-config.h" can be installed along with other
header-files, which is most convenient when creating a shared
library (that has some headers) where some functionality is
dependent on the OS-features detected at compile-time. No
need to invent some "testpkg-confdefs.h.in" manually. :-)