views:

153

answers:

2

In any major package for Linux, running ./configure --help will output at the end:

Some influential environment variables:
      CC          C compiler command
      CFLAGS      C compiler flags
      LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
                  nonstandard directory <lib dir>
      CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
                  headers in a nonstandard directory <include dir>
      CPP         C preprocessor

Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.

How do I use these variables to include a directory? I tried running ./configure --CFLAGS="-I/home/package/custom/" and ./configure CFLAGS="-I/home/package/custom/" however these do not work. Any suggestions?

A: 

These are not flags passed to configure. These are environment variables you need to set. e.g. export CFLAGS="-I foo"

frankc
However, you can also pass them as flags to configure.
ptomato
A: 

The variable you need to use for -I is CPPFLAGS, not CFLAGS. (As it says right there in the help message you copied.) CPP stands for "C preprocessor", not C++. So:

./configure CPPFLAGS='-I/home/package/custom'
ptomato