R - 找不到使用 configure.ac 的提升 C++

r - can't find boost c++ using configure.ac

本文关键字:C++ ac configure 找不到      更新时间:2023-10-16

我写了一个config.ac来查找boost c++的include路径,但它什么都找不到。如果我指定了路径,它就可以编译。有人能帮我吗?这是我的配置.ac

AC_PREREQ([2.67])
AC_INIT(pkg, 1.1.01)
AC_PROG_CXX
AC_ARG_WITH(
[boost],
[AS_HELP_STRING(
    [--with-boost=DIR],
    [path to look for Boost])
],
[boostpath=$withval],
   [boostpath=]
)
if test -n "$boostpath"; then
boostinc="-I$boostpath/include"
fi
CXXFLAGS="$CXXFLAGS ${boostinc}"
AC_SUBST([CXXFLAGS])
AC_CONFIG_FILES([Makevars])
AC_OUTPUT

非常感谢。

只需使用autoconf存档中的AX_BOOST_BASE

如果您试图使用AC_CHECK_HEADERS来验证boost标头的存在,请记住,您需要首先使用AC_LANG_PUSH([C++]),否则会出现"标头存在但无法编译"错误。