Reputation: 980
The ax_boost_base page indicates that it sets HAVE_BOOST. So I tried it in my configure.ac file:
AX_BOOST_BASE([1.48],, [AC_MSG_ERROR([libfoo needs Boost, but it was not found in your system])])
AC_MSG_NOTICE(["HAVE_BOOST value"])
AC_MSG_NOTICE([$HAVE_BOOST])
When I run configure
, HAVE_BOOST does not seem to have any value:
checking for boostlib >= 1.48 (104800)... yes
configure: "HAVE_BOOST value"
configure:
How do I use this HAVE_BOOST in my configure.ac? Specifically, I want to append a file into my AC_OUTPUT if HAVE_BOOST is set. For example, if HAVE_BOOST is not set, then I want:
AC_OUTPUT([
Makefile
include/Makefile
comm/Makefile
ordinary_app/Makefile
])
But if HAVE_BOOST is set, then I want this:
AC_OUTPUT([
Makefile
include/Makefile
comm/Makefile
ordinary_app/Makefile
boost_enabled_app/Makefile
Upvotes: 1
Views: 99
Reputation: 1193
You missed to set the result back to some variable. You can try this
AX_BOOST_BASE([1.48],
[have_boost=yes],
[AC_MSG_ERROR([libfoo needs Boost, but it was not found in your system])]
)
AC_MSG_NOTICE(["have_boost value"])
AC_MSG_NOTICE([$have_boost])
The HAVE_BOOST is set in the m4 macro ax_boost_base
uses AC_DEFINE
that would be generated in config.h. It's not a shell variable.
Eventually you can use the var $have_boost to get what you want
if test "$have_boost" != yes; then
AC_OUTPUT([
Makefile
include/Makefile
comm/Makefile
ordinary_app/Makefile
])
else
AC_OUTPUT([
Makefile
include/Makefile
comm/Makefile
ordinary_app/Makefile
boost_enabled_app/Makefile
])
fi
Upvotes: 2