Salome HOME
0298be6ee3d09a9ffc5cfead4d902c52a9ae3804
[modules/yacs.git] / src / wrappergen / src / HXX2SALOME_GENERIC_CLASS_NAME_SRC / adm_local / unix / config_files / check_boost.m4
1 dnl  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 dnl  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
3 dnl 
4 dnl  This library is free software; you can redistribute it and/or 
5 dnl  modify it under the terms of the GNU Lesser General Public 
6 dnl  License as published by the Free Software Foundation; either 
7 dnl  version 2.1 of the License. 
8 dnl 
9 dnl  This library is distributed in the hope that it will be useful, 
10 dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 dnl  Lesser General Public License for more details. 
13 dnl 
14 dnl  You should have received a copy of the GNU Lesser General Public 
15 dnl  License along with this library; if not, write to the Free Software 
16 dnl  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
17 dnl 
18 dnl  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
19 dnl
20 dnl
21 dnl
22 AC_DEFUN([CHECK_BOOST],[
23
24 AC_CHECKING(for BOOST Library)
25
26 AC_REQUIRE([ENABLE_PTHREADS])dnl
27
28 AC_LANG_SAVE
29 AC_LANG_CPLUSPLUS
30
31 BOOST_CPPFLAGS=""
32 BOOST_LIBSUFFIX="-mt"
33 BOOST_LIBS=""
34
35 AC_CHECKING(for BOOST location)
36 AC_ARG_WITH(boost,
37    [AC_HELP_STRING([--with-boost=DIR],[root directory path to BOOST library installation])],
38    [BOOSTDIR="$withval"
39     AC_MSG_RESULT("select $withval as path to BOOST library")
40    ])
41    
42 if test "x${BOOSTDIR}" = "x" ; then
43   BOOSTDIR="/usr"
44 fi
45
46 AC_MSG_RESULT(\$BOOSTDIR = ${BOOSTDIR})
47
48 CPPFLAGS_old="${CPPFLAGS}"
49 LIBS_old=$LIBS
50
51 if test "x${BOOSTDIR}" != "x" ; then
52   BOOST_CPPFLAGS="-I${BOOSTDIR}/include"
53   BOOST_LIBS="-L${BOOSTDIR}/lib${LIB_LOCATION_SUFFIX}"
54 fi
55
56 boost_ok=no
57 boost_headers_ok=no
58 boost_binaries_ok=no
59
60 dnl BOOST headers
61 AC_CHECKING(for BOOST headers)
62 CPPFLAGS="${CPPFLAGS_old} ${BOOST_CPPFLAGS}"
63
64 boost_include_dir_ok=yes
65 if test "x${BOOSTDIR}" != "x" ; then
66   AC_CHECK_FILE(${BOOSTDIR}/include/boost/shared_ptr.hpp,
67                 boost_include_dir_ok=yes,
68                 boost_include_dir_ok=no)
69 fi
70
71 if test "x${boost_include_dir_ok}" = "xyes" ; then
72   AC_TRY_COMPILE([#include <boost/shared_ptr.hpp>],
73                  [boost::shared_ptr<int>(new int)],
74                  boost_headers_ok=yes,
75                  boost_headers_ok=no)
76 fi
77
78 if test "x${boost_headers_ok}" = "xno" ; then
79   BOOST_CPPFLAGS="BOOST_CPPFLAGS_NOT_DEFINED"
80 else
81   AC_MSG_RESULT(\$BOOST_CPPFLAGS = ${BOOST_CPPFLAGS})
82 fi
83 AC_MSG_RESULT(for boost headers: $boost_headers_ok)
84
85 if test "x${boost_headers_ok}" = "xyes" ; then
86   dnl BOOST binaries
87   AC_CHECKING(for BOOST binaries)
88   boost_lib_dir_ok=yes
89   if test "x${BOOSTDIR}" != "x" ; then
90     AC_CHECK_FILE(${BOOSTDIR}/lib${LIB_LOCATION_SUFFIX}/libboost_thread${BOOST_LIBSUFFIX}.so,
91                   boost_lib_dir_ok=yes,
92                   boost_lib_dir_ok=no)
93     if test "x${boost_lib_dir_ok}" = "xno" ; then
94       BOOST_LIBSUFFIX=""
95       AC_CHECK_FILE(${BOOSTDIR}/lib${LIB_LOCATION_SUFFIX}/libboost_thread${BOOST_LIBSUFFIX}.so,
96                     boost_lib_dir_ok=yes,
97                     boost_lib_dir_ok=no)
98     fi
99   fi
100   if test "x${boost_lib_dir_ok}" = "xyes" ; then
101     LIBS="${LIBS_old} ${BOOST_LIBS} -lboost_thread${BOOST_LIBSUFFIX}"
102     AC_TRY_LINK([#include <boost/thread/thread.hpp>],
103                 [struct TBody{ void operator()(){} }; boost::thread(TBody())],
104                 boost_binaries_ok=yes,
105                 boost_binaries_ok=no)
106     if test "x${boost_binaries_ok}" = "xno" ; then
107       BOOST_LIBSUFFIX=""
108       LIBS="${LIBS_old} ${BOOST_LIBS} -lboost_thread${BOOST_LIBSUFFIX}"
109       AC_TRY_LINK([#include <boost/thread/thread.hpp>],
110                   [struct TBody{ void operator()(){} }; boost::thread(TBody())],
111                   boost_binaries_ok=yes,
112                   boost_binaries_ok=no)
113     fi
114   fi
115 fi
116
117 if test "x${boost_binaries_ok}" = "xno" ; then
118   BOOST_LIBS="BOOST_LIBS_NOT_FOUND"
119   BOOST_LIBSUFFIX="-not-defined"
120 else
121   AC_MSG_RESULT(\$BOOST_LIBSUFFIX = ${BOOST_LIBSUFFIX})
122   AC_MSG_RESULT(\$BOOST_LIBS = ${BOOST_LIBS})
123 fi
124 AC_MSG_RESULT(for boost binaries: $boost_binaries_ok)
125
126 CPPFLAGS="${CPPFLAGS_old}"
127 LIBS="${LIBS_old}"
128
129 if test "x${boost_headers_ok}" = "xyes" ; then
130   if test "x${boost_binaries_ok}" = "xyes" ; then
131     boost_ok=yes
132   fi
133 fi
134
135 AC_MSG_RESULT(for boost: $boost_ok)
136
137 AC_SUBST(BOOST_CPPFLAGS)
138 AC_SUBST(BOOST_LIBSUFFIX)
139 AC_SUBST(BOOST_LIBS)
140
141 AC_LANG_RESTORE
142
143 ])dnl
144
145