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