root/trunk/config/ax_boost_serialization.m4

Revision 556, 3.3 kB (checked in by andreas, 15 months ago)

- boost serialization support
- improved some boost detection stuff

Line 
1dnl @synopsis AX_BOOST_SERIALIZATION
2dnl
3dnl Test for Serialization library from the Boost C++ libraries. The
4dnl macro requires a preceding call to AX_BOOST_BASE. Further
5dnl documentation is available at
6dnl <http://randspringer.de/boost/index.html>.
7dnl
8dnl This macro calls:
9dnl
10dnl   AC_SUBST(BOOST_SERIALIZATION_LIB)
11dnl
12dnl And sets:
13dnl
14dnl   HAVE_BOOST_SERIALIZATION
15dnl
16dnl @category InstalledPackages
17dnl @category Cxx
18dnl @author Thomas Porschberg <thomas@randspringer.de>
19dnl @version 2006-06-15
20dnl @license AllPermissive
21
22AC_DEFUN([AX_BOOST_SERIALIZATION],
23[
24        AC_ARG_WITH([boost-serialization],
25        AS_HELP_STRING([--with-boost-serialization@<:@=special-lib@:>@],
26                   [use the Serialization library from boost - it is possible to specify a certain library for the linker
27                        e.g. --with-boost-serialization=boost_serialization-gcc-mt-d-1_33_1 ]),
28        [
29        if test "$withval" = "no"; then
30                        want_boost="no"
31        elif test "$withval" = "yes"; then
32            want_boost="yes"
33            ax_boost_user_serialization_lib=""
34        else
35                    want_boost="yes"
36                ax_boost_user_serialization_lib="$withval"
37                fi
38        ],
39        [want_boost="yes"]
40        )
41
42        if test "x$want_boost" = "xyes"; then
43        AC_REQUIRE([AC_PROG_CC])
44                CPPFLAGS_SAVED="$CPPFLAGS"
45                CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
46                export CPPFLAGS
47
48                LDFLAGS_SAVED="$LDFLAGS"
49                LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
50                export LDFLAGS
51
52        AC_CACHE_CHECK(whether the Boost::Serialization library is available,
53                                           ax_cv_boost_serialization,
54        [AC_LANG_PUSH([C++])
55                         AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[@%:@include <fstream>
56                                                                                                 @%:@include <boost/archive/text_oarchive.hpp>
57                                                 @%:@include <boost/archive/text_iarchive.hpp>
58                                                                                                ]],
59                                   [[std::ofstream ofs("filename");
60                                                                        boost::archive::text_oarchive oa(ofs);
61                                                                         return 0;
62                                   ]]),
63                   ax_cv_boost_serialization=yes, ax_cv_boost_serialization=no)
64         AC_LANG_POP([C++])
65                ])
66                if test "x$ax_cv_boost_serialization" = "xyes"; then
67                        AC_DEFINE(HAVE_BOOST_SERIALIZATION,,[define if the Boost::Serialization library is available])
68                        BN=boost_serialization
69            if test "x$ax_boost_user_serialization_lib" = "x"; then
70                                for ax_lib in $BN $BN-$CC $BN-$CC-mt $BN-$CC-mt-s $BN-$CC-s \
71                              lib$BN lib$BN-$CC lib$BN-$CC-mt lib$BN-$CC-mt-s lib$BN-$CC-s \
72                              $BN-mgw $BN-mgw $BN-mgw-mt $BN-mgw-mt-s $BN-mgw-s ; do
73                                    AC_CHECK_LIB($ax_lib, main,
74                                 [BOOST_SERIALIZATION_LIB="-l$ax_lib" AC_SUBST(BOOST_SERIALIZATION_LIB) link_serialization="yes" break],
75                                 [link_serialization="no"])
76                                done
77            else
78               for ax_lib in $ax_boost_user_serialization_lib $BN-$ax_boost_user_serialization_lib; do
79                                      AC_CHECK_LIB($ax_lib, main,
80                                   [BOOST_SERIALIZATION_LIB="-l$ax_lib" AC_SUBST(BOOST_SERIALIZATION_LIB) link_serialization="yes" break],
81                                   [link_serialization="no"])
82                  done
83
84            fi
85                        if test "x$link_serialization" = "xno"; then
86                                AC_MSG_ERROR(Could not link against $ax_lib !)
87                        fi
88                fi
89
90                CPPFLAGS="$CPPFLAGS_SAVED"
91        LDFLAGS="$LDFLAGS_SAVED"
92        fi
93])
Note: See TracBrowser for help on using the browser.