Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to override environment variables when running configure?

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?

like image 376
Sam Avatar asked Apr 26 '10 23:04

Sam


2 Answers

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'
like image 112
ptomato Avatar answered Oct 17 '22 20:10

ptomato


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

like image 34
frankc Avatar answered Oct 17 '22 18:10

frankc