Salome HOME
Copyright update 2022
[modules/yacs.git] / src / wrappergen / src / HXX2SALOME_GENERIC_CLASS_NAME_SRC / adm_local / unix / config_files / check_boost.m4
1 dnl Copyright (C) 2006-2022  CEA/DEN, EDF R&D
2 dnl
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.
7 dnl
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.
12 dnl
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
16 dnl
17 dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 dnl
19
20 AC_DEFUN([CHECK_BOOST],[
21
22 AC_CHECKING(for BOOST Library)
23
24 AC_REQUIRE([ENABLE_PTHREADS])dnl
25
26 AC_LANG_SAVE
27 AC_LANG_CPLUSPLUS
28
29 BOOST_CPPFLAGS=""
30 BOOST_LIBSUFFIX="-mt"
31 BOOST_LIBS=""
32
33 AC_CHECKING(for BOOST location)
34 AC_ARG_WITH(boost,
35    [AC_HELP_STRING([--with-boost=DIR],[root directory path to BOOST library installation])],
36    [BOOSTDIR="$withval"
37     AC_MSG_RESULT("select $withval as path to BOOST library")
38    ])
39    
40 if test "x${BOOSTDIR}" = "x" ; then
41   BOOSTDIR="/usr"
42 fi
43
44 AC_MSG_RESULT(\$BOOSTDIR = ${BOOSTDIR})
45
46 CPPFLAGS_old="${CPPFLAGS}"
47 LIBS_old=$LIBS
48
49 if test "x${BOOSTDIR}" != "x" ; then
50   BOOST_CPPFLAGS="-I${BOOSTDIR}/include"
51   BOOST_LIBS="-L${BOOSTDIR}/lib${LIB_LOCATION_SUFFIX}"
52 fi
53
54 boost_ok=no
55 boost_headers_ok=no
56 boost_binaries_ok=no
57
58 dnl BOOST headers
59 AC_CHECKING(for BOOST headers)
60 CPPFLAGS="${CPPFLAGS_old} ${BOOST_CPPFLAGS}"
61
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)
67 fi
68
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)],
72                  boost_headers_ok=yes,
73                  boost_headers_ok=no)
74 fi
75
76 if test "x${boost_headers_ok}" = "xno" ; then
77   BOOST_CPPFLAGS="BOOST_CPPFLAGS_NOT_DEFINED"
78 else
79   AC_MSG_RESULT(\$BOOST_CPPFLAGS = ${BOOST_CPPFLAGS})
80 fi
81 AC_MSG_RESULT(for boost headers: $boost_headers_ok)
82
83 if test "x${boost_headers_ok}" = "xyes" ; then
84   dnl BOOST binaries
85   AC_CHECKING(for BOOST binaries)
86   boost_lib_dir_ok=yes
87   if test "x${BOOSTDIR}" != "x" ; then
88     AC_CHECK_FILE(${BOOSTDIR}/lib${LIB_LOCATION_SUFFIX}/libboost_thread${BOOST_LIBSUFFIX}.so,
89                   boost_lib_dir_ok=yes,
90                   boost_lib_dir_ok=no)
91     if test "x${boost_lib_dir_ok}" = "xno" ; then
92       BOOST_LIBSUFFIX=""
93       AC_CHECK_FILE(${BOOSTDIR}/lib${LIB_LOCATION_SUFFIX}/libboost_thread${BOOST_LIBSUFFIX}.so,
94                     boost_lib_dir_ok=yes,
95                     boost_lib_dir_ok=no)
96     fi
97   fi
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
105       BOOST_LIBSUFFIX=""
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)
111     fi
112   fi
113 fi
114
115 if test "x${boost_binaries_ok}" = "xno" ; then
116   BOOST_LIBS="BOOST_LIBS_NOT_FOUND"
117   BOOST_LIBSUFFIX="-not-defined"
118 else
119   AC_MSG_RESULT(\$BOOST_LIBSUFFIX = ${BOOST_LIBSUFFIX})
120   AC_MSG_RESULT(\$BOOST_LIBS = ${BOOST_LIBS})
121 fi
122 AC_MSG_RESULT(for boost binaries: $boost_binaries_ok)
123
124 CPPFLAGS="${CPPFLAGS_old}"
125 LIBS="${LIBS_old}"
126
127 if test "x${boost_headers_ok}" = "xyes" ; then
128   if test "x${boost_binaries_ok}" = "xyes" ; then
129     boost_ok=yes
130   fi
131 fi
132
133 AC_MSG_RESULT(for boost: $boost_ok)
134
135 AC_SUBST(BOOST_CPPFLAGS)
136 AC_SUBST(BOOST_LIBSUFFIX)
137 AC_SUBST(BOOST_LIBS)
138
139 AC_LANG_RESTORE
140
141 ])dnl
142
143