diff options
author | Daniel Burrows <Daniel Burrows Daniel_Burrows@alumni.brown.edu> | 2010-05-20 22:08:35 -0700 |
---|---|---|
committer | Daniel Burrows <Daniel Burrows Daniel_Burrows@alumni.brown.edu> | 2010-05-20 22:08:35 -0700 |
commit | 807cec77e03264f40a899986827592344c02d6ec (patch) | |
tree | c0607bf9ec2b07eb379e90ee357cf05720614166 /configure.ac | |
parent | 9efb6026261321956e4a1d0409647db877ba4e6d (diff) | |
download | aptitude-807cec77e03264f40a899986827592344c02d6ec.tar.gz |
Write a configure check that tries to locate the Boost unit test libraries.
I didn't just use the Autoconf find-a-library macro
because that one changes $LIBS instead of storing the
library in a variable.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 2885d5da..009ed6cc 100644 --- a/configure.ac +++ b/configure.ac @@ -201,6 +201,48 @@ int main(int argc, char **argv) ]) +AC_MSG_CHECKING([the name of the runtime library for Boost.Test]) + + +##### Boost.Test check ##### +OLDLIBS="$LIBS" +for libname in boost_unit_test_framework-mt boost_unit_test_framework +do + LIBS="$LIBS -l$libname" + + AC_LINK_IFELSE([ +#define BOOST_TEST_DYN_LINK +#define BOOST_TEST_NO_MAIN + +#include <boost/test/unit_test.hpp> + +bool init_unit_test() +{ + return true; +} + +int main(int argc, char **argv) +{ + return boost::unit_test::unit_test_main(init_unit_test, argc, argv); +} +], + BOOST_UNIT_TEST_LIBS="-l$libname") + + LIBS="$OLDLIBS" +done + +if test -z "$BOOST_UNIT_TEST_LIBS" +then + # TODO: just disable the unit tests? + AC_MSG_FAILURE([Can't find the Boost unit test library; install libboost-test-dev.]) +else + AC_MSG_RESULT(["$BOOST_UNIT_TEST_LIBS"]) +fi + +AC_SUBST(BOOST_UNIT_TEST_LIBS) + +##### End Boost.Test check ##### + PKG_CHECK_MODULES(SQLITE3, sqlite3) HAVE_GTK=1 |