[ghemical-devel] Private configure tokens in public headers

Daniel Macks dmacks at netspace.org
Thu Oct 19 22:18:20 EDT 2006


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. 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

-- 
Daniel Macks
dmacks at netspace.org
http://www.netspace.org/~dmacks



More information about the ghemical-devel mailing list