1 dnl Copyright (C) 2006-2023 CEA, EDF
3 dnl This library is free software; you can redistribute it and/or
4 dnl modify it under the terms of the GNU Lesser General Public
5 dnl License as published by the Free Software Foundation; either
6 dnl version 2.1 of the License, or (at your option) any later version.
8 dnl This library is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
10 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 dnl Lesser General Public License for more details.
13 dnl You should have received a copy of the GNU Lesser General Public
14 dnl License along with this library; if not, write to the Free Software
15 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 AC_DEFUN([CHECK_BOOST],[
22 AC_CHECKING(for BOOST Library)
24 AC_REQUIRE([ENABLE_PTHREADS])dnl
33 AC_CHECKING(for BOOST location)
35 [AC_HELP_STRING([--with-boost=DIR],[root directory path to BOOST library installation])],
37 AC_MSG_RESULT("select $withval as path to BOOST library")
40 if test "x${BOOSTDIR}" = "x" ; then
44 AC_MSG_RESULT(\$BOOSTDIR = ${BOOSTDIR})
46 CPPFLAGS_old="${CPPFLAGS}"
49 if test "x${BOOSTDIR}" != "x" ; then
50 BOOST_CPPFLAGS="-I${BOOSTDIR}/include"
51 BOOST_LIBS="-L${BOOSTDIR}/lib${LIB_LOCATION_SUFFIX}"
59 AC_CHECKING(for BOOST headers)
60 CPPFLAGS="${CPPFLAGS_old} ${BOOST_CPPFLAGS}"
62 boost_include_dir_ok=yes
63 if test "x${BOOSTDIR}" != "x" ; then
64 AC_CHECK_FILE(${BOOSTDIR}/include/boost/shared_ptr.hpp,
65 boost_include_dir_ok=yes,
66 boost_include_dir_ok=no)
69 if test "x${boost_include_dir_ok}" = "xyes" ; then
70 AC_TRY_COMPILE([#include <boost/shared_ptr.hpp>],
71 [boost::shared_ptr<int>(new int)],
76 if test "x${boost_headers_ok}" = "xno" ; then
77 BOOST_CPPFLAGS="BOOST_CPPFLAGS_NOT_DEFINED"
79 AC_MSG_RESULT(\$BOOST_CPPFLAGS = ${BOOST_CPPFLAGS})
81 AC_MSG_RESULT(for boost headers: $boost_headers_ok)
83 if test "x${boost_headers_ok}" = "xyes" ; then
85 AC_CHECKING(for BOOST binaries)
87 if test "x${BOOSTDIR}" != "x" ; then
88 AC_CHECK_FILE(${BOOSTDIR}/lib${LIB_LOCATION_SUFFIX}/libboost_thread${BOOST_LIBSUFFIX}.so,
91 if test "x${boost_lib_dir_ok}" = "xno" ; then
93 AC_CHECK_FILE(${BOOSTDIR}/lib${LIB_LOCATION_SUFFIX}/libboost_thread${BOOST_LIBSUFFIX}.so,
98 if test "x${boost_lib_dir_ok}" = "xyes" ; then
99 LIBS="${LIBS_old} ${BOOST_LIBS} -lboost_thread${BOOST_LIBSUFFIX}"
100 AC_TRY_LINK([#include <boost/thread/thread.hpp>],
101 [struct TBody{ void operator()(){} }; boost::thread(TBody())],
102 boost_binaries_ok=yes,
103 boost_binaries_ok=no)
104 if test "x${boost_binaries_ok}" = "xno" ; then
106 LIBS="${LIBS_old} ${BOOST_LIBS} -lboost_thread${BOOST_LIBSUFFIX}"
107 AC_TRY_LINK([#include <boost/thread/thread.hpp>],
108 [struct TBody{ void operator()(){} }; boost::thread(TBody())],
109 boost_binaries_ok=yes,
110 boost_binaries_ok=no)
115 if test "x${boost_binaries_ok}" = "xno" ; then
116 BOOST_LIBS="BOOST_LIBS_NOT_FOUND"
117 BOOST_LIBSUFFIX="-not-defined"
119 AC_MSG_RESULT(\$BOOST_LIBSUFFIX = ${BOOST_LIBSUFFIX})
120 AC_MSG_RESULT(\$BOOST_LIBS = ${BOOST_LIBS})
122 AC_MSG_RESULT(for boost binaries: $boost_binaries_ok)
124 CPPFLAGS="${CPPFLAGS_old}"
127 if test "x${boost_headers_ok}" = "xyes" ; then
128 if test "x${boost_binaries_ok}" = "xyes" ; then
133 AC_MSG_RESULT(for boost: $boost_ok)
135 AC_SUBST(BOOST_CPPFLAGS)
136 AC_SUBST(BOOST_LIBSUFFIX)