Next: , Previous: Standard Directory Variables, Up: Use Cases


2.2.4 Standard Configuration Variables

The GNU Coding Standards also define a set of standard configuration variables used during the build. Here are some:

CC
C compiler command
CFLAGS
C compiler flags
CXX
C++ compiler command
CXXFLAGS
C++ compiler flags
LDFLAGS
linker flags
CPPFLAGS
C/C++ preprocessor flags
...

configure usually does a good job at setting appropriate values for these variables, but there are cases where you may want to override them. For instance you may have several versions of a compiler installed and would like to use another one, you may have header files installed outside the default search path of the compiler, or even libraries out of the way of the linker.

Here is how one would call configure to force it to use gcc-3 as C compiler, use header files from ~/usr/include when compiling, and libraries from ~/usr/lib when linking.

     ~/amhello-1.0 % ./configure --prefix ~/usr CC=gcc-3 \
     CPPFLAGS=-I$HOME/usr/include LDFLAGS=-L$HOME/usr/lib

Again, a full list of these variables appears in the output of ./configure --help.