On Thu, 2012-09-13 at 17:17 -0700, Russ Allbery wrote: > I believe the #ifdef wrapper used to be recommended by the Autoconf manual > way back, many moons ago (2.13 days at the latest), because it was how the > transition from defining things via -D on the command line to using a > header was handled. It goes along with the definition of @DEFS@, which > previously (and by previously I mean a long time ago) used to contain all > the results of configure as -D flags to the compiler, but which was > replaced by just "-DHAVE_CONFIG_H" if you used the AC_CONFIG_HEADERS (or > its earlier versions) macro. > > So, in other words, you could transition your package that was assuming -D > flags on the compiler command line to using a config.h header by adding > that #ifdef code to the source files, and then it would work with either > Autoconf method: either a config.h file or direct -D flags on the compiler > command line. > > I suspect the above is what's happening when you see this in really old > projects, and in newer projects it's copy and paste from older projects. Thanks Russ. That was very helpful. Is there a general rule on which source files to #include <config.h>, or is it as simple as any files that needs now or may need in the future the information contained in it. One exception as previously pointed out would be of course to never #include it in non-local / public headers. -- Kip Warner -- Software Engineer OpenPGP encrypted/signed mail preferred http://www.thevertigo.com
Attachment:
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Autoconf mailing list Autoconf@xxxxxxx https://lists.gnu.org/mailman/listinfo/autoconf