开发者

clang fails autoconf AC_CHECK_HEADER checks with explicit CPPFLAGS search paths

开发者 https://www.devze.com 2023-04-12 06:04 出处:网络
In an established autotools-managed project which is almost always built with GCC, I decided to try using LLVM clang as a g++ substitute, but found that it falls over on a personally-written header ch

In an established autotools-managed project which is almost always built with GCC, I decided to try using LLVM clang as a g++ substitute, but found that it falls over on a personally-written header check that uses the standard AC_CHECK_HEADER macro. Here's the checking code:

oldCPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -I$GSLINCPATH"
AC_CHECK_HEADER([gsl/gsl_vector.h], [], [AC_MSG_ERROR([GSL vectors not found.])])
CPPFLAGS=$oldCPPFLAGS

and here's the failure message:

checking gsl/gsl_vector.h usability... no
checking gsl/gsl_vector.h presence... no
checking for gsl/gsl_vector.h... no
configure: error: GSL vectors not found.

The value of $GSLINCPATH is /usr/include (explicitly checked), /usr/include/gsl/gsl_vector.h does exist, and this check 开发者_Go百科code works nicely with GCC. The temporary switching in of a modified $CPPFLAGS seems to be the de facto standard way to do this test, but is there a better way that is more portable? Or is there another reason for this problem?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号