1 ##### http://autoconf-archive.cryp.to/ax_boost_iostreams.html
9 # Test for IOStreams library from the Boost C++ libraries. The macro
10 # requires a preceding call to AX_BOOST_BASE. Further documentation
11 # is available at <http://randspringer.de/boost/index.html>.
15 # AC_SUBST(BOOST_IOSTREAMS_LIB)
19 # HAVE_BOOST_IOSTREAMS
27 # Copyright (c) 2006 Thomas Porschberg <thomas@randspringer.de>
29 # Copying and distribution of this file, with or without
30 # modification, are permitted in any medium without royalty provided
31 # the copyright notice and this notice are preserved.
33 AC_DEFUN([AX_BOOST_IOSTREAMS],
35 AC_ARG_WITH([boost-iostreams],
36 AS_HELP_STRING([--with-boost-iostreams@<:@=special-lib@:>@],
37 [use the IOStreams library from boost - it is possible to specify a certain library for the linker
38 e.g. --with-boost-iostreams=boost_iostreams-gcc-mt-d-1_33_1 ]),
40 if test "$withval" = "no"; then
42 elif test "$withval" = "yes"; then
44 ax_boost_user_iostreams_lib=""
47 ax_boost_user_iostreams_lib="$withval"
53 if test "x$want_boost" = "xyes"; then
54 AC_REQUIRE([AC_PROG_CC])
55 CPPFLAGS_SAVED="$CPPFLAGS"
56 CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
59 LDFLAGS_SAVED="$LDFLAGS"
60 LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
63 AC_CACHE_CHECK(whether the Boost::IOStreams library is available,
64 ax_cv_boost_iostreams,
66 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[@%:@include <boost/iostreams/filtering_stream.hpp>
67 @%:@include <boost/range/iterator_range.hpp>
69 [[std::string input = "Hello World!";
70 namespace io = boost::iostreams;
71 io::filtering_istream in(boost::make_iterator_range(input));
74 ax_cv_boost_iostreams=yes, ax_cv_boost_iostreams=no)
77 if test "x$ax_cv_boost_iostreams" = "xyes"; then
78 AC_DEFINE(HAVE_BOOST_IOSTREAMS,,[define if the Boost::IOStreams library is available])
80 if test "x$ax_boost_user_iostreams_lib" = "x"; then
81 for ax_lib in $BN $BN-$CC $BN-$CC-mt $BN-$CC-mt-s $BN-$CC-s \
82 lib$BN lib$BN-$CC lib$BN-$CC-mt lib$BN-$CC-mt-s lib$BN-$CC-s \
83 $BN-mgw $BN-mgw $BN-mgw-mt $BN-mgw-mt-s $BN-mgw-s ; do
84 AC_CHECK_LIB($ax_lib, main, [BOOST_IOSTREAMS_LIB="-l$ax_lib" AC_SUBST(BOOST_IOSTREAMS_LIB) link_thread="yes" break],
88 for ax_lib in $ax_boost_user_iostreams_lib $BN-$ax_boost_user_iostreams_lib; do
89 AC_CHECK_LIB($ax_lib, main,
90 [BOOST_IOSTREAMS_LIB="-l$ax_lib" AC_SUBST(BOOST_IOSTREAMS_LIB) link_iostreams="yes" break],
91 [link_iostreams="no"])
95 if test "x$link_iostreams" = "xno"; then
96 AC_MSG_ERROR(Could not link against $ax_lib !)
100 CPPFLAGS="$CPPFLAGS_SAVED"
101 LDFLAGS="$LDFLAGS_SAVED"