【问题标题】:How to override environment variables when running configure?运行configure时如何覆盖环境变量?
【发布时间】:2011-02-12 15:24:45
【问题描述】:

在任何适用于 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.

如何使用这些变量来包含目录?我尝试运行./configure --CFLAGS="-I/home/package/custom/" 和./configure CFLAGS="-I/home/package/custom/",但是这些都不起作用。有什么建议吗?

【问题讨论】:

    标签: include environment-variables autotools configure


    【解决方案1】:

    您需要用于-I 的变量是CPPFLAGS,而不是CFLAGS。 (正如您复制的帮助消息中所说的那样。)CPP 代表“C 预处理器”,而不是 C++。所以:

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

    【讨论】:

      【解决方案2】:

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

      【讨论】:

      • 但是,您也可以将它们作为标志传递给配置。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-31
      • 2021-09-15
      • 2020-02-15
      相关资源
      最近更新 更多