From bfb4d21e76ca10111191d62b8c28ab6b89771f03 Mon Sep 17 00:00:00 2001 From: apo Date: Fri, 17 Feb 2006 08:18:13 +0000 Subject: [PATCH] To use native BOOST libraries --- salome_adm/unix/config_files/check_boost.m4 | 140 +++++++++++++------- salome_adm/unix/make_commence.in | 2 +- 2 files changed, 95 insertions(+), 47 deletions(-) diff --git a/salome_adm/unix/config_files/check_boost.m4 b/salome_adm/unix/config_files/check_boost.m4 index c31e57b2b..12cd2a864 100644 --- a/salome_adm/unix/config_files/check_boost.m4 +++ b/salome_adm/unix/config_files/check_boost.m4 @@ -23,69 +23,117 @@ AC_DEFUN([CHECK_BOOST],[ AC_CHECKING(for BOOST Library) +AC_REQUIRE([ENABLE_PTHREADS])dnl + AC_LANG_SAVE AC_LANG_CPLUSPLUS -AC_SUBST(BOOST_CPPFLAGS) BOOST_CPPFLAGS="" - -AC_SUBST(BOOST_LIBS) +BOOST_LIBSUFFIX="-mt" BOOST_LIBS="" -AC_SUBST(BOOST_LIBTHREAD) -BOOST_LIBTHREAD="" +AC_CHECKING(for BOOST location) +AC_ARG_WITH(boost, + [ --with-boost=DIR root directory path to BOOST library installation ], + [BOOSTDIR="$withval" + AC_MSG_RESULT("select $withval as path to BOOST library") + ]) -boost_ok=no +AC_MSG_RESULT(\$BOOSTDIR = ${BOOSTDIR}) -if test -z ${BOOSTDIR}; then - AC_CHECK_HEADER(boost/shared_ptr.hpp,boost_ok=yes,boost_ok=no) - if test boost_ok = no ; then - AC_MSG_WARN(You must provide BOOSTDIR variable) - fi -else - AC_MSG_RESULT(\$BOOSTDIR = ${BOOSTDIR}) +CPPFLAGS_old="${CPPFLAGS}" +LIBS_old=$LIBS - dnl BOOST headers - AC_CHECKING(for boost/shared_ptr.hpp header file) - CPPFLAGS_old="${CPPFLAGS}" +if test "x${BOOSTDIR}" != "x" ; then BOOST_CPPFLAGS="-I${BOOSTDIR}/include" - CPPFLAGS="${CPPFLAGS} ${BOOST_CPPFLAGS}" - - AC_CHECK_HEADER(boost/shared_ptr.hpp,boost_ok=yes,boost_ok=no) - - CPPFLAGS="${CPPFLAGS_old}" - - if test "x${boost_ok}" = "xyes" ; then - AC_MSG_RESULT(\$BOOST_CPPFLAGS = ${BOOST_CPPFLAGS}) - dnl BOOST libs - AC_CHECKING(for libboost_thread-mt.so library file) - AC_CHECK_FILE(${BOOSTDIR}/lib/libboost_thread-mt.so,boost_ok=yes,boost_ok=no) - if test "x${boost_ok}" = "xyes" ; then - BOOST_LIBTHREAD="libboost_thread-mt.so" - AC_MSG_RESULT(\$BOOST_LIBTHREAD = ${BOOST_LIBTHREAD}) - BOOST_LIBTHREAD="-mt" - else - AC_CHECKING(for libboost_thread.so library file) - AC_CHECK_FILE(${BOOSTDIR}/lib/libboost_thread.so,boost_ok=yes,boost_ok=no) - if test "x${boost_ok}" = "xyes" ; then - BOOST_LIBTHREAD="libboost_thread.so" - AC_MSG_RESULT(\$BOOST_LIBTHREAD = ${BOOST_LIBTHREAD}) - BOOST_LIBTHREAD="" - fi + BOOST_LIBS="-L${BOOSTDIR}/lib" +fi + +boost_ok=no +boost_headers_ok=no +boost_binaries_ok=no + +dnl BOOST headers +AC_CHECKING(for BOOST headers) +CPPFLAGS="${CPPFLAGS_old} ${BOOST_CPPFLAGS}" + +boost_include_dir_ok=yes +if test "x${BOOSTDIR}" != "x" ; then + AC_CHECK_FILE(${BOOSTDIR}/include/boost/shared_ptr.hpp, + boost_include_dir_ok=yes, + boost_include_dir_ok=no) +fi + +if test "x${boost_include_dir_ok}" = "xyes" ; then + AC_TRY_COMPILE([#include ], + [boost::shared_ptr(new int)], + boost_headers_ok=yes, + boost_headers_ok=no) +fi + +if test "x${boost_headers_ok}" = "xno" ; then + BOOST_CPPFLAGS="BOOST_CPPFLAGS_NOT_DEFINED" +else + AC_MSG_RESULT(\$BOOST_CPPFLAGS = ${BOOST_CPPFLAGS}) +fi +AC_MSG_RESULT(for boost headers: $boost_headers_ok) + +if test "x${boost_headers_ok}" = "xyes" ; then + dnl BOOST binaries + AC_CHECKING(for BOOST binaries) + boost_lib_dir_ok=yes + if test "x${BOOSTDIR}" != "x" ; then + AC_CHECK_FILE(${BOOSTDIR}/lib/libboost_thread${BOOST_LIBSUFFIX}.so, + boost_lib_dir_ok=yes, + boost_lib_dir_ok=no) + if test "x${boost_lib_dir_ok}" = "xno" ; then + BOOST_LIBSUFFIX="" + AC_CHECK_FILE(${BOOSTDIR}/lib/libboost_thread${BOOST_LIBSUFFIX}.so, + boost_lib_dir_ok=yes, + boost_lib_dir_ok=no) fi - if test "x${boost_ok}" = "xyes" ; then - if test "x${BOOSTDIR}" = "x/usr" ; then - BOOST_LIBS="" - else - BOOST_LIBS="-L${BOOSTDIR}/lib" - fi - AC_MSG_RESULT(\$BOOST_LIBS = ${BOOST_LIBS}) + fi + if test "x${boost_lib_dir_ok}" = "xyes" ; then + LIBS="${LIBS_old} ${BOOST_LIBS} -lboost_thread${BOOST_LIBSUFFIX}" + AC_TRY_LINK([#include ], + [struct TBody{ void operator()(){} }; boost::thread(TBody())], + boost_binaries_ok=yes, + boost_binaries_ok=no) + if test "x${boost_binaries_ok}" = "xno" ; then + BOOST_LIBSUFFIX="" + LIBS="${LIBS_old} ${BOOST_LIBS} -lboost_thread${BOOST_LIBSUFFIX}" + AC_TRY_LINK([#include ], + [struct TBody{ void operator()(){} }; boost::thread(TBody())], + boost_binaries_ok=yes, + boost_binaries_ok=no) fi fi fi +if test "x${boost_binaries_ok}" = "xno" ; then + BOOST_LIBS="BOOST_LIBS_NOT_FOUND" + BOOST_LIBSUFFIX="-not-defined" +else + AC_MSG_RESULT(\$BOOST_LIBSUFFIX = ${BOOST_LIBSUFFIX}) + AC_MSG_RESULT(\$BOOST_LIBS = ${BOOST_LIBS}) +fi +AC_MSG_RESULT(for boost binaries: $boost_binaries_ok) + +CPPFLAGS="${CPPFLAGS_old}" +LIBS="${LIBS_old}" + +if test "x${boost_headers_ok}" = "xyes" ; then + if test "x${boost_binaries_ok}" = "xyes" ; then + boost_ok=yes + fi +fi + AC_MSG_RESULT(for boost: $boost_ok) +AC_SUBST(BOOST_CPPFLAGS) +AC_SUBST(BOOST_LIBSUFFIX) +AC_SUBST(BOOST_LIBS) + AC_LANG_RESTORE ])dnl diff --git a/salome_adm/unix/make_commence.in b/salome_adm/unix/make_commence.in index d1b961624..52f9ab9ca 100644 --- a/salome_adm/unix/make_commence.in +++ b/salome_adm/unix/make_commence.in @@ -42,8 +42,8 @@ CXX_DEPEND_FLAG = @CXX_DEPEND_FLAG@ # BOOST Library BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ +BOOST_LIBSUFFIX = @BOOST_LIBSUFFIX@ BOOST_LIBS = @BOOST_LIBS@ -BOOST_LIBTHREAD = @BOOST_LIBTHREAD@ # OpenPBS -- 2.39.2