IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New If memory serves me correct...
...those -D switches are really just macro constants in disguise. So you should be able to use the constants in conditional compilation tests.
New Right. But I don't want to pass -D switches. :-)
That's what I'm doing now; ie. on Linux I add -D_LINUX to the gcc command line, and look for #ifdef _LINUX in the code. I'm looking for a predefined macro constant so I don't have to pass the -D switches any more.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Could autoconf help?
I've seen lot of programs do build-type checks in autoconf.

Wade.

Microsoft are clearly boiling the frogs.

New We have our own build system; autoconf not a part of it
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Autoconf could still be useful
The way it works is that it runs a bunch of tests to figure out what the environment is. Even if you have your own system, you could download autoconf and steal the tricks they are using.
New Autoconf does so at runtime.
ie. through uname, etc.

Which isn't particularly useful during compile time. :-)
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Are we talking about "configure" script?
As used by scores of Open Source apps? It works _before_ compile time.
--

We have only 2 things to worry about: That
things will never get back to normal, and that they already have.
New You misunderstand me.
The techniques that configure/autoconf use are runtime techniques, and hence useless to my goal of doing the configuration at compile time. :-)

Basically, I ended up using stuff like:

\n#if defined(MSC_VER)\n// windows stuff\n#elif defined(linux) || defined(__linux__)\n// linux stuff\n#elif defined(sun) || defined(__sun__)\n// solaris stuff\n#else\n#error Unknown or unsupported OS\n#endif\n
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New One man's compile time...
...is another man's run time. How about having the make file run a configuration procedure that generates a header file with the constants in it. Something with pipes or grep or awk or.... :-)
New I already do that; I don't want to. :-)
Or at least, something similar. I want the entire detection to happen in the source code, not as the result of something that runs before the compile.

Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New So what you're really wanting is...
...to know if the compiler itself is autodetecting the environment and whether that detection is available in the conditional compilation?
New s/wanting/using
Here's what I came up with, which seems to work fine:

[link|http://z.iwethey.org/forums/render/content/show?contentid=73714|http://z.iwethey.org...w?contentid=73714]
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
     Determining platform type/OS in gcc via #defines - (admin) - (25)
         Maybe Mozilla source would help... - (Another Scott) - (1)
             Yes, this is the sort of thing I was looking for: - (admin)
         Is this on Linux? - (deSitter) - (8)
             what he said -NT - (boxley)
             I wasn't clear enough. - (admin) - (6)
                 Gotta be a #pragma right? - (deSitter) - (1)
                     #define -NT - (admin)
                 /usr/include/machine/cpu.h (like that?) -NT - (boxley) - (3)
                     Doesn't exist on this box. - (admin) - (2)
                         osx has 3 entries - (boxley) - (1)
                             Heh. No /usr/include/i386 either. - (admin)
         I don't really have an answer handy... - (ChrisR) - (13)
             Compile time, without passing -D switches. -NT - (admin) - (12)
                 If memory serves me correct... - (ChrisR) - (11)
                     Right. But I don't want to pass -D switches. :-) - (admin) - (10)
                         Could autoconf help? - (static) - (9)
                             We have our own build system; autoconf not a part of it -NT - (admin) - (8)
                                 Autoconf could still be useful - (neelk) - (7)
                                     Autoconf does so at runtime. - (admin) - (6)
                                         Are we talking about "configure" script? - (Arkadiy) - (5)
                                             You misunderstand me. - (admin) - (4)
                                                 One man's compile time... - (ChrisR) - (3)
                                                     I already do that; I don't want to. :-) - (admin) - (2)
                                                         So what you're really wanting is... - (ChrisR) - (1)
                                                             s/wanting/using - (admin)

Note for the linguistically-impaired: That was a rhetorical question. (Second note, for the vocabulary-challenged: That means you're not supposed to answer it.)
497 ms