Le jeudi 19 octobre 2006 à 22:18 -0400, Daniel Macks a écrit : > On Thu, Oct 19, 2006 at 10:00:56PM -0400, Daniel Macks wrote: > > When I #include the public headers for libghemical-2.10, I wind up > > polluting my namespace with lots of #define tokens that seems like > > they should be restricted to libghemical's own source-building > > process. For example, why should "a library that links against > > libghemical" see: > > > > /* This is the version of libghemical to be built--it is set in the > > configure.ac */ > > #define LIBVERSION "2.10" > > > > (from from libghemicalconfig2.h)? It's the library version of > > libghemical, not of the library being built against it. The token name > > is generic enough that it's likely to conflict with my own library's > > tokens. Likewise, all the autoconf tokens at best cause a slew of > > redefined warnings due to my own config.h also having them. > > > > Executive summary: restrict header things that are used by the > > libghemical build process to being private to the build process. For > > example, have the libghemical sources #include libghemicalconfig2.h > > directly instead of having libghemicaldefine.h #include it, and don't > > install the config header publicly. > > On closer examination, slight mis-diagnosis here. The private config > should not be installed, but a secondary culprit is ghemical-2.01, > which #includes it as well as its own config header. Ghemical itself > should just test for [whatever] instead of relying on libghemical's > conf tests. That's not a so good idea. If libghemical and ghemical went to be built in different environments (something might have been updated between the two builds), ghemical might be broken. A better solution would be to have to configuration files. One used in libghemical cpp files and another one to be included from ghemical (might be libghemical-features.h). See libgoffice for the implementation of such a solution (Tommi, I volunteer to do the job if you agree). > Here's what happens when compiling ghemical: > > g++-3.3 -DHAVE_CONFIG_H -I. -I. -I. -I/sw/include -I/sw/include/glib-2.0 -I/sw/lib/glib-2.0/include -I/sw/include/pango-1.0 -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 -I/sw/include/gtk-2.0 -I/sw/include/atk-1.0 -I/sw/lib/gtk-2.0/include -I/sw/include/glib-2.0 -I/sw/lib/glib-2.0/include -I/sw/include/pango-1.0 -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 -I/sw/include/gtk-2.0 -I/sw/include/atk-1.0 -I/sw/lib/gtk-2.0/include -I/sw/include/gtkglext-1.0 -I/sw/lib/gtkglext-1.0/include -I/sw/include/glib-2.0 -I/sw/lib/glib-2.0/include -I/sw/include/pango-1.0 -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 -I/sw/include/gtk-2.0 -I/sw/include/atk-1.0 -I/sw/lib/gtk-2.0/include -I/sw/include/libxml2 -I/sw/include -I/sw/include/libglade-2.0 -I/sw/include/glib-2.0 -I/sw/lib/glib-2.0/include -I/sw/include/ghemical -g -O2 -c -o fileio.o fileio.cpp > In file included from project.h:14, > from fileio.cpp:10: > /sw/include/ghemical/libghemicalconfig2.h:88:1: warning: "VERSION" redefined > In file included from project.h:13, > from fileio.cpp:10: > ghemicalconfig2.h:103:1: warning: this is the location of the previous definition > In file included from filetrans.h:14, > from project.h:51, > from fileio.cpp:10: > ghemicalconfig2.h:103:1: warning: "VERSION" redefined > In file included from filetrans.h:13, > from project.h:51, > from fileio.cpp:10: > /sw/include/ghemical/libghemicalconfig2.h:88:1: warning: this is the location of the previous definition > In file included from /sw/include/ghemical/eng2_qm_mm.h:13, > from fileio.cpp:18: > /sw/include/ghemical/libghemicalconfig2.h:88:1: warning: "VERSION" redefined > In file included from filetrans.h:14, > from project.h:51, > from fileio.cpp:10: > ghemicalconfig2.h:103:1: warning: this is the location of the previous definition > > dan >