1 dnl Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 dnl This library is free software; you can redistribute it and/or
7 dnl modify it under the terms of the GNU Lesser General Public
8 dnl License as published by the Free Software Foundation; either
9 dnl version 2.1 of the License.
11 dnl This library is distributed in the hope that it will be useful,
12 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 dnl Lesser General Public License for more details.
16 dnl You should have received a copy of the GNU Lesser General Public
17 dnl License along with this library; if not, write to the Free Software
18 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 AC_DEFUN([CHECK_BOOST],[
24 AC_CHECKING(for BOOST Library)
26 AC_REQUIRE([ENABLE_PTHREADS])dnl
35 AC_CHECKING(for BOOST location)
37 [AC_HELP_STRING([--with-boost=DIR],[root directory path to BOOST library installation])],
39 AC_MSG_RESULT("select $withval as path to BOOST library")
42 if test "x${BOOSTDIR}" = "x" ; then
46 AC_MSG_RESULT(\$BOOSTDIR = ${BOOSTDIR})
48 CPPFLAGS_old="${CPPFLAGS}"
51 if test "x${BOOSTDIR}" != "x" ; then
52 BOOST_CPPFLAGS="-I${BOOSTDIR}/include"
53 BOOST_LIBS="-L${BOOSTDIR}/lib${LIB_LOCATION_SUFFIX}"
56 if test "x${BOOSTDIR}" = "x/usr" ; then
66 AC_CHECKING(for BOOST headers)
67 CPPFLAGS="${CPPFLAGS_old} ${BOOST_CPPFLAGS}"
69 boost_include_dir_ok=yes
70 if test "x${BOOSTDIR}" != "x" ; then
71 AC_CHECK_FILE(${BOOSTDIR}/include/boost/shared_ptr.hpp,
72 boost_include_dir_ok=yes,
73 boost_include_dir_ok=no)
76 BOOST_PROGRAM_OPTIONS_LIB=no
77 if test "x${boost_include_dir_ok}" = "xyes" ; then
78 AC_CHECK_FILE(${BOOSTDIR}/include/boost/program_options.hpp,
79 BOOST_PROGRAM_OPTIONS_LIB=yes,
80 BOOST_PROGRAM_OPTIONS_LIB=no)
82 AC_MSG_RESULT(for boost program_options tool: $BOOST_PROGRAM_OPTIONS_LIB)
84 if test "x${boost_include_dir_ok}" = "xyes" ; then
85 AC_TRY_COMPILE([#include <boost/shared_ptr.hpp>],
86 [boost::shared_ptr<int>(new int)],
91 if test "x${boost_headers_ok}" = "xno" ; then
92 BOOST_CPPFLAGS="BOOST_CPPFLAGS_NOT_DEFINED"
94 AC_MSG_RESULT(\$BOOST_CPPFLAGS = ${BOOST_CPPFLAGS})
96 AC_MSG_RESULT(for boost headers: $boost_headers_ok)
98 if test "x${boost_headers_ok}" = "xyes" ; then
100 AC_CHECKING(for BOOST binaries)
102 if test "x${BOOSTDIR}" != "x" ; then
103 AC_CHECK_FILE(${BOOSTDIR}/lib${LIB_LOCATION_SUFFIX}/libboost_thread${BOOST_LIBSUFFIX}.so,
104 boost_lib_dir_ok=yes,
106 if test "x${boost_lib_dir_ok}" = "xno" ; then
108 AC_CHECK_FILE(${BOOSTDIR}/lib${LIB_LOCATION_SUFFIX}/libboost_thread${BOOST_LIBSUFFIX}.so,
109 boost_lib_dir_ok=yes,
113 if test "x${boost_lib_dir_ok}" = "xyes" ; then
114 LIBS="${LIBS_old} ${BOOST_LIBS} -lboost_thread${BOOST_LIBSUFFIX}"
115 AC_TRY_LINK([#include <boost/thread/thread.hpp>],
116 [struct TBody{ void operator()(){} }; boost::thread(TBody())],
117 boost_binaries_ok=yes,
118 boost_binaries_ok=no)
119 if test "x${boost_binaries_ok}" = "xno" ; then
121 LIBS="${LIBS_old} ${BOOST_LIBS} -lboost_thread${BOOST_LIBSUFFIX}"
122 AC_TRY_LINK([#include <boost/thread/thread.hpp>],
123 [struct TBody{ void operator()(){} }; boost::thread(TBody())],
124 boost_binaries_ok=yes,
125 boost_binaries_ok=no)
130 if test "x${boost_binaries_ok}" = "xno" ; then
131 BOOST_LIBS="BOOST_LIBS_NOT_FOUND"
132 BOOST_LIBSUFFIX="-not-defined"
134 AC_MSG_RESULT(\$BOOST_LIBSUFFIX = ${BOOST_LIBSUFFIX})
135 AC_MSG_RESULT(\$BOOST_LIBS = ${BOOST_LIBS})
137 AC_MSG_RESULT(for boost binaries: $boost_binaries_ok)
139 CPPFLAGS="${CPPFLAGS_old}"
142 if test "x${boost_headers_ok}" = "xyes" ; then
143 if test "x${boost_binaries_ok}" = "xyes" ; then
148 AC_MSG_RESULT(for boost: $boost_ok)
150 AC_SUBST(BOOST_CPPFLAGS)
151 AC_SUBST(BOOST_LIBSUFFIX)
153 AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB)