automake
[Top][All Lists]
Advanced

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

How to properly make an enable debugging option in configure


From: Andy Falanga (afalanga)
Subject: How to properly make an enable debugging option in configure
Date: Sat, 13 Feb 2016 00:31:51 +0000

I would like to know the "proper" method for adding an "--enable-debug" 
option to my build using autotools.  Perhaps what I should call this is 
a "best-practice" or something similar.  So, some googling and Autotools 
Mythbusters suggests it should be AC_ARG_ENABLE.  So, I put this into my 
configure.ac file:

AC_ARG_ENABLE([debug],
      AC_HELP_STRING([--enable-debug],
                     [Additional output from binary and turns off 
optimizations]),
      [CXXCPP="${CXXCPP} -DDEBUG"
       CXXFLAGS="${CXXFLAGS} -O0 -ggdb"],
      [CXXCPP=${CXXCPP}
       CXXFLAGS="${CXXFLAGS} -O2 -g"])


However, when I run configure, I get this:

checking how to run the C++ preprocessor...  -DDEBUG
configure: error: in `/home/afalanga/devel/o2archanges':
configure: error: C++ preprocessor " -DDEBUG" fails sanity check
See `config.log' for more details

So, I look in config.log but this doesn't really help.  Is there a 
better way?  Should I instead make it add "#define DEBUG" in config.h if 
"--enable-debug" is provided?  Did I make an incorrect assumption in the 
actions arguments to AC_ARG_ENABLE()?  Any help is greatly appreciated.

Andy

reply via email to

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