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
6 Change-Id: I86c268f49f44bd1e208a9de781a16bf19450c64c
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
24 @@ -8836,6 +8836,7 @@ if test "$with_system_boost" = "yes"; then
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
34 index 0000000..f162163
36 +++ b/m4/ax_boost_filesystem.m4
38 +# ===========================================================================
39 +# http://www.gnu.org/software/autoconf-archive/ax_boost_filesystem.html
40 +# ===========================================================================
44 +# AX_BOOST_FILESYSTEM
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>.
54 +# AC_SUBST(BOOST_FILESYSTEM_LIB)
58 +# HAVE_BOOST_FILESYSTEM
62 +# Copyright (c) 2009 Thomas Porschberg <thomas@randspringer.de>
63 +# Copyright (c) 2009 Michael Tindal
64 +# Copyright (c) 2009 Roman Rybalko <libtorrent@romanr.info>
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
73 +AC_DEFUN([AX_BOOST_FILESYSTEM],
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 ]),
80 + if test "$withval" = "no"; then
82 + elif test "$withval" = "yes"; then
84 + ax_boost_user_filesystem_lib=""
87 + ax_boost_user_filesystem_lib="$withval"
93 + if test "x$want_boost" = "xyes"; then
94 + AC_REQUIRE([AC_PROG_CC])
95 + CPPFLAGS_SAVED="$CPPFLAGS"
96 + CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
99 + LDFLAGS_SAVED="$LDFLAGS"
100 + LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
104 + LIBS="$LIBS $BOOST_SYSTEM_LIB"
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" );
114 + ax_cv_boost_filesystem=yes, ax_cv_boost_filesystem=no)
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"])
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"])
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"])
143 + if test "x$ax_lib" = "x"; then
144 + AC_MSG_ERROR(Could not find a version of the library!)
146 + if test "x$link_filesystem" != "xyes"; then
147 + AC_MSG_ERROR(Could not link against $ax_lib !)
151 + CPPFLAGS="$CPPFLAGS_SAVED"
152 + LDFLAGS="$LDFLAGS_SAVED"