Question

I have a project that uses a define called PACKAGE_VERSION for some validations.

When I created a makefile using autoconf, I discovered that for every compile, autconf added a -DPACKAGE_VERSION=1.2 (because that is the version I am using in AC_INIT)

That define is in conflict with de define that my application uses. How can I prevent autoconf for doing this? I tried using AM_SUBST_NOTMAKE(PACKAGE_VERSION) but there was no change.

I don't want to refactor the application changing the name of the constant, I just want autoconf not to add a define that I do not need.

I am new to this autotools, so maybe this is a newbie question. Sorry

Était-ce utile?

La solution

That's an unfortunate collision - you could try adding CFLAGS=-UPACKAGE_VERSION to your command line to undefine it.

Using AC_CONFIG_HEADERS([config.h]) (explanation here) will prevent the -D flags from being passed to the compiler; then, in the files where you don't want the defines, simply don't #include "config.h".

Ultimately, though, if you plan to continue using Autotools for your package, it would be better to refactor the existing define, because keeping it is likely to cause hard-to-track-down errors down the line.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top