我有一个已安装的库,我们将其称为“custom_lib”,我正在链接它。
我想检查该库是否安装了特定选项。
该库中的 options.h 头文件有一个预处理器宏列表,如下所示:
#undef THIS
#define THIS
#undef THAT
#define THAT
#undef WE_WANT_THIS_ONE
#define WE_WANT_THIS_ONE
在另一个项目中,我的 configure.ac 文件中有这个测试:
OPTION_FOUND="no"
AC_CHECK_HEADERS(custom_lib/options.h)
AC_MSG_CHECKING([is libary configured with --enable-we_want_this_one])
#AC_EGREP_HEADER([ string to match ],
# [ header file ],
# [ action if found ],
# [ action if not found ])
AC_EGREP_HEADER([[WE_WANT_THIS_ONE]],
[custom_lib/options.h],
[OPTION_FOUND="yes"],
[OPTION_FOUND="no"])
if test "$OPTION_FOUND" = "yes"
then
# If we have WE_WANT_THIS_ONE check to see which compiler is being used
if test "$GCC" = "yes"
then
if test "$CC" != "icc"
then
#if compiler is not icc then add these flags
CFLAGS="$CFLAGS -maes -msse4"
fi
fi
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
然后我 autreconf 并运行 ./configure ,它总是返回此消息:
checking custom_lib/options.h usability... yes
checking custom_lib/options.h presence... yes
checking for custom_lib/options.h... yes
checking is library configured with --enable-we_want_this_one... no
难道我做错了什么。我在configure.ac中的测试需要改变什么,以便autoconf可以检测options.h中的预处理器宏?