Autotools:设置“有影响力的环境变量”

时间:2014-01-02 13:47:03

标签: variables environment configure autotools

运行'./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>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>
  CXX         C++ compiler command
  CXXFLAGS    C++ compiler flags
  CPP         C preprocessor
  CXXCPP      C++ preprocessor
  PKG_CONFIG  path to pkg-config utility
  PKG_CONFIG_PATH
              directories to add to pkg-config's search path
  PKG_CONFIG_LIBDIR
              path overriding pkg-config's built-in search path
  lib_CFLAGS  C compiler flags for <lib>, overriding pkg-config
  lib_LIBS    linker flags for <lib>, overriding pkg-config

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

如何在上面的列表中添加自定义变量?我知道这是可能的,PKG_CHECK_MODULES()会这样做。看一下pkg.m4(定义了PKG_CHECK_MODULES),我看到宏也设置了pkg_cv_lib_CFLAGS和ac_cv_env_lib_CFLAGS。

我尝试使用自定义'ac_cv_env _...'和'pkg_cv _...'变量,但我没有运气。我该怎么办?

提前致谢

1 个答案:

答案 0 :(得分:3)

您可以使用AC_ARG_VAR添加“珍贵”变量。

AC_ARG_VAR([FOO],[FOO does something])