[Top][All Lists]

[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"

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
 as a guide and did something like this:

              [  --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])


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

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


reply via email to

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