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