如何在运行configure时覆盖环境变量?

Sam*_*Sam 5 autotools configure environment-variables include

在Linux的任何主要包中,运行./configure --help将在最后输出:

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.
Run Code Online (Sandbox Code Playgroud)

如何使用这些变量来包含目录?我试图运行./configure --CFLAGS="-I/home/package/custom/"./configure CFLAGS="-I/home/package/custom/",然而这些不工作.有什么建议?

pto*_*ato 7

你需要使用的变量-ICPPFLAGS,没有CFLAGS.(正如它在您复制的帮助消息中所说的那样.)CPP代表"C预处理器",而不是C++.所以:

./configure CPPFLAGS='-I/home/package/custom'
Run Code Online (Sandbox Code Playgroud)


fra*_*nkc 4

这些不是传递给配置的标志。这些是您需要设置的环境变量。例如export CFLAGS="-I foo"

  • 但是,您也可以将它们作为标志传递以进行配置。 (2认同)