Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 121 lines (109 sloc) 4.376 kb
eb8377e @mbunkus Added checks for boost::system.
authored
1 # ===========================================================================
19a62aa @KonaBlend darwin11: support minimal boost tree
KonaBlend authored
2 # http://www.gnu.org/software/autoconf-archive/ax_boost_system.html
eb8377e @mbunkus Added checks for boost::system.
authored
3 # ===========================================================================
4 #
5 # SYNOPSIS
6 #
7 # AX_BOOST_SYSTEM
8 #
9 # DESCRIPTION
10 #
11 # Test for System library from the Boost C++ libraries. The macro requires
12 # a preceding call to AX_BOOST_BASE. Further documentation is available at
13 # <http://randspringer.de/boost/index.html>.
14 #
15 # This macro calls:
16 #
17 # AC_SUBST(BOOST_SYSTEM_LIB)
18 #
19 # And sets:
20 #
21 # HAVE_BOOST_SYSTEM
22 #
23 # LICENSE
24 #
25 # Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
26 # Copyright (c) 2008 Michael Tindal
27 # Copyright (c) 2008 Daniel Casimiro <dan.casimiro@gmail.com>
28 #
29 # Copying and distribution of this file, with or without modification, are
30 # permitted in any medium without royalty provided the copyright notice
19a62aa @KonaBlend darwin11: support minimal boost tree
KonaBlend authored
31 # and this notice are preserved. This file is offered as-is, without any
32 # warranty.
33
34 #serial 14
eb8377e @mbunkus Added checks for boost::system.
authored
35
36 AC_DEFUN([AX_BOOST_SYSTEM],
37 [
19a62aa @KonaBlend darwin11: support minimal boost tree
KonaBlend authored
38 AC_ARG_WITH([boost-system],
39 AS_HELP_STRING([--with-boost-system@<:@=special-lib@:>@],
40 [use the System library from boost - it is possible to specify a certain library for the linker
41 e.g. --with-boost-system=boost_system-gcc-mt ]),
42 [
43 if test "$withval" = "no"; then
44 want_boost="no"
45 elif test "$withval" = "yes"; then
46 want_boost="yes"
47 ax_boost_user_system_lib=""
48 else
49 want_boost="yes"
50 ax_boost_user_system_lib="$withval"
51 fi
52 ],
53 [want_boost="yes"]
54 )
eb8377e @mbunkus Added checks for boost::system.
authored
55
19a62aa @KonaBlend darwin11: support minimal boost tree
KonaBlend authored
56 if test "x$want_boost" = "xyes"; then
57 AC_REQUIRE([AC_PROG_CC])
58 AC_REQUIRE([AC_CANONICAL_BUILD])
59 CPPFLAGS_SAVED="$CPPFLAGS"
60 CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
61 export CPPFLAGS
eb8377e @mbunkus Added checks for boost::system.
authored
62
19a62aa @KonaBlend darwin11: support minimal boost tree
KonaBlend authored
63 LDFLAGS_SAVED="$LDFLAGS"
64 LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
65 export LDFLAGS
eb8377e @mbunkus Added checks for boost::system.
authored
66
19a62aa @KonaBlend darwin11: support minimal boost tree
KonaBlend authored
67 AC_CACHE_CHECK(whether the Boost::System library is available,
68 ax_cv_boost_system,
69 [AC_LANG_PUSH([C++])
70 CXXFLAGS_SAVE=$CXXFLAGS
eb8377e @mbunkus Added checks for boost::system.
authored
71
19a62aa @KonaBlend darwin11: support minimal boost tree
KonaBlend authored
72 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/system/error_code.hpp>]],
73 [[boost::system::system_category]])],
74 ax_cv_boost_system=yes, ax_cv_boost_system=no)
75 CXXFLAGS=$CXXFLAGS_SAVE
76 AC_LANG_POP([C++])
77 ])
78 if test "x$ax_cv_boost_system" = "xyes"; then
79 AC_SUBST(BOOST_CPPFLAGS)
eb8377e @mbunkus Added checks for boost::system.
authored
80
19a62aa @KonaBlend darwin11: support minimal boost tree
KonaBlend authored
81 AC_DEFINE(HAVE_BOOST_SYSTEM,,[define if the Boost::System library is available])
82 BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
ce11e3b @mbunkus Cosmetics/Reformatting
authored
83
19a62aa @KonaBlend darwin11: support minimal boost tree
KonaBlend authored
84 LDFLAGS_SAVE=$LDFLAGS
85 if test "x$ax_boost_user_system_lib" = "x"; then
86 for libextension in `ls $BOOSTLIBDIR/libboost_system*.{so,dylib,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's,^lib\(boost_system.*\)\.so.*$,\1,' -e 's,^lib\(boost_system.*\)\.dylib.*$,\1,' -e 's,^lib\(boost_system.*\)\.a.*$,\1,'`; do
87 ax_lib=${libextension}
88 AC_CHECK_LIB($ax_lib, exit,
89 [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
90 [link_system="no"])
91 done
92 if test "x$link_system" != "xyes"; then
93 for libextension in `ls $BOOSTLIBDIR/boost_system*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_system.*\)\.dll.*$;\1;' -e 's;^\(boost_system.*\)\.a*$;\1;'` ; do
94 ax_lib=${libextension}
95 AC_CHECK_LIB($ax_lib, exit,
96 [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
97 [link_system="no"])
98 done
99 fi
ce11e3b @mbunkus Cosmetics/Reformatting
authored
100
19a62aa @KonaBlend darwin11: support minimal boost tree
KonaBlend authored
101 else
102 for ax_lib in $ax_boost_user_system_lib boost_system-$ax_boost_user_system_lib; do
103 AC_CHECK_LIB($ax_lib, exit,
104 [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
105 [link_system="no"])
106 done
eb8377e @mbunkus Added checks for boost::system.
authored
107
19a62aa @KonaBlend darwin11: support minimal boost tree
KonaBlend authored
108 fi
109 if test "x$ax_lib" = "x"; then
110 AC_MSG_ERROR(Could not find a version of the library!)
111 fi
112 if test "x$link_system" = "xno"; then
113 AC_MSG_ERROR(Could not link against $ax_lib !)
114 fi
115 fi
eb8377e @mbunkus Added checks for boost::system.
authored
116
19a62aa @KonaBlend darwin11: support minimal boost tree
KonaBlend authored
117 CPPFLAGS="$CPPFLAGS_SAVED"
118 LDFLAGS="$LDFLAGS_SAVED"
119 fi
eb8377e @mbunkus Added checks for boost::system.
authored
120 ])
Something went wrong with that request. Please try again.