libt2n: (tomj) make result_container's has_exception and has_result a bit more robust
[libt2n] / acinclude.m4
1 dnl @synopsis AX_BOOST([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2 dnl
3 dnl Test for the Boost C++ libraries of a particular version (or newer)
4 dnl
5 dnl If no path to the installed boost library is given the macro
6 dnl searchs under /usr, /usr/local, and /opt, and evaluates the
7 dnl $BOOST_ROOT environment variable. Further documentation is
8 dnl available at <http://randspringer.de/boost/index.html>.
9 dnl
10 dnl This macro calls:
11 dnl
12 dnl   AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS)
13 dnl   AC_SUBST(BOOST_FILESYSTEM_LIB)
14 dnl   AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB)
15 dnl   AC_SUBST(BOOST_THREAD_LIB)
16 dnl   AC_SUBST(BOOST_IOSTREAMS_LIB)
17 dnl   AC_SUBST(BOOST_SERIALIZATION_LIB)
18 dnl   AC_SUBST(BOOST_WSERIALIZATION_LIB)
19 dnl   AC_SUBST(BOOST_SIGNALS_LIB)
20 dnl   AC_SUBST(BOOST_DATE_TIME_LIB)
21 dnl   AC_SUBST(BOOST_REGEX_LIB)
22 dnl   AC_SUBST(BOOST_UNIT_TEST_FRAMEWORK_LIB)
23 dnl
24 dnl And sets:
25 dnl
26 dnl   HAVE_BOOST
27 dnl   HAVE_BOOST_FILESYSTEM
28 dnl   HAVE_BOOST_PROGRAM_OPTIONS
29 dnl   HAVE_BOOST_THREAD
30 dnl   HAVE_BOOST_IOSTREAMS
31 dnl   HAVE_BOOST_SERIALIZATION
32 dnl   HAVE_BOOST_SIGNALS
33 dnl   HAVE_BOOST_DATE_TIME
34 dnl   HAVE_BOOST_REGEX
35 dnl   HAVE_BOOST_UNIT_TEST_FRAMEWORK
36 dnl
37 dnl @category InstalledPackages
38 dnl @category Cxx
39 dnl @author Thomas Porschberg <thomas@randspringer.de>
40 dnl @version 2006-06-15
41 dnl @license AllPermissive
42
43 AC_DEFUN([AX_BOOST],
44 [
45     AC_ARG_WITH([boost],,
46                 [
47                 if test "$withval" = "no"; then
48                             want_boost="no"
49                 elif test "$withval" = "yes"; then
50                     want_boost="yes"
51                     ac_boost_path=""
52                 else
53                                 want_boost="yes"
54                         ac_boost_path="$withval"
55                         fi
56                 ],
57                 [want_boost="yes"])
58
59     AC_CANONICAL_BUILD
60         if test "x$want_boost" = "xyes"; then
61         AC_REQUIRE([AC_PROG_CC])
62                 boost_lib_version_req=ifelse([$1], ,1.20.0,$1)
63                 boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
64                 boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'`
65                 boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
66                 boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
67                 if test "x$boost_lib_version_req_sub_minor" = "x" ; then
68                         boost_lib_version_req_sub_minor="0"
69         fi
70                 WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+  $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
71                 AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
72                 succeeded=no
73
74                 dnl first we check the system location for boost libraries
75                 dnl this location ist chosen if boost libraries are installed with the --layout=system option
76                 dnl or if you install boost with RPM
77                 if test "$ac_boost_path" != ""; then
78                         BOOST_LDFLAGS="-L$ac_boost_path/lib"
79                         BOOST_CPPFLAGS="-I$ac_boost_path/include"
80                 else
81                         for ac_boost_path_tmp in /usr /usr/local /opt ; do
82                                 if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
83                                         BOOST_LDFLAGS="-L$ac_boost_path_tmp/lib"
84                                         BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
85                                         break;
86                                 fi
87                         done
88                 fi
89
90                 CPPFLAGS_SAVED="$CPPFLAGS"
91                 CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
92                 export CPPFLAGS
93
94                 LDFLAGS_SAVED="$LDFLAGS"
95                 LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
96                 export LDFLAGS
97
98         AC_LANG_PUSH(C++)
99         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
100 @%:@include <boost/version.hpp>
101 ]],
102        [[
103 #if BOOST_VERSION >= $WANT_BOOST_VERSION
104 // Everything is okay
105 #else
106 #  error Boost version is too old
107 #endif
108
109                 ]])],
110         [
111          AC_MSG_RESULT(yes)
112                  succeeded=yes
113                  found_system=yes
114          ifelse([$2], , :, [$2])
115        ],
116        [
117        ])
118        AC_LANG_POP([C++])
119                 dnl if we found no boost with system layout we search for boost libraries
120                 dnl built and installed without the --layout=system option or for a staged(not installed) version
121                 if test "x$succeeded" != "xyes"; then
122                         _version=0
123                         if test "$ac_boost_path" != ""; then
124                 BOOST_LDFLAGS="-L$ac_boost_path/lib"
125                                 if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
126                                         for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
127                                                 _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
128                                                 V_CHECK=`expr $_version_tmp \> $_version`
129                                                 if test "$V_CHECK" = "1" ; then
130                                                         _version=$_version_tmp
131                                                 fi
132                                                 VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
133                                                 BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
134                                         done
135                                 fi
136                         else
137                                 for ac_boost_path in /usr /usr/local /opt ; do
138                                         if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
139                                                 for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
140                                                         _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
141                                                         V_CHECK=`expr $_version_tmp \> $_version`
142                                                         if test "$V_CHECK" = "1" ; then
143                                                                 _version=$_version_tmp
144                                                                 best_path=$ac_boost_path
145                                                         fi
146                                                 done
147                                         fi
148                                 done
149
150                                 VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
151                                 BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
152                                 BOOST_LDFLAGS="-L$best_path/lib"
153
154                         if test "x$BOOST_ROOT" != "x"; then
155                     if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/lib" && test -r "$BOOST_ROOT/stage/lib"; then
156                                                 version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
157                                                 stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
158                                                 stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
159                                                 V_CHECK=`expr $stage_version_shorten \>\= $_version`
160                                                 if test "$V_CHECK" = "1" ; then
161                                                         AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
162                                                         BOOST_CPPFLAGS="-I$BOOST_ROOT"
163                                                         BOOST_LDFLAGS="-L$BOOST_ROOT/stage/lib"
164                                                 fi
165                                         fi
166                         fi
167                         fi
168
169                         CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
170                         export CPPFLAGS
171                         LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
172                         export LDFLAGS
173
174             AC_LANG_PUSH(C++)
175             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
176 @%:@include <boost/version.hpp>
177 ]],
178        [[
179 #if BOOST_VERSION >= $WANT_BOOST_VERSION
180 // Everything is okay
181 #else
182 #  error Boost version is too old
183 #endif
184
185                 ]])],
186         [
187          AC_MSG_RESULT(yes ($_version))
188                  succeeded=yes
189          ifelse([$2], , :, [$2])
190        ],
191        [
192          AC_MSG_RESULT(no ($_version))
193          ifelse([$3], , :, [$3])
194        ])
195         AC_LANG_POP([C++])
196                 fi
197
198                 if test "$succeeded" != "yes" ; then
199                         if test "$_version" = "0" ; then
200                                 AC_MSG_ERROR([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option.  If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
201                         else
202                                 AC_MSG_ERROR('Your boost libraries seems to old (version $_version).  We need at least $boost_lib_version_shorten')
203                         fi
204                 else
205                         AC_SUBST(BOOST_CPPFLAGS)
206                         AC_SUBST(BOOST_LDFLAGS)
207                         AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
208
209                         AC_CACHE_CHECK([whether the Boost::Filesystem library is available],
210                                                    ax_cv_boost_filesystem,
211                                                 [AC_LANG_PUSH([C++])
212                          AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[@%:@include <boost/filesystem/path.hpp>]],
213                                    [[using namespace boost::filesystem;
214                                    path my_path( "foo/bar/data.txt" );
215                                    return 0;]]),
216                                                ax_cv_boost_filesystem=yes, ax_cv_boost_filesystem=no)
217                                    AC_LANG_POP([C++])
218                         ])
219                         if test "$ax_cv_boost_filesystem" = "yes"; then
220                                 AC_DEFINE(HAVE_BOOST_FILESYSTEM,,[define if the Boost::FILESYSTEM library is available])
221                                 BN=boost_filesystem
222                                 for ax_lib in $BN $BN-$CC $BN-$CC-mt $BN-$CC-mt-s $BN-$CC-s \
223                               lib$BN lib$BN-$CC lib$BN-$CC-mt lib$BN-$CC-mt-s lib$BN-$CC-s \
224                               $BN-mgw $BN-mgw $BN-mgw-mt $BN-mgw-mt-s $BN-mgw-s ; do
225                                     AC_CHECK_LIB($ax_lib, main,
226                                  [BOOST_FILESYSTEM_LIB="-l$ax_lib" AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes" break],
227                                  [link_filesystem="no"])
228                                 done
229                                 if test "x$link_filesystem" = "xno"; then
230                                         AC_MSG_NOTICE(Could not link against $ax_lib !)
231                                 fi
232                         fi
233
234                         AC_CACHE_CHECK([whether the Boost::Program_Options library is available],
235                                                    ax_cv_boost_program_options,
236                                                    [AC_LANG_PUSH([C++])
237                                        AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[@%:@include <boost/program_options.hpp>]],
238                                    [[boost::program_options::options_description generic("Generic options");
239                                    return 0;]]),
240                            ax_cv_boost_program_options=yes, ax_cv_boost_program_options=no)
241                            AC_LANG_POP([C++])
242                         ])
243                         if test "$ax_cv_boost_program_options" = yes; then
244                                 AC_DEFINE(HAVE_BOOST_PROGRAM_OPTIONS,,[define if the Boost::PROGRAM_OPTIONS library is available])
245                                 BN=boost_program_options
246                                 for ax_lib in $BN $BN-$CC $BN-$CC-mt $BN-$CC-mt-s $BN-$CC-s \
247                               lib$BN lib$BN-$CC lib$BN-$CC-mt lib$BN-$CC-mt-s lib$BN-$CC-s \
248                               $BN-mgw $BN-mgw $BN-mgw-mt $BN-mgw-mt-s $BN-mgw-s ; do
249                                     AC_CHECK_LIB($ax_lib, main,
250                                  [BOOST_PROGRAM_OPTIONS_LIB="-l$ax_lib" AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) link_program_options="yes" break],
251                                  [link_program_options="no"])
252                                 done
253                                 if test "x$link_program_options="no"" = "xno"; then
254                                         AC_MSG_NOTICE(Could not link against $ax_lib !)
255                                 fi
256                         fi
257
258                         AC_CACHE_CHECK(whether the Boost::Thread library is available,
259                                                    ax_cv_boost_thread,
260                                                 [AC_LANG_PUSH([C++])
261                          CXXFLAGS_SAVE=$CXXFLAGS
262
263                          if test "x$build_os" = "xsolaris" ; then
264                                  CXXFLAGS="-pthreads $CXXFLAGS"
265                          elif test "x$build_os" = "xming32" ; then
266                                  CXXFLAGS="-mthreads $CXXFLAGS"
267                          else
268                                 CXXFLAGS="-pthread $CXXFLAGS"
269                          fi
270                          AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[@%:@include <boost/thread/thread.hpp>]],
271                                    [[boost::thread_group thrds;
272                                    return 0;]]),
273                    ax_cv_boost_thread=yes, ax_cv_boost_thread=no)
274                          CXXFLAGS=$CXXFLAGS_SAVE
275              AC_LANG_POP([C++])
276                         ])
277                         if test "x$ax_cv_boost_thread" = "xyes"; then
278                if test "x$build_os" = "xsolaris" ; then
279                                   BOOST_CPPFLAGS="-pthreads $BOOST_CPPFLAGS"
280                            elif test "x$build_os" = "xming32" ; then
281                                   BOOST_CPPFLAGS="-mthreads $BOOST_CPPFLAGS"
282                            else
283                                   BOOST_CPPFLAGS="-pthread $BOOST_CPPFLAGS"
284                            fi
285
286                                 AC_SUBST(BOOST_CPPFLAGS)
287                                 AC_DEFINE(HAVE_BOOST_THREAD,,[define if the Boost::THREAD library is available])
288                                 BN=boost_thread
289                                 for ax_lib in $BN $BN-$CC $BN-$CC-mt $BN-$CC-mt-s $BN-$CC-s \
290                               lib$BN lib$BN-$CC lib$BN-$CC-mt lib$BN-$CC-mt-s lib$BN-$CC-s \
291                               $BN-mgw $BN-mgw $BN-mgw-mt $BN-mgw-mt-s $BN-mgw-s ; do
292                                     AC_CHECK_LIB($ax_lib, main, [BOOST_THREAD_LIB="-l$ax_lib" AC_SUBST(BOOST_THREAD_LIB) link_thread="yes" break],
293                                  [link_thread="no"])
294                                 done
295                                 if test "x$link_thread" = "xno"; then
296                                         AC_MSG_NOTICE(Could not link against $ax_lib !)
297                                 fi
298                         fi
299
300                         AC_CACHE_CHECK(whether the Boost::IOStreams library is available,
301                                                    ax_cv_boost_iostreams,
302                                                 [AC_LANG_PUSH([C++])
303                          AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[@%:@include <boost/iostreams/filtering_stream.hpp>
304                                                                                                  @%:@include <boost/range/iterator_range.hpp>
305                                                                                                 ]],
306                                    [[std::string  input = "Hello World!";
307                                                                          namespace io = boost::iostreams;
308                                                                          io::filtering_istream  in(boost::make_iterator_range(input));
309                                                                          return 0;
310                                    ]]),
311                    ax_cv_boost_iostreams=yes, ax_cv_boost_iostreams=no)
312                          AC_LANG_POP([C++])
313                         ])
314                         if test "x$ax_cv_boost_iostreams" = "xyes"; then
315                                 AC_DEFINE(HAVE_BOOST_IOSTREAMS,,[define if the Boost::IOStreams library is available])
316                                 BN=boost_iostreams
317                                 for ax_lib in $BN $BN-$CC $BN-$CC-mt $BN-$CC-mt-s $BN-$CC-s \
318                               lib$BN lib$BN-$CC lib$BN-$CC-mt lib$BN-$CC-mt-s lib$BN-$CC-s \
319                               $BN-mgw $BN-mgw $BN-mgw-mt $BN-mgw-mt-s $BN-mgw-s ; do
320                                     AC_CHECK_LIB($ax_lib, main, [BOOST_IOSTREAMS_LIB="-l$ax_lib" AC_SUBST(BOOST_IOSTREAMS_LIB) link_thread="yes" break],
321                                  [link_thread="no"])
322                                 done
323                                 if test "x$link_thread" = "xno"; then
324                                         AC_MSG_NOTICE(Could not link against $ax_lib !)
325                                 fi
326                         fi
327
328                         AC_CACHE_CHECK(whether the Boost::Serialization library is available,
329                                                    ax_cv_boost_serialization,
330                                                 [AC_LANG_PUSH([C++])
331                          AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[@%:@include <fstream>
332                                                                                                  @%:@include <boost/archive/text_oarchive.hpp>
333                                                  @%:@include <boost/archive/text_iarchive.hpp>
334                                                                                                 ]],
335                                    [[std::ofstream ofs("filename");
336                                                                         boost::archive::text_oarchive oa(ofs);
337                                                                          return 0;
338                                    ]]),
339                    ax_cv_boost_serialization=yes, ax_cv_boost_serialization=no)
340                          AC_LANG_POP([C++])
341                         ])
342                         if test "x$ax_cv_boost_serialization" = "xyes"; then
343                                 AC_DEFINE(HAVE_BOOST_SERIALIZATION,,[define if the Boost::Serialization library is available])
344                                 BN=boost_serialization
345                                 for ax_lib in $BN $BN-$CC $BN-$CC-mt $BN-$CC-mt-s $BN-$CC-s \
346                               lib$BN lib$BN-$CC lib$BN-$CC-mt lib$BN-$CC-mt-s lib$BN-$CC-s \
347                               $BN-mgw $BN-mgw $BN-mgw-mt $BN-mgw-mt-s $BN-mgw-s ; do
348                                     AC_CHECK_LIB($ax_lib, main,
349                                  [BOOST_SERIALIZATION_LIB="-l$ax_lib" AC_SUBST(BOOST_SERIALIZATION_LIB) link_serialization="yes" break],
350                                  [link_serialization="no"])
351                                 done
352                                 if test "x$link_serialization" = "xno"; then
353                                         AC_MSG_NOTICE(Could not link against $ax_lib !)
354                                 fi
355
356                                 BN=boost_wserialization
357                                 for ax_lib in $BN $BN-$CC $BN-$CC-mt $BN-$CC-mt-s $BN-$CC-s \
358                               lib$BN lib$BN-$CC lib$BN-$CC-mt lib$BN-$CC-mt-s lib$BN-$CC-s \
359                               $BN-mgw $BN-mgw $BN-mgw-mt $BN-mgw-mt-s $BN-mgw-s ; do
360                                     AC_CHECK_LIB($ax_lib, main,
361                                  [BOOST_WSERIALIZATION_LIB="-l$ax_lib" AC_SUBST(BOOST_WSERIALIZATION_LIB) link_wserialization="yes" break],
362                                  [link_wserialization="no"])
363                                 done
364                                 if test "x$link_wserialization" = "xno"; then
365                                         AC_MSG_NOTICE(Could not link against $ax_lib !)
366                                 fi
367                         fi
368
369                         AC_CACHE_CHECK(whether the Boost::Signals library is available,
370                                                    ax_cv_boost_signals,
371                                                 [AC_LANG_PUSH([C++])
372                          AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[@%:@include <boost/signal.hpp>
373                                                                                                 ]],
374                                    [[boost::signal<void ()> sig;
375                                      return 0;
376                                    ]]),
377                    ax_cv_boost_signals=yes, ax_cv_boost_signals=no)
378                          AC_LANG_POP([C++])
379                         ])
380                         if test "x$ax_cv_boost_signals" = "xyes"; then
381                                 AC_DEFINE(HAVE_BOOST_SIGNALS,,[define if the Boost::Signals library is available])
382                                 BN=boost_signals
383                                 for ax_lib in $BN $BN-$CC $BN-$CC-mt $BN-$CC-mt-s $BN-$CC-s \
384                               lib$BN lib$BN-$CC lib$BN-$CC-mt lib$BN-$CC-mt-s lib$BN-$CC-s \
385                               $BN-mgw $BN-mgw $BN-mgw-mt $BN-mgw-mt-s $BN-mgw-s ; do
386                                     AC_CHECK_LIB($ax_lib, main, [BOOST_SIGNALS_LIB="-l$ax_lib" AC_SUBST(BOOST_SIGNALS_LIB) link_signals="yes" break],
387                                  [link_signals="no"])
388                                 done
389                                 if test "x$link_signals" = "xno"; then
390                                         AC_MSG_NOTICE(Could not link against $ax_lib !)
391                                 fi
392                         fi
393
394                         AC_CACHE_CHECK(whether the Boost::Date_Time library is available,
395                                                    ax_cv_boost_date_time,
396                                                 [AC_LANG_PUSH([C++])
397                          AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[@%:@include <boost/date_time/gregorian/gregorian_types.hpp>
398                                                                                                 ]],
399                                    [[using namespace boost::gregorian; date d(2002,Jan,10);
400                                      return 0;
401                                    ]]),
402                    ax_cv_boost_date_time=yes, ax_cv_boost_date_time=no)
403                          AC_LANG_POP([C++])
404                         ])
405                         if test "x$ax_cv_boost_date_time" = "xyes"; then
406                                 AC_DEFINE(HAVE_BOOST_DATE_TIME,,[define if the Boost::Date_Time library is available])
407                                 BN=boost_date_time
408                                 for ax_lib in $BN $BN-$CC $BN-$CC-mt $BN-$CC-mt-s $BN-$CC-s \
409                               lib$BN lib$BN-$CC lib$BN-$CC-mt lib$BN-$CC-mt-s lib$BN-$CC-s \
410                               $BN-mgw $BN-mgw $BN-mgw-mt $BN-mgw-mt-s $BN-mgw-s ; do
411                                     AC_CHECK_LIB($ax_lib, main, [BOOST_DATE_TIME_LIB="-l$ax_lib" AC_SUBST(BOOST_DATE_TIME_LIB) link_thread="yes" break],
412                                  [link_thread="no"])
413                                 done
414                                 if test "x$link_thread"="no" = "xno"; then
415                                         AC_MSG_NOTICE(Could not link against $ax_lib !)
416                                 fi
417                         fi
418
419                         AC_CACHE_CHECK(whether the Boost::Regex library is available,
420                                                    ax_cv_boost_regex,
421                                                 [AC_LANG_PUSH([C++])
422                          AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[@%:@include <boost/regex.hpp>
423                                                                                                 ]],
424                                    [[boost::regex r(); return 0;]]),
425                    ax_cv_boost_regex=yes, ax_cv_boost_regex=no)
426                          AC_LANG_POP([C++])
427                         ])
428                         if test "x$ax_cv_boost_regex" = "xyes"; then
429                                 AC_DEFINE(HAVE_BOOST_REGEX,,[define if the Boost::Regex library is available])
430                                 BN=boost_regex
431                                 for ax_lib in $BN $BN-$CC $BN-$CC-mt $BN-$CC-mt-s $BN-$CC-s \
432                               lib$BN lib$BN-$CC lib$BN-$CC-mt lib$BN-$CC-mt-s lib$BN-$CC-s \
433                               $BN-mgw $BN-mgw $BN-mgw-mt $BN-mgw-mt-s $BN-mgw-s ; do
434                                     AC_CHECK_LIB($ax_lib, main, [BOOST_REGEX_LIB="-l$ax_lib" AC_SUBST(BOOST_REGEX_LIB) link_regex="yes" break],
435                                  [link_regex="no"])
436                                 done
437                                 if test "x$link_regex" = "xno"; then
438                                         AC_MSG_NOTICE(Could not link against $ax_lib !)
439                                 fi
440                         fi
441
442                         AC_CACHE_CHECK(whether the Boost::UnitTestFramework library is available,
443                                                    ax_cv_boost_unit_test_framework,
444                                                 [AC_LANG_PUSH([C++])
445                          AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[@%:@include <boost/test/unit_test.hpp>]],
446                                     [[using boost::unit_test::test_suite;
447                                                          test_suite* test= BOOST_TEST_SUITE( "Unit test example 1" ); return 0;]]),
448                    ax_cv_boost_unit_test_framework=yes, ax_cv_boost_unit_test_framework=no)
449                          AC_LANG_POP([C++])
450                         ])
451                         if test "x$ax_cv_boost_unit_test_framework" = "xyes"; then
452                 AC_DEFINE(HAVE_BOOST_UNIT_TEST_FRAMEWORK,,[define if the Boost::Unit_test_framework library is available])
453                         BN=boost_unit_test_framework
454                 saved_ldflags="${LDFLAGS}"
455                         for ax_lib in $BN $BN-$CC $BN-$CC-mt $BN-$CC-mt-s $BN-$CC-s \
456                           lib$BN lib$BN-$CC lib$BN-$CC-mt lib$BN-$CC-mt-s lib$BN-$CC-s \
457                           $BN-mgw $BN-mgw $BN-mgw-mt $BN-mgw-mt-s $BN-mgw-s ; do
458                 LDFLAGS="${LDFLAGS} -l$ax_lib"
459                         AC_CACHE_CHECK(the name of the Boost::UnitTestFramework library,
460                                                    ax_cv_boost_unit_test_framework_link,
461                                                 [AC_LANG_PUSH([C++])
462                    AC_LINK_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/test/unit_test.hpp>
463                                                      using boost::unit_test::test_suite;
464                                                      test_suite* init_unit_test_suite( int argc, char * argv[] ) {
465                                                      test_suite* test= BOOST_TEST_SUITE( "Unit test example 1" );
466                                                      return test;
467                                                      }
468                                                    ]],
469                                  [[ return 0;]])],
470                                  link_unit_test_framework="yes",link_unit_test_framework="no")
471                          AC_LANG_POP([C++])
472                ])
473                 LDFLAGS="${saved_ldflags}"
474                             if test "x$link_unit_test_framework" = "xyes"; then
475                     BOOST_UNIT_TEST_FRAMEWORK_LIB="-l$ax_lib"
476                     AC_SUBST(BOOST_UNIT_TEST_FRAMEWORK_LIB)
477                                         break
478                                 fi
479               done
480                             if test "x$link_unit_test_framework" = "xno"; then
481                                    AC_MSG_NOTICE(Could not link against $ax_lib !)
482                                 fi
483                         fi
484                 fi
485         CPPFLAGS="$CPPFLAGS_SAVED"
486         LDFLAGS="$LDFLAGS_SAVED"
487         fi
488 ])