From 638db81e09367571f01fe3d5044aa88413ed26db Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 25 Aug 2016 17:08:05 -0700 Subject: [PATCH] configure.ac: Support boost::filesystem / boost::dll. --- configure.ac | 15 +++-- m4/ax_boost_filesystem.m4 | 118 ++++++++++++++++++++++++++++++++++++++ tools/boostrap.sh | 7 +++ 3 files changed, 135 insertions(+), 5 deletions(-) create mode 100644 m4/ax_boost_filesystem.m4 diff --git a/configure.ac b/configure.ac index 8135346ac..2727ddef2 100644 --- a/configure.ac +++ b/configure.ac @@ -784,6 +784,7 @@ dnl boost support dnl BOOST_VERSION_MIN="1.56" +BOOST_BUILT_LIBS="system,filesystem" AC_MSG_CHECKING([whether you asked to use boost sources included here]) AC_ARG_WITH(included-boost, @@ -810,7 +811,7 @@ AC_HELP_STRING([--with-included-boost[[[=shared]]]], [Use the boost sources from fi boost_linkage="$withval" - bash tools/boostrap.sh $BTOOLSET system release shared single + bash tools/boostrap.sh $BTOOLSET $BOOST_BUILT_LIBS release shared single if [[ $? != 0 ]]; then AC_MSG_ERROR([Failed to build included boost.]) fi @@ -839,22 +840,24 @@ AC_HELP_STRING([--with-included-boost[[[=shared]]]], [Use the boost sources from AX_BOOST_ASIO AX_BOOST_SYSTEM + AX_BOOST_FILESYSTEM boost_linkage="shared" ]) if [[ "$boost_linkage" = "shared" ]]; then AM_COND_IF([MINGW], [ - AC_SUBST(BOOST_LIBS, ["-lboost_system-mgw53-1_61.dll"]) + AC_SUBST(BOOST_LIBS, ["-lboost_filesystem-mgw53-1_61.dll -lboost_system-mgw53-1_61.dll"]) ], [ - AC_SUBST(BOOST_LIBS, ["-lboost_system"]) + AC_SUBST(BOOST_LIBS, ["-lboost_filesystem -lboost_system"]) ]) else AM_COND_IF([MINGW], [ - AC_SUBST(BOOST_LIBS, ["$boost_libdir/libboost_system-mgw53-1_61.dll.a"]) + AC_SUBST(BOOST_LIBS, ["$boost_libdir/libboost_filesystem-mgw53-1_61.dll.a $boost_libdir/libboost_system-mgw53-1_61.dll.a"]) ], [ - AC_SUBST(BOOST_LIBS, ["-Bstatic -lboost_system"]) + AC_SUBST(BOOST_LIBS, ["-lboost_filesystem -lboost_system"]) +dnl AC_SUBST(BOOST_LIBS, ["$boost_libdir/libboost_filesystem.a"]) dnl AC_SUBST(BOOST_LIBS, ["$boost_libdir/libboost_system.a"]) ]) fi @@ -864,6 +867,8 @@ RB_DEFINE_UNQUOTED([INC_BOOST_CONTEXT_ALL_HPP], [boost/context/all.hpp>], [ boos RB_DEFINE_UNQUOTED([INC_BOOST_ASIO_SPAWN_HPP], [boost/asio/spawn.hpp>], [ boost asio spawn. ]) RB_DEFINE_UNQUOTED([INC_BOOST_LEXICAL_CAST_HPP], [boost/lexical_cast.hpp>], [ boost lexical_cast. ]) RB_DEFINE_UNQUOTED([INC_BOOST_TOKENIZER_HPP], [boost/tokenizer.hpp>], [ boost tokenizer. ]) +RB_DEFINE_UNQUOTED([INC_BOOST_FILESYSTEM_HPP], [boost/filesystem.hpp>], [ boost filesystem. ]) +RB_DEFINE_UNQUOTED([INC_BOOST_DLL_HPP], [boost/dll.hpp>], [ boost DLL. ]) diff --git a/m4/ax_boost_filesystem.m4 b/m4/ax_boost_filesystem.m4 new file mode 100644 index 000000000..f162163cd --- /dev/null +++ b/m4/ax_boost_filesystem.m4 @@ -0,0 +1,118 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_boost_filesystem.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_BOOST_FILESYSTEM +# +# DESCRIPTION +# +# Test for Filesystem library from the Boost C++ libraries. The macro +# requires a preceding call to AX_BOOST_BASE. Further documentation is +# available at . +# +# This macro calls: +# +# AC_SUBST(BOOST_FILESYSTEM_LIB) +# +# And sets: +# +# HAVE_BOOST_FILESYSTEM +# +# LICENSE +# +# Copyright (c) 2009 Thomas Porschberg +# Copyright (c) 2009 Michael Tindal +# Copyright (c) 2009 Roman Rybalko +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 26 + +AC_DEFUN([AX_BOOST_FILESYSTEM], +[ + AC_ARG_WITH([boost-filesystem], + AS_HELP_STRING([--with-boost-filesystem@<:@=special-lib@:>@], + [use the Filesystem library from boost - it is possible to specify a certain library for the linker + e.g. --with-boost-filesystem=boost_filesystem-gcc-mt ]), + [ + if test "$withval" = "no"; then + want_boost="no" + elif test "$withval" = "yes"; then + want_boost="yes" + ax_boost_user_filesystem_lib="" + else + want_boost="yes" + ax_boost_user_filesystem_lib="$withval" + fi + ], + [want_boost="yes"] + ) + + if test "x$want_boost" = "xyes"; then + AC_REQUIRE([AC_PROG_CC]) + CPPFLAGS_SAVED="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" + export CPPFLAGS + + LDFLAGS_SAVED="$LDFLAGS" + LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" + export LDFLAGS + + LIBS_SAVED=$LIBS + LIBS="$LIBS $BOOST_SYSTEM_LIB" + export LIBS + + AC_CACHE_CHECK(whether the Boost::Filesystem library is available, + ax_cv_boost_filesystem, + [AC_LANG_PUSH([C++]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], + [[using namespace boost::filesystem; + path my_path( "foo/bar/data.txt" ); + return 0;]])], + ax_cv_boost_filesystem=yes, ax_cv_boost_filesystem=no) + AC_LANG_POP([C++]) + ]) + if test "x$ax_cv_boost_filesystem" = "xyes"; then + AC_DEFINE(HAVE_BOOST_FILESYSTEM,,[define if the Boost::Filesystem library is available]) + BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` + if test "x$ax_boost_user_filesystem_lib" = "x"; then + for libextension in `ls -r $BOOSTLIBDIR/libboost_filesystem* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do + ax_lib=${libextension} + AC_CHECK_LIB($ax_lib, exit, + [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break], + [link_filesystem="no"]) + done + if test "x$link_filesystem" != "xyes"; then + for libextension in `ls -r $BOOSTLIBDIR/boost_filesystem* 2>/dev/null | sed 's,.*/,,' | sed -e 's,\..*,,'` ; do + ax_lib=${libextension} + AC_CHECK_LIB($ax_lib, exit, + [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break], + [link_filesystem="no"]) + done + fi + else + for ax_lib in $ax_boost_user_filesystem_lib boost_filesystem-$ax_boost_user_filesystem_lib; do + AC_CHECK_LIB($ax_lib, exit, + [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break], + [link_filesystem="no"]) + done + + fi + if test "x$ax_lib" = "x"; then + AC_MSG_ERROR(Could not find a version of the library!) + fi + if test "x$link_filesystem" != "xyes"; then + AC_MSG_ERROR(Could not link against $ax_lib !) + fi + fi + + CPPFLAGS="$CPPFLAGS_SAVED" + LDFLAGS="$LDFLAGS_SAVED" + LIBS="$LIBS_SAVED" + fi +]) diff --git a/tools/boostrap.sh b/tools/boostrap.sh index dee330615..df565aa6d 100755 --- a/tools/boostrap.sh +++ b/tools/boostrap.sh @@ -127,6 +127,13 @@ run git submodule update --init --recursive libs/date_time run git submodule update --init --recursive libs/smart_ptr run git submodule update --init --recursive libs/bind +run git submodule update --init --recursive libs/filesystem +run git submodule update --init --recursive libs/io + +run git submodule update --init --recursive libs/dll +run git submodule update --init --recursive libs/align +run git submodule update --init --recursive libs/winapi + run ./bootstrap.sh --prefix=$PWD --libdir=$PWD/lib --with-libraries=$BLIBS $BSFLAGS run ./b2 threading=$BTHREADING variant=$BVARIANT link=$BLINK address-model=64