From: Robert S. <the...@gm...> - 2007-09-19 12:23:46
|
Hi, as the list of HAVE_foo and ENABLE_baz gets longer and clutters display at compile time I added the autotool's answer to that namely the autoheader feature. What this does is simple. A file called config.h.in contains a bunch of preprocessor definitions (which one that are is determined by the autoheader program). After ./configure has been run a config.h is created where all those preprocessor definitions have been set (or not depending on your configure options). How to use this: To check whether the header is available you have to introduce an #ifdef HAVE_CONFIG_H/#endif guard. Inside this guard you usually place the include directive for the header. Thus making #ifdef HAVE_CONFIG_H #include "config.h" #endif part of the boilerplate every sourcefile that needs the HAVE_whatever variables. The autools recommend that you call the optional feature's preprocessor variables ENABLE_foobar for a feature that is disabled by default and DISABLE_foobar for a feature that is enabled by default. I fixed this for the just added GHOST_REPLAY feature. However for BULLET it has still to be fixed. Two notes on ghost replay: I would not make this an optional feature. So many #ifdefs for a feature that makes a racing game truly more complete. Second I would not place #ifdef ENABLE_GHOST_REPLAY guards in the *headers* that exclusively deal with that feature. I would do it the other way round: #ifndef ENABLE_GHOST_REPLAY #error "This header must not be included when replay feature is disabled. Go figure!" #endif Regards Robert |