1 dnl Copyright (C) 2006-2013 CEA/DEN, EDF R&D
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.
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}"
54 if test "x${BOOSTDIR}" = "x/usr" ; then
64 AC_CHECKING(for BOOST headers)
65 CPPFLAGS="${CPPFLAGS_old} ${BOOST_CPPFLAGS}"
67 boost_include_dir_ok=yes
68 if test "x${BOOSTDIR}" != "x" ; then
69 AC_CHECK_FILE(${BOOSTDIR}/include/boost/shared_ptr.hpp,
70 boost_include_dir_ok=yes,
71 boost_include_dir_ok=no)
74 BOOST_PROGRAM_OPTIONS_LIB=no
75 if test "x${boost_include_dir_ok}" = "xyes" ; then
76 AC_CHECK_FILE(${BOOSTDIR}/include/boost/program_options.hpp,
77 BOOST_PROGRAM_OPTIONS_LIB=yes,
78 BOOST_PROGRAM_OPTIONS_LIB=no)
80 AC_MSG_RESULT(for boost program_options tool: $BOOST_PROGRAM_OPTIONS_LIB)
82 if test "x${boost_include_dir_ok}" = "xyes" ; then
83 AC_TRY_COMPILE([#include <boost/shared_ptr.hpp>],
84 [boost::shared_ptr<int>(new int)],
89 if test "x${boost_headers_ok}" = "xno" ; then
90 BOOST_CPPFLAGS="BOOST_CPPFLAGS_NOT_DEFINED"
92 AC_MSG_RESULT(\$BOOST_CPPFLAGS = ${BOOST_CPPFLAGS})
94 AC_MSG_RESULT(for boost headers: $boost_headers_ok)
96 if test "x${boost_headers_ok}" = "xyes" ; then
98 AC_CHECKING(for BOOST binaries)
100 if test "x${BOOSTDIR}" != "x" ; then
101 AC_CHECK_FILE(${BOOSTDIR}/lib${LIB_LOCATION_SUFFIX}/libboost_thread${BOOST_LIBSUFFIX}.so,
102 boost_lib_dir_ok=yes,
104 if test "x${boost_lib_dir_ok}" = "xno" ; then
106 AC_CHECK_FILE(${BOOSTDIR}/lib${LIB_LOCATION_SUFFIX}/libboost_thread${BOOST_LIBSUFFIX}.so,
107 boost_lib_dir_ok=yes,
111 if test "x${boost_lib_dir_ok}" = "xyes" ; then
112 LIBS="${LIBS_old} ${BOOST_LIBS} -lboost_thread${BOOST_LIBSUFFIX}"
113 AC_TRY_LINK([#include <boost/thread/thread.hpp>],
114 [struct TBody{ void operator()(){} }; boost::thread(TBody())],
115 boost_binaries_ok=yes,
116 boost_binaries_ok=no)
117 if test "x${boost_binaries_ok}" = "xno" ; then
119 LIBS="${LIBS_old} ${BOOST_LIBS} -lboost_thread${BOOST_LIBSUFFIX}"
120 AC_TRY_LINK([#include <boost/thread/thread.hpp>],
121 [struct TBody{ void operator()(){} }; boost::thread(TBody())],
122 boost_binaries_ok=yes,
123 boost_binaries_ok=no)
128 if test "x${boost_binaries_ok}" = "xno" ; then
129 BOOST_LIBS="BOOST_LIBS_NOT_FOUND"
130 BOOST_LIBSUFFIX="-not-defined"
132 AC_MSG_RESULT(\$BOOST_LIBSUFFIX = ${BOOST_LIBSUFFIX})
133 AC_MSG_RESULT(\$BOOST_LIBS = ${BOOST_LIBS})
135 AC_MSG_RESULT(for boost binaries: $boost_binaries_ok)
137 CPPFLAGS="${CPPFLAGS_old}"
140 if test "x${boost_headers_ok}" = "xyes" ; then
141 if test "x${boost_binaries_ok}" = "xyes" ; then
146 AC_MSG_RESULT(for boost: $boost_ok)
148 AC_SUBST(BOOST_CPPFLAGS)
149 AC_SUBST(BOOST_LIBSUFFIX)
151 AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB)