Hello Jef,

* Jef Driesen wrote on Mon, Mar 01, 2010 at 01:33:46PM CET:
> How do I get information generated by autotools into my public
> header files? For instance I want to define version numbers
> somewhere in my configure.ac file, and have the same numbers appear
> in a public header file without having to modify both files
> manually? Another example is that my library needs a 64bit integer
> type for its public api.
> 
> Since a config.h header files is not supposed to be public, that's
> not an option. But how can I do this correctly?

Use a second config header.  Its input template will not be generated by
autoheader; you write it yourself.  That way you can be sure to only put
safe stuff in there.

As much as possible, try to think of the possibility that your users may
enable or disable presence of a 64bit integer with compiler command line
options they pass to their package's configure script, or want a
multilib-like installation, where they adjust --libdir for different
ABI versions of your package; you should strive to have as few variation
in public headers as possible, ideally both versions install the same
header files (and only differ in semantics through preprocessor means).

An alternative of the above approach is the AX_PREFIX_CONFIG_H macro
from the Autoconf Macro Archive.

Cheers,
Ralf


Reply via email to