我正在做一个使用Autoconf的项目。我在configure.ac中有以下内容
AC_CHECK_HEADERS([boost/foreach.hpp], [],
[AC_MSG_ERROR(You need the Boost libraries.)])当我运行configure时,它说找不到这个头文件:
checking boost/foreach.hpp usability... no
checking boost/foreach.hpp presence... no
checking for boost/foreach.hpp... no
configure: error: You need the Boost libraries.这很奇怪,因为我有Boost。如果我取消检查,代码就会编译,并且我已经安装了Boost:
$ find /usr/include -name foreach.hpp
/usr/include/boost/foreach.hpp
/usr/include/boost/test/utils/foreach.hpp请注意,我使用SDL做了完全相同的操作,并且它是有效的。
AC_CHECK_HEADERS([SDL/SDL.h], [],
[AC_MSG_ERROR(You need the SDL development library.)])..。
checking SDL/SDL.h usability... yes
checking SDL/SDL.h presence... yes
checking for SDL/SDL.h... yes发布于 2010-06-22 04:26:10
AC_CHECK_HEADERS实际上做的是编译检查,而不是存在检查。因此,您必须为编译测试设置C++支持,以便编译boost头文件(默认为C,docs here):
AC_LANG_PUSH([C++])
AC_CHECK_HEADERS([boost/foreach.hpp], [],
[AC_MSG_ERROR(You need the Boost libraries.)])
AC_LANG_POP([C++])发布于 2010-06-22 14:13:04
您可能会对github.com/tsuna/boost.m4感兴趣,它是一组Autoconf宏,用于检查Boost头文件和库以及Boost的最低版本。
发布于 2010-08-20 08:30:15
在GNU Autoconf Archive上还有一个Boost autoconf宏的集合。您可能至少需要AX_BOOST_BASE。其他Boost库的其他宏也在那里。
https://stackoverflow.com/questions/3088069
复制相似问题