[Scons-users] Scons using config.h.in

Zachary Lund admin at computerquip.com
Wed Apr 3 04:44:28 EDT 2013


On Tue, 2013-04-02 at 13:53 +0200, dev at mgautier.fr wrote:

> > Herm... good question :D

> >

> > I suppose ultimately, I'm having issues adding things like

> "#include"

> > statements (or anything that isn't directly support in Scons) in my

> > config header (i.e. outside of macros is the use of "typedef". If a

> > certain type doesn't exist, create an alternative). I suppose I

> could do

> > this using substfile like stated above... it just seems kinda round

> > about and sloppy.

> >

> > It's static content so I feel like substfile is overkill and/or

> overly

> > complicated for the task.

> >

>

>

> Hello,

>

> Does this (http://www.scons.org/wiki/GenerateConfig ) answer your

> problem ?

>

> We use it in our build system and it works pretty well.

>

> It should be possible for you to create a builder to automatically

> create config.h from config.h.in instead of explicitly call

> env.Command.

>

> Matthieu.

> _______________________________________________

> Scons-users mailing list

> Scons-users at scons.org

> http://four.pairlist.net/mailman/listinfo/scons-users


Eh, I'm going through way to much trouble for this.

I am going to use the GenerateConfig method but I'd have to do:

#if %(HAVE_ALLOCA_H)i
#define HAVE_ALLOCA_H %(HAVE_ALLOCA_H)i
#endif

about 130 times, literally. This turns my 380 line header to 1200 lines.
I setup a regex to do this for me and it works out well, it's just
incredibly sloppy. The reason I have to do this is because the macro
cannot be defined if we don't support a feature. Setting it to 0 doesn't
work in this case because #ifdef's are used all over the place.

I'd like to eventually have it #undef anything that isn't supported but
it seems like a real pain in the ass. I really don't get why this isn't
support in Configure(). It already does this to some extent with
Define().

CMake also has something similar to this with #cmakedefine where the
above example would look like this in the template header:

#cmakedefine HAVE_ALLOCA_H @HAVE_ALLOCA_H@

An alternative to this that's supported direclty by Scons would be nice
for the sake of convenience and a universal method.



More information about the Scons-users mailing list