I am using GNU autotools for my project. The configure.ac script has the following snippet.
AC_ARG_WITH(chkhere,
AC_HELP_STRING([--without-chkhere], [do not compile]),
[ac_cv_chkhere=$withval], [ac_cv_chkhere=yes])
# Check if chkhere is available
if test "x$ac_cv_chkhere" = "xyes"
then
AC_DEFINE(HAVE_CHECKED)
echo "chkhere: enabled"
else
echo "chkhere: DISABLED"
fi
And I am checking for the variable HAVE_CHECKED in the C++ code. This works for --without-chkhere option.
When I am giving ./configure --with-chkhere, it shows the message "chkhere: enabled" as required, but HAVE_CHECKED turns up undefined inside the C++ code.
Please suggest where I am going wrong, or if I can test this differently? Thanks.
P.S.: I am following this sequence of commands: automake; libtoolize; aclocal -I m4; autoconf;