source: trunk/build_support/ax_boost.m4 @ 1349

Last change on this file since 1349 was 1324, checked in by Peter, 15 years ago

Boost is now required (ticket:370). Boost 1.33 is required, which is a
pretty arbitrary number. I happen to have 1.33 installed on my
machine. If someone can test that it works with an earlier version, I
am more than happy to soften this requirement. Currently, there is no
linking to Boost. I added a file yat.am that is included in most of
our Makefile.am, to avoid parallel modifications.

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