automake
[Top][All Lists]
Advanced

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

How are env variables passed to the compilation process


From: Andy Falanga (afalanga)
Subject: How are env variables passed to the compilation process
Date: Tue, 10 Mar 2015 22:04:55 +0000

I'm trying to figure out how things like CXXFLAGS and CFLAGS get passed to 
ultimate point of compilation.  I thought I had it down but something that just 
happened recently has me wondering.  I've gotten my project building now using 
automake/autoconf/etc. (what I understand to be the autotools).  Now, the first 
target system I'm building on builds the code just fine but the library caused 
a segmentation violation.  I'd like to debug.

I go through the list of output made by the build process and discover that the 
build process didn't do what seems to be the "standard" options, "-O2 -g".   
Neither of these were used.  So, I thought I'd add them.  I did this:

make clean
./configure CFLAGS="-ggdb -O0" CXXFLAGS="-ggdb -O2"
make

Much to my surprise, the "-ggdb -O0" didn't appear then either.  Did I miss 
something?  Isn't this how they are set?

I ended up using this link 
http://www.gnu.org/software/automake/manual/html_node/Usage-of-Conditionals.html
 as a guide and did something like this:

AC_ARG_ENABLE([debug],
              [  --enable-debug        Turn on debugging],
              [case "${enableval}" in
               yes) debug=true;;
               no)  debug=false;;
               *)  AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
               esac], [debug=false])

AM_CONDITIONAL([DEBUG], [test x$debug = xtrue])

CPPFLAGS=" -D__linux__ -DADT_TRACE_ENABLE=0"

if [[ $debug = "true" ]]; then
    CFLAGS=" -O0 -ggdb"
    CXXFLAGS=" -std=c++0x -O0 -ggdb"
else
    CFLAGS=" -O2 -g"
    CXXFLAGS="-std=c++0x -O2 -g"
fi

Which is closer to my ultimate goal which is to use VPATH for debug vs. release 
builds.  One step at a time though.

Thanks
Andy



reply via email to

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