Why doesn't autoconf pass the AC_CHECK_HEADER test when the .h is file clearly available?

别来无恙 提交于 2019-12-04 02:43:20
dusktreader

I found what the issue was. The library that I am working with is a C library, but the "inky" library that I am linking against is a C++ library. So, the language (AC_LANG) was set to C early in the configure.ac script. While performing checks for "inky", I needed to change the language to C++ so that Autoconf used the C++ compiler instead of the C compiler. This was done rather easily by using:

AC_LANG_PUSH([C++])
dnl # Do the checks for inky
AC_LANG_POP([C++])

This solved both the problem that I asked about in this thread, and on that I hand't posted yet wherein I couldn't get the AC_CHECK_LIB macro to work.

Thank you everyone for your input.

The fourth argument of AC_CHECK_HEADER is not a list of headers, but some C code that performs the include.

Maybe try something along the line of

AC_CHECK_HEADER([inky.h],
[],
[AC_MSG_ERROR([Couldn't find or include inky.h])],
[#include <dinky.h>
#include <plinky.h>
])

or even

AC_CHECK_HEADERS([dinky.h plinky.h inky.h],
[],
[AC_MSG_ERROR([Couldn't find or include this header])],
[#if HAVE_DINKY_H
#  include <dinky.h>
#endif
#if HAVE_PLINKY_H
#  include <plinky.h>
#endif
])
Mel

The details about why this test is failing are in config.log. My guess is though, that:

  • Since you're not adding the path found with AC_CHECK_FILE to CPPFLAGS or INCLUDES or whatever autoconf is using these days.
  • AC_CHECK_HEADER does not find the header using preprocessor compilation (for another reason than the header being missing in CPPFLAGS includes).
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!