cleaning the generic module :)

Frederic-Emmanuel PICCA picca at synchrotron-soleil.fr
Fri Jan 6 14:11:49 CET 2006


Hello

AS you know I am using bksys to compile a library. So I developped a 
cppunit module.

In that module I make a TryLink to see if the CPPPATH and LIBPATH are 
well set after the detection depending of the platform.

Now I just whant to focus on the output of this TryLink

------------------------------------------------------------------------------
file bksys/cppunit.py,line 98:
         Configure(confdir = .sconf_temp)
scons: Configure: Checking for cppunit ...
.sconf_temp/conftest_0.cpp <-
   |
   |#include <cppunit/ui/text/TestRunner.h>
   |int main(int argc, char **argv)
   |{
   |  //CppUnit::Test *suite = 
CppUnit::TestFactoryRegistry::getRegistry().makeTest();
   |  CppUnit::TextUi::TestRunner runner;
   |
   |  //runner.addTest( suite );
   |  //runner.setOutputter( new CppUnit::CompilerOutputter( 
&runner.result(), std::cerr ) );
   |
   |  bool wasSuccessful = runner.run();
   |
   |  return wasSuccessful ? 0 : 1;
   |}
   |
g++ -o .sconf_temp/conftest_0.o -c -O2 -DNDEBUG -DNO_DEBUG -DDEBUG -g 
-Wall -O2 -DNDEBUG -DNO_DEBUG -D_XOPEN_SOURCE=500 -D_BSD_SOURCE 
-D_GNU_SOURCE -DHAVE_CONFIG_H .sconf_temp/conftest_0.cpp
g++ -o .sconf_temp/conftest_0 .sconf_temp/conftest_0.o -lcppunit -ldl
scons: Configure: yes

------------------------------------------------------------------------------

As you can see we have (-O2 -DNDEBUG -DNO_DEBUG) 2 times and a -g with 
-DDEBUG.

So debug or not debug. That is the question (I put no debug=1 during the 
configuration process)

we can see the -D_XOPEN_SOURCE=500

here a part of the gcc man page
------------------------------------------------------------------------------
        -munix=unix-std
            Generate compiler predefines and select a startfile for the 
speci-
            fied UNIX standard.  The choices for unix-std are 93, 95 and 98.
            93 is supported on all HP-UX versions.  95 is available on HP-UX
            10.10 and later.  98 is available on HP-UX 11.11 and later.  The
            default values are 93 for HP-UX 10.00, 95 for HP-UX 10.10 
though to
            11.00, and 98 for HP-UX 11.11 and later.

            -munix=93 provides the same predefines as GCC 3.3 and 3.4.
            -munix=95 provides additional predefines for "XOPEN_UNIX" and
            "_XOPEN_SOURCE_EXTENDED", and the startfile unix95.o.  -munix=98
            provides additional predefines for "_XOPEN_UNIX",
            "_XOPEN_SOURCE_EXTENDED", "_INCLUDE__STDC_A1_SOURCE" and
            "_INCLUDE_XOPEN_SOURCE_500", and the startfile unix98.o.

            It is important to note that this option changes the 
interfaces for
            various library routines.  It also affects the operational 
behavior
            of the C library.  Thus, extreme care is needed in using this
            option.

            Library code that is intended to operate with more than one UNIX
            standard must test, set and restore the variable
            __xpg4_extended_mask as appropriate.  Most GNU software doesn't
            provide this capability.
------------------------------------------------------------------------------

So I think this option must not be include by default in the generic object.

Last we have -D_BSD_SOURCE and -D_GNU_SOURCE !

So it would be nice to let the user choose its licence.
I don't know if Scons have a mecanism to set correctly the flags 
depending of the licence. If not we can imagine a LICENCE with different 
  predefine choices 'BSD', 'GPL', 'LGPL' etc... and set the flag in 
relation with.

Have a nice day.





More information about the Kde-buildsystem mailing list