]>
Commit | Line | Data |
---|---|---|
ff5c6517 JR |
1 | From ed41a33ca22f46b123df4132d376247682af07af Mon Sep 17 00:00:00 2001 |
2 | From: David Tardon <dtardon@redhat.com> | |
3 | Date: Tue, 8 Mar 2016 06:23:24 +0100 | |
4 | Subject: detect Boost.Filesystem | |
5 | ||
6 | Change-Id: I86c268f49f44bd1e208a9de781a16bf19450c64c | |
7 | ||
8 | diff --git a/config_host.mk.in b/config_host.mk.in | |
9 | index 89081ca..0a2ec0b 100644 | |
10 | --- a/config_host.mk.in | |
11 | +++ b/config_host.mk.in | |
12 | @@ -37,6 +37,7 @@ export BARCODE_EXTENSION_PACK=@BARCODE_EXTENSION_PACK@ | |
13 | export BOOST_CPPFLAGS=@BOOST_CPPFLAGS@ | |
14 | export BOOST_CXXFLAGS=@BOOST_CXXFLAGS@ | |
15 | export BOOST_DATE_TIME_LIB=@BOOST_DATE_TIME_LIB@ | |
16 | +export BOOST_FILESYSTEM_LIB=@BOOST_FILESYSTEM_LIB@ | |
17 | export BOOST_IOSTREAMS_LIB=@BOOST_IOSTREAMS_LIB@ | |
18 | export BOOST_LDFLAGS=@BOOST_LDFLAGS@ | |
19 | export BOOST_SYSTEM_LIB=@BOOST_SYSTEM_LIB@ | |
20 | diff --git a/configure.ac b/configure.ac | |
21 | index dab1919..7b5cedd 100644 | |
22 | --- a/configure.ac | |
23 | +++ b/configure.ac | |
24 | @@ -8836,6 +8836,7 @@ if test "$with_system_boost" = "yes"; then | |
25 | SYSTEM_BOOST=TRUE | |
26 | AX_BOOST_BASE(1.47) | |
27 | AX_BOOST_DATE_TIME | |
28 | + AX_BOOST_FILESYSTEM | |
29 | AX_BOOST_IOSTREAMS | |
30 | mingw_boost_date_time_dll=`echo $BOOST_DATE_TIME_LIB | sed -e 's/^-l//' -e 's/\.dll$//'` | |
31 | libo_MINGW_TRY_DLL([$mingw_boost_date_time_dll]) | |
32 | diff --git a/m4/ax_boost_filesystem.m4 b/m4/ax_boost_filesystem.m4 | |
33 | new file mode 100644 | |
34 | index 0000000..f162163 | |
35 | --- /dev/null | |
36 | +++ b/m4/ax_boost_filesystem.m4 | |
37 | @@ -0,0 +1,118 @@ | |
38 | +# =========================================================================== | |
39 | +# http://www.gnu.org/software/autoconf-archive/ax_boost_filesystem.html | |
40 | +# =========================================================================== | |
41 | +# | |
42 | +# SYNOPSIS | |
43 | +# | |
44 | +# AX_BOOST_FILESYSTEM | |
45 | +# | |
46 | +# DESCRIPTION | |
47 | +# | |
48 | +# Test for Filesystem library from the Boost C++ libraries. The macro | |
49 | +# requires a preceding call to AX_BOOST_BASE. Further documentation is | |
50 | +# available at <http://randspringer.de/boost/index.html>. | |
51 | +# | |
52 | +# This macro calls: | |
53 | +# | |
54 | +# AC_SUBST(BOOST_FILESYSTEM_LIB) | |
55 | +# | |
56 | +# And sets: | |
57 | +# | |
58 | +# HAVE_BOOST_FILESYSTEM | |
59 | +# | |
60 | +# LICENSE | |
61 | +# | |
62 | +# Copyright (c) 2009 Thomas Porschberg <thomas@randspringer.de> | |
63 | +# Copyright (c) 2009 Michael Tindal | |
64 | +# Copyright (c) 2009 Roman Rybalko <libtorrent@romanr.info> | |
65 | +# | |
66 | +# Copying and distribution of this file, with or without modification, are | |
67 | +# permitted in any medium without royalty provided the copyright notice | |
68 | +# and this notice are preserved. This file is offered as-is, without any | |
69 | +# warranty. | |
70 | + | |
71 | +#serial 26 | |
72 | + | |
73 | +AC_DEFUN([AX_BOOST_FILESYSTEM], | |
74 | +[ | |
75 | + AC_ARG_WITH([boost-filesystem], | |
76 | + AS_HELP_STRING([--with-boost-filesystem@<:@=special-lib@:>@], | |
77 | + [use the Filesystem library from boost - it is possible to specify a certain library for the linker | |
78 | + e.g. --with-boost-filesystem=boost_filesystem-gcc-mt ]), | |
79 | + [ | |
80 | + if test "$withval" = "no"; then | |
81 | + want_boost="no" | |
82 | + elif test "$withval" = "yes"; then | |
83 | + want_boost="yes" | |
84 | + ax_boost_user_filesystem_lib="" | |
85 | + else | |
86 | + want_boost="yes" | |
87 | + ax_boost_user_filesystem_lib="$withval" | |
88 | + fi | |
89 | + ], | |
90 | + [want_boost="yes"] | |
91 | + ) | |
92 | + | |
93 | + if test "x$want_boost" = "xyes"; then | |
94 | + AC_REQUIRE([AC_PROG_CC]) | |
95 | + CPPFLAGS_SAVED="$CPPFLAGS" | |
96 | + CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" | |
97 | + export CPPFLAGS | |
98 | + | |
99 | + LDFLAGS_SAVED="$LDFLAGS" | |
100 | + LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" | |
101 | + export LDFLAGS | |
102 | + | |
103 | + LIBS_SAVED=$LIBS | |
104 | + LIBS="$LIBS $BOOST_SYSTEM_LIB" | |
105 | + export LIBS | |
106 | + | |
107 | + AC_CACHE_CHECK(whether the Boost::Filesystem library is available, | |
108 | + ax_cv_boost_filesystem, | |
109 | + [AC_LANG_PUSH([C++]) | |
110 | + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/filesystem/path.hpp>]], | |
111 | + [[using namespace boost::filesystem; | |
112 | + path my_path( "foo/bar/data.txt" ); | |
113 | + return 0;]])], | |
114 | + ax_cv_boost_filesystem=yes, ax_cv_boost_filesystem=no) | |
115 | + AC_LANG_POP([C++]) | |
116 | + ]) | |
117 | + if test "x$ax_cv_boost_filesystem" = "xyes"; then | |
118 | + AC_DEFINE(HAVE_BOOST_FILESYSTEM,,[define if the Boost::Filesystem library is available]) | |
119 | + BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` | |
120 | + if test "x$ax_boost_user_filesystem_lib" = "x"; then | |
121 | + for libextension in `ls -r $BOOSTLIBDIR/libboost_filesystem* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do | |
122 | + ax_lib=${libextension} | |
123 | + AC_CHECK_LIB($ax_lib, exit, | |
124 | + [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break], | |
125 | + [link_filesystem="no"]) | |
126 | + done | |
127 | + if test "x$link_filesystem" != "xyes"; then | |
128 | + for libextension in `ls -r $BOOSTLIBDIR/boost_filesystem* 2>/dev/null | sed 's,.*/,,' | sed -e 's,\..*,,'` ; do | |
129 | + ax_lib=${libextension} | |
130 | + AC_CHECK_LIB($ax_lib, exit, | |
131 | + [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break], | |
132 | + [link_filesystem="no"]) | |
133 | + done | |
134 | + fi | |
135 | + else | |
136 | + for ax_lib in $ax_boost_user_filesystem_lib boost_filesystem-$ax_boost_user_filesystem_lib; do | |
137 | + AC_CHECK_LIB($ax_lib, exit, | |
138 | + [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break], | |
139 | + [link_filesystem="no"]) | |
140 | + done | |
141 | + | |
142 | + fi | |
143 | + if test "x$ax_lib" = "x"; then | |
144 | + AC_MSG_ERROR(Could not find a version of the library!) | |
145 | + fi | |
146 | + if test "x$link_filesystem" != "xyes"; then | |
147 | + AC_MSG_ERROR(Could not link against $ax_lib !) | |
148 | + fi | |
149 | + fi | |
150 | + | |
151 | + CPPFLAGS="$CPPFLAGS_SAVED" | |
152 | + LDFLAGS="$LDFLAGS_SAVED" | |
153 | + LIBS="$LIBS_SAVED" | |
154 | + fi | |
155 | +]) | |
156 | -- | |
157 | cgit v0.10.2 | |
158 |