]> git.pld-linux.org Git - packages/vcmi.git/blob - ax_boost_iostreams.m4
- release 9 (by relup.sh)
[packages/vcmi.git] / ax_boost_iostreams.m4
1 # ===========================================================================
2 #    http://www.gnu.org/software/autoconf-archive/ax_boost_iostreams.html
3 # ===========================================================================
4 #
5 # SYNOPSIS
6 #
7 #   AX_BOOST_IOSTREAMS
8 #
9 # DESCRIPTION
10 #
11 #   Test for IOStreams library from the Boost C++ libraries. The macro
12 #   requires a preceding call to AX_BOOST_BASE. Further documentation is
13 #   available at <http://randspringer.de/boost/index.html>.
14 #
15 #   This macro calls:
16 #
17 #     AC_SUBST(BOOST_IOSTREAMS_LIB)
18 #
19 #   And sets:
20 #
21 #     HAVE_BOOST_IOSTREAMS
22 #
23 # LICENSE
24 #
25 #   Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
26 #
27 #   Copying and distribution of this file, with or without modification, are
28 #   permitted in any medium without royalty provided the copyright notice
29 #   and this notice are preserved. This file is offered as-is, without any
30 #   warranty.
31
32 #serial 20
33
34 AC_DEFUN([AX_BOOST_IOSTREAMS],
35 [
36         AC_ARG_WITH([boost-iostreams],
37         AS_HELP_STRING([--with-boost-iostreams@<:@=special-lib@:>@],
38                    [use the IOStreams library from boost - it is possible to specify a certain library for the linker
39                         e.g. --with-boost-iostreams=boost_iostreams-gcc-mt-d-1_33_1 ]),
40         [
41         if test "$withval" = "no"; then
42                         want_boost="no"
43         elif test "$withval" = "yes"; then
44             want_boost="yes"
45             ax_boost_user_iostreams_lib=""
46         else
47                     want_boost="yes"
48                 ax_boost_user_iostreams_lib="$withval"
49                 fi
50         ],
51         [want_boost="yes"]
52         )
53
54         if test "x$want_boost" = "xyes"; then
55         AC_REQUIRE([AC_PROG_CC])
56                 CPPFLAGS_SAVED="$CPPFLAGS"
57                 CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
58                 export CPPFLAGS
59
60                 LDFLAGS_SAVED="$LDFLAGS"
61                 LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
62                 export LDFLAGS
63
64         AC_CACHE_CHECK(whether the Boost::IOStreams library is available,
65                                            ax_cv_boost_iostreams,
66         [AC_LANG_PUSH([C++])
67                  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/iostreams/filtering_stream.hpp>
68                                                                                          @%:@include <boost/range/iterator_range.hpp>
69                                                                                         ]],
70                                   [[std::string  input = "Hello World!";
71                                                                  namespace io = boost::iostreams;
72                                                                          io::filtering_istream  in(boost::make_iterator_range(input));
73                                                                          return 0;
74                                    ]])],
75                              ax_cv_boost_iostreams=yes, ax_cv_boost_iostreams=no)
76          AC_LANG_POP([C++])
77                 ])
78                 if test "x$ax_cv_boost_iostreams" = "xyes"; then
79                         AC_DEFINE(HAVE_BOOST_IOSTREAMS,,[define if the Boost::IOStreams library is available])
80             BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
81             if test "x$ax_boost_user_iostreams_lib" = "x"; then
82                 for libextension in `ls $BOOSTLIBDIR/libboost_iostreams*.so* $BOOSTLIBDIR/libboost_iostream*.dylib* $BOOSTLIBDIR/libboost_iostreams*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_iostreams.*\)\.so.*$;\1;' -e 's;^lib\(boost_iostream.*\)\.dylib.*$;\1;' -e 's;^lib\(boost_iostreams.*\)\.a.*$;\1;'` ; do
83                      ax_lib=${libextension}
84                                     AC_CHECK_LIB($ax_lib, exit,
85                                  [BOOST_IOSTREAMS_LIB="-l$ax_lib"; AC_SUBST(BOOST_IOSTREAMS_LIB) link_iostreams="yes"; break],
86                                  [link_iostreams="no"])
87                                 done
88                 if test "x$link_iostreams" != "xyes"; then
89                 for libextension in `ls $BOOSTLIBDIR/boost_iostreams*.dll* $BOOSTLIBDIR/boost_iostreams*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_iostreams.*\)\.dll.*$;\1;' -e 's;^\(boost_iostreams.*\)\.a.*$;\1;'` ; do
90                      ax_lib=${libextension}
91                                     AC_CHECK_LIB($ax_lib, exit,
92                                  [BOOST_IOSTREAMS_LIB="-l$ax_lib"; AC_SUBST(BOOST_IOSTREAMS_LIB) link_iostreams="yes"; break],
93                                  [link_iostreams="no"])
94                                 done
95                 fi
96
97             else
98                for ax_lib in $ax_boost_user_iostreams_lib boost_iostreams-$ax_boost_user_iostreams_lib; do
99                                       AC_CHECK_LIB($ax_lib, main,
100                                    [BOOST_IOSTREAMS_LIB="-l$ax_lib"; AC_SUBST(BOOST_IOSTREAMS_LIB) link_iostreams="yes"; break],
101                                    [link_iostreams="no"])
102                   done
103
104             fi
105             if test "x$ax_lib" = "x"; then
106                 AC_MSG_ERROR(Could not find a version of the library!)
107             fi
108                         if test "x$link_iostreams" != "xyes"; then
109                                 AC_MSG_ERROR(Could not link against $ax_lib !)
110                         fi
111                 fi
112
113                 CPPFLAGS="$CPPFLAGS_SAVED"
114         LDFLAGS="$LDFLAGS_SAVED"
115         fi
116 ])
This page took 0.052171 seconds and 3 git commands to generate.