Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

119 lines
4.3KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_boost_filesystem.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_BOOST_FILESYSTEM
  8. #
  9. # DESCRIPTION
  10. #
  11. # Test for Filesystem library from the Boost C++ libraries. The macro
  12. # requires a preceding call to AX_BOOST_BASE. Further documentation is
  13. # available at <http://randspringer.de/boost/index.html>.
  14. #
  15. # This macro calls:
  16. #
  17. # AC_SUBST(BOOST_FILESYSTEM_LIB)
  18. #
  19. # And sets:
  20. #
  21. # HAVE_BOOST_FILESYSTEM
  22. #
  23. # LICENSE
  24. #
  25. # Copyright (c) 2009 Thomas Porschberg <thomas@randspringer.de>
  26. # Copyright (c) 2009 Michael Tindal
  27. # Copyright (c) 2009 Roman Rybalko <libtorrent@romanr.info>
  28. #
  29. # Copying and distribution of this file, with or without modification, are
  30. # permitted in any medium without royalty provided the copyright notice
  31. # and this notice are preserved. This file is offered as-is, without any
  32. # warranty.
  33. #serial 27
  34. AC_DEFUN([AX_BOOST_FILESYSTEM],
  35. [
  36. AC_ARG_WITH([boost-filesystem],
  37. AS_HELP_STRING([--with-boost-filesystem@<:@=special-lib@:>@],
  38. [use the Filesystem library from boost - it is possible to specify a certain library for the linker
  39. e.g. --with-boost-filesystem=boost_filesystem-gcc-mt ]),
  40. [
  41. if test "$withval" = "no"; then
  42. want_boost="no"
  43. elif test "$withval" = "yes"; then
  44. want_boost="yes"
  45. ax_boost_user_filesystem_lib=""
  46. else
  47. want_boost="yes"
  48. ax_boost_user_filesystem_lib="$withval"
  49. fi
  50. ],
  51. [want_boost="yes"]
  52. )
  53. if test "x$want_boost" = "xyes"; then
  54. AC_REQUIRE([AC_PROG_CC])
  55. CPPFLAGS_SAVED="$CPPFLAGS"
  56. CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
  57. export CPPFLAGS
  58. LDFLAGS_SAVED="$LDFLAGS"
  59. LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
  60. export LDFLAGS
  61. LIBS_SAVED=$LIBS
  62. LIBS="$LIBS $BOOST_SYSTEM_LIB"
  63. export LIBS
  64. AC_CACHE_CHECK(whether the Boost::Filesystem library is available,
  65. ax_cv_boost_filesystem,
  66. [AC_LANG_PUSH([C++])
  67. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/filesystem/path.hpp>]],
  68. [[using namespace boost::filesystem;
  69. path my_path( "foo/bar/data.txt" );
  70. return 0;]])],
  71. ax_cv_boost_filesystem=yes, ax_cv_boost_filesystem=no)
  72. AC_LANG_POP([C++])
  73. ])
  74. if test "x$ax_cv_boost_filesystem" = "xyes"; then
  75. AC_DEFINE(HAVE_BOOST_FILESYSTEM,,[define if the Boost::Filesystem library is available])
  76. BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
  77. if test "x$ax_boost_user_filesystem_lib" = "x"; then
  78. for libextension in `ls -r $BOOSTLIBDIR/libboost_filesystem* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do
  79. ax_lib=${libextension}
  80. AC_CHECK_LIB($ax_lib, exit,
  81. [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
  82. [link_filesystem="no"])
  83. done
  84. if test "x$link_filesystem" != "xyes"; then
  85. for libextension in `ls -r $BOOSTLIBDIR/boost_filesystem* 2>/dev/null | sed 's,.*/,,' | sed -e 's,\..*,,'` ; do
  86. ax_lib=${libextension}
  87. AC_CHECK_LIB($ax_lib, exit,
  88. [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
  89. [link_filesystem="no"])
  90. done
  91. fi
  92. else
  93. for ax_lib in $ax_boost_user_filesystem_lib boost_filesystem-$ax_boost_user_filesystem_lib; do
  94. AC_CHECK_LIB($ax_lib, exit,
  95. [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
  96. [link_filesystem="no"])
  97. done
  98. fi
  99. if test "x$ax_lib" = "x"; then
  100. AC_MSG_ERROR(Could not find a version of the library!)
  101. fi
  102. if test "x$link_filesystem" != "xyes"; then
  103. AC_MSG_ERROR(Could not link against $ax_lib !)
  104. fi
  105. fi
  106. CPPFLAGS="$CPPFLAGS_SAVED"
  107. LDFLAGS="$LDFLAGS_SAVED"
  108. LIBS="$LIBS_SAVED"
  109. fi
  110. ])