I’m trying to define a C preprocessor variable “DEBUG” (#define DEBUG) to activate debug logging in an opensource project, it uses GNU Autotools. So I put a line
AC_DEFINE(DEBUG, 1, [My description for DEBUG])
in configure.ac.
But what?
After regenerating the config.h
autoheader && ./config.status
I look at the content of config.h and see this
/* My description for DEBUG */
/* #undef DEBUG */
What the heck happened here? Other similar C preprocessor variables (by the project) are defined in the same way. They all appeared “#define”‘d and uncommented, why mine becomes “#undef”‘d and commented out?
So I tried many ways to do it, not just this way, I mimic the way other symbols by the project is defined. Tried all kinds of value, from 1 to TRUE, FALSE, all kinds of variable, from “DEBUG” to “FOOBAR”, “KJJJ”…. But it still works like that, I’m completely frustrated.
More info:
When looking at config.h.in, I see all the lines are like this:
#undef SOMEVARIABLE
(Including my define AND the ones that appear validly #defined’d in config.h.)
When I don’t run autoheader and just change the line of my variable in config.h.in to
#define DEBUG
then generate config.h, then my DEBUG variable appears validly #define’d in config.h
*Autoconf version 2.67
*The project I’m working on is ibus
Running
autoheadermodifiesconfig.h.in, but notconfig.status.config.statusdoes not know about the change you have made toconfigure.ac, and does not know to do substitutions forDEBUG. It will not be updated until you runautoconfand the resultingconfigurescript.