I have an installed library we'll call it "custom_lib" which I am linking against.
I want to check if that library was installed with a specific option.
The options.h header file in that library has a list of pre-processor macros like so:
#undef THIS
#define THIS
#undef THAT
#define THAT
#undef WE_WANT_THIS_ONE
#define WE_WANT_THIS_ONE
In another project I have in my configure.ac file this test:
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
I then autreconf and run ./configure which always returns this message:
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
Am I doing something wrong. What needs altered in the test I have in configure.ac so that autoconf can detect the pre-processor macro in options.h?