On Sun, 15 Mar 2009, Junio C Hamano wrote: > Allan Caffee <allan.caffee@xxxxxxxxx> writes: > > My mistake; it looks like this macro will only work the way I described > > when using a config.h, which I see git is not currently doing. I > > assumed that it would also provide a -D flag to the precompiler if a > > configuration header isn't used but this doesn't appear to be case (from > > a cursory glance at the macros definition). > > The design of our Makefile is such that it will default to some reasonable > values for the make variables depending on the environment, and people who > do not want to use the configure script can override them by creating > custom entries in config.mak manually, which is included by the Makefile. > > OPTIONALLY configure can be used to produce config.mak.autogen that is > included just before config.mak is included (so that misdetection by > configure script can be overridden away by config.mak), so the same kind > of overriding happens. > > I suspect addition of config.h, unless done carefully, will close the door > to the people who do not use configure to get certain customizations, and > when the same carefulness is applied, we probably do no need to introduce > config.h. > > For example, for -Dinline=__inline__, I think you can: > > (1) Add something like this near the beginning of the Makefile: > > # Define USE_THIS_INLINE=__inline__ if your compiler does not > # understand "inline", but does understand __inline__. > # > # Define NO_INLINE=UnfortunatelyYes if your compiler does not > # understand "inline" at all. > > (2) Add something like this after include "config.mak" happens in the > Makefile: > > ifdef USE_THIS_INLINE > BASIC_CFLAGS += -Dinline=$(USE_THIS_INLINE) > else > ifdef NO_INLINE > BASIC_CFLAGS += -Dinline="" > endif > endif > > (3) Add your new logic to configure.ac, _and_ arrange it to substitute > USE_THIS_INLINE if ac_cv_c_inline is not "inline", and set NO_INLINE > if it detected that the compiler does not understand inline in any > shape or form. You would need two new entries in config.mak.in, I > think. In addition to these three possibilities we could also use config.h only in the event that the user decides to run configure. When using a config header autoconf appends -DHAVE_CONFIG_H to the CPPFLAGS. So the code could conditionally include it. Although I'm not really sure if this still maintains the degree of user control you're looking for. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html