AC_CHECK_HEADER失败如果标题安装路径中有API

AC_CHECK_HEADER fail if the header install path has api in it

本文关键字:路径 API 安装 如果 CHECK HEADER 失败 AC 标题      更新时间:2023-10-16

例如,bamtools package的标题文件之一是

安装
/usr/local/include/bamtools/api

我试图将Include Flag设置为:

CXXFLAGS="$CXXFLAGS -I/usr/local/include/bamtools"
or
CXXFLAGS="$CXXFLAGS -I/usr/local/include/bamtools/api"
AC_CHECK_HEADERS([BamReader.h], [bamtools_found=yes], [AC_MSG_ERROR([Unable to find bambools header])])

如果我检查了config.log文件,第一个给了我一个错误:

configure:3837: g++ -c -g -O2 -I/usr/local/include/bamtools  conftest.cpp >&5
conftest.cpp:54:23: fatal error: BamReader.h: No such file or directory
compilation terminated.

第二个给我以下错误:

configure:3837: g++ -c -g -O2 -I/usr/local/include/bamtools/api  conftest.cpp >&5
In file included from conftest.cpp:54:0:
/usr/local/include/bamtools/api/BamReader.h:13:28: fatal error: api/api_global.h: No such file or directory
 #include "api/api_global.h"^M
                            ^
compilation terminated.
configure:3837: $? = 1

问题是bamreader.h尝试包括api/api_global.h

我通过将API放入AC_CHECK_HEADERS中得到了一个简单的修复。

CXXFLAGS="$CXXFLAGS -I/usr/local/include/bamtools"
AC_CHECK_HEADERS([api/BamReader.h], [bamtools_found=yes], [AC_MSG_ERROR([Unable to find bambools header])])
configure output
checking api/BamReader.h usability... yes

本质上,您必须通过将API/附加到每个标头来使用库。请评论:这是一个好习惯吗?