X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=boost.m4;h=0540465f0ea9c59ae1fbd8ee236b6e05ffc8de9c;hb=4f4f4349139aad0bc00bd62c4ea4ab4239f34af4;hp=f3dd675a62b8f92a0e19e3d9de166da1c2279f79;hpb=b5276fbb202d7e84f4bb8f30e2eed80490db6b8a;p=m4-moved-to-github.git diff --git a/boost.m4 b/boost.m4 index f3dd675..0540465 100644 --- a/boost.m4 +++ b/boost.m4 @@ -23,13 +23,28 @@ AC_DEFUN([ID_BOOST], BOOST_REQ_VERSION=`echo "$2" | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 100 + [$]3;}'` CPPFLAGS="$CPPFLAGS -DBOOST_REQ_VERSION=${BOOST_REQ_VERSION}" - AC_ARG_WITH([boost],[[ --with-boost=DIR use Boost in prefix DIR]]) + AC_ARG_WITH([boost],[ --with-boost=DIR use Boost in prefix DIR]) if test "$with_boost" = "yes" -o -z "$with_boost"; then BOOST_CPPFLAGS="" BOOST_LIB="" else + for b in ${with_boost}/lib ${with_boost}/lib64; do + if test -d "$b"; then + BOOST_LIB="-L$b" + fi + done BOOST_CPPFLAGS="-I${with_boost}/include" - BOOST_LIB="-L${with_boost}/lib" + if test ! -f "${with_boost}/include/boost/version.hpp"; then + for b in ${with_boost}/include/boost-*; do + BOOST_CPPFLAGS="-I$b" + done + fi + fi + AC_ARG_WITH([boost-toolset],[ --with-boost-toolset=x use Boost toolset (eg gcc43)]) + if test "$with_boost_toolset" = "yes" -o -z "$with_boost_toolset"; then + BOOST_TOOLSET="" + else + BOOST_TOOLSET="-${with_boost_toolset}" fi if test "${with_boost}" = "no"; then AC_MSG_RESULT([disabled]) @@ -42,65 +57,64 @@ AC_DEFUN([ID_BOOST], version_is:BOOST_VERSION ]])]) BOOST_GOT_VERSION=`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | $EGREP version_is 2>/dev/null | cut -d ":" -f2` - if test $BOOST_GOT_VERSION = "BOOST_VERSION"; then + if test -z "$BOOST_GOT_VERSION" -o \ + "$BOOST_GOT_VERSION" = "BOOST_VERSION"; then AC_MSG_RESULT([no]) AC_MSG_ERROR([Boost development libraries required]) fi AC_MSG_RESULT([yes ($BOOST_GOT_VERSION)]) - if test $BOOST_GOT_VERSION -lt $BOOST_REQ_VERSION; then + if test "$BOOST_GOT_VERSION" -lt $BOOST_REQ_VERSION; then AC_MSG_ERROR([Boost version $BOOST_REQ_VERSION required]) fi for c in $1; do case $c in thread) + AC_MSG_CHECKING([Boost threads]) AC_SUBST([BOOST_THREAD_LIB]) + saveLIBS="${LIBS}" BOOST_THREAD_LIB="" - for l in boost_thread-mt boost_thread; do - AC_CHECK_LIB([${l}],[main],[ - BOOST_THREAD_LIB="-l${l}" - break - ],[]) - done - if test -z "${BOOST_THREAD_LIB}"; then - AC_MSG_ERROR([Boost thread libs not found]) - fi - LIBS="${LIBS} ${BOOST_THREAD_LIB}" - AC_MSG_CHECKING([Boost threads]) + for l in boost_thread${BOOST_TOOLSET}-mt boost_thread${BOOST_TOOLSET}; do + LIBS="${saveLIBS} -l${l}" AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include #include ]],[[ int x = BOOST_VERSION; -]])],[AC_MSG_RESULT([yes])],[ -AC_MSG_RESULT([no]) -AC_MSG_ERROR([Boost thread libraries required]) - ]) +]])],[ + BOOST_THREAD_LIB="-l${l}" + break],[]) + done + if test "${BOOST_THREAD_LIB}"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi ;; test) + AC_MSG_CHECKING([Boost unit test framework]) + saveLIBS="${LIBS}" AC_SUBST([BOOST_TEST_LIB]) BOOST_TEST_LIB="" - for l in boost_unit_test_framework-mt boost_unit_test_framework; do - AC_CHECK_LIB([${l}],[main],[ - BOOST_TEST_LIB="-l${l}" - break - ],[]) - done - if test -z "${BOOST_TEST_LIB}"; then - AC_MSG_ERROR([Boost unit test libs not found]) - fi - saveLIBS="${LIBS}" - LIBS="${LIBS} ${BOOST_TEST_LIB}" - AC_MSG_CHECKING([Boost unit test framework]) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + for l in boost_unit_test_framework${BOOST_TOOLSET}-mt boost_unit_test_framework${BOOST_TOOLSET}; do + LIBS="${saveLIBS} -l${l}" + AC_LINK_IFELSE([AC_LANG_SOURCE([[ #define BOOST_TEST_DYN_LINK +#define BOOST_AUTO_TEST_MAIN #include BOOST_AUTO_TEST_CASE( t ) { BOOST_CHECK(1); } -]],[[ -]])],[AC_MSG_RESULT([yes])],[AC_MSG_RESULT([no]) -AC_MSG_ERROR([Boost unit test framework libraries required])]) +]])],[ + BOOST_TEST_LIB="-l${l}" + break +],[]) + done + if test "${BOOST_TEST_LIB}"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi LIBS="${saveLIBS}" ;; esac @@ -110,5 +124,9 @@ AC_MSG_ERROR([Boost unit test framework libraries required])]) LIBS="$oldLIBS" AC_LANG_POP([C++]) ]) - +dnl Local Variables: +dnl mode:shell-script +dnl sh-indentation: 2 +dnl sh-basic-offset: 4 +dnl End: