[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple definition of VERSION, PACKAGE and so on

From: Patrick Guio
Subject: Re: Multiple definition of VERSION, PACKAGE and so on
Date: Wed, 24 Mar 2004 09:44:05 +0100 (MET)

On Tue, 23 Mar 2004, Guido Draheim wrote:

> > What I mean by "interact" is that one package uses on another one :-)
> > I can give you an example. I have a package pack1 which I have encapsulated
> > in another one, pack2 (I mean that I have a subdirectory pack2 in pack1
> > and that configure.ac of pack2 has a AC_CONFIG_SUBDIRS(pack1) command).
> > I have choosen this architecture since pack2 (plasma simulator) builds on
> > top of pack1 (pde solver) and pack1 could be used on its own or for other
> > projects.
> >
> > Until recently, I didn't use the command AC_CONFIG_HEADERS and I didn't
> > have any problem since the macros definition -DPACKAGE -DVERSION were
> > option commands and put just once per compiler command.
> >
> > Now I wanted to start using AC_CONFIG_HEADERS because I have too many
> > defs, so I have just a AC_CONFIG_HEADERS([pack1-config.h])
> > and AC_CONFIG_HEADERS([pack2-config.h]) for each package.
> > The pack1-config.h is included only if HAVE_CONFIG_H is defined and is
> > included in my definition file for the package (C++ typedefs for template
> > arrays (double/float), constant defs, dimensionnality of the problem, MPI
> > use, FFTW use, HDF use, etc...). Each class declaration and definition
> > needs this file. The same is done in pack2 but some classes of pack2 uses
> > public methods of pack1 classes. Therefore in some classes definition of
> > pack2 I have to include the class declaration of some peculiar classes from
> > pack1. The result is that the pack1-config.h and pack2-config.h are both 
> > included.
> >
> > Now I don't really see how I can avoid that. But you may have suggestions?
> >
> As said before - it is TOTAL ERROR to include config.h (here: pack1-config.h)
> into header files made publically available to outside projects (here: pack2).

I would definitely like to hear how do you handle the following solution
if you mean this is TOTAL ERROR to include config.h into header files
that are made publically available to outside projects.
As far as now I have a pack1-defs.h header file containing definitions like:

#if defined(HAVE_CONFIG_H)
#include <pack1-config.h>

#if defined(FLOAT_FIELD)
typedef float pack1Real;
#elif defined(DOUBLE_FIELD)
typedef double pack1Real;
#error macro FLOAT_FIELD or DOUBLE_FIELD must be defined

typedef blitz::Array<pack1Real,1> Array1dr;
typedef blitz::Array<pack1Real,2> Array2dr;
typedef blitz::Array<pack3Real,3> Array3dr;

typedef blitz::Array<pack1Real,DIM> Field;

I need to make this file publically available to outside projects if I
don't want to redefine type Field for example. But to do so I have to
include pack1-config.h as well since definition FLOAT_FIELD or DOUBLE_FIELD
needs to be defined.

That's the way we handle definitions in the Blitz++ project as well so if
you have a better solution let me know!

> as a solution, instead of current usage, modify pack1/configure.ac to use
>    AX_PREFIX_CONFIG_HEADER([pack1-config.h])

This does not work with autoconf-2.59/automake-1.8.3.

% autoreconf -vif

autoreconf: Entering directory `mudfas'
autoreconf: running: libtoolize --copy --force
Putting files in AC_CONFIG_AUX_DIR, `config'.
autoreconf: running: /usr/local/gnu/bin/autoconf --force
autoreconf: running: /usr/local/gnu/bin/autoheader --force
autoheader: error: AC_CONFIG_HEADERS not found in configure.ac
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:10: not enough arguments for AC_CONFIG_HEADERS

Still a new configure is generated. But then when running configure

./configure: line 1580: syntax error near unexpected token
./configure: line 1580: `AX_PREFIX_CONFIG_HEADER(src/mudfas-config.h)'

It looks like AC_CONFIG_HEADER is enough (whithout S). So you don't need
to have the whole keyword but a long enough one to be unambiguous?

I have another remark. Is the use of AC_CONFIG_HEADER expected to have the
same behaviour as passing argument on line? (Because it is not
necessary the same behaviour as said in an earlier email)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]