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.

111 lines
3.8KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_boost_asio.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_BOOST_ASIO
  8. #
  9. # DESCRIPTION
  10. #
  11. # Test for Asio library from the Boost C++ libraries. The macro requires a
  12. # 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_ASIO_LIB)
  18. #
  19. # And sets:
  20. #
  21. # HAVE_BOOST_ASIO
  22. #
  23. # LICENSE
  24. #
  25. # Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
  26. # Copyright (c) 2008 Pete Greenwell <pete@mu.org>
  27. #
  28. # Copying and distribution of this file, with or without modification, are
  29. # permitted in any medium without royalty provided the copyright notice
  30. # and this notice are preserved. This file is offered as-is, without any
  31. # warranty.
  32. #serial 17
  33. AC_DEFUN([AX_BOOST_ASIO],
  34. [
  35. AC_ARG_WITH([boost-asio],
  36. AS_HELP_STRING([--with-boost-asio@<:@=special-lib@:>@],
  37. [use the ASIO library from boost - it is possible to specify a certain library for the linker
  38. e.g. --with-boost-asio=boost_system-gcc41-mt-1_34 ]),
  39. [
  40. if test "$withval" = "no"; then
  41. want_boost="no"
  42. elif test "$withval" = "yes"; then
  43. want_boost="yes"
  44. ax_boost_user_asio_lib=""
  45. else
  46. want_boost="yes"
  47. ax_boost_user_asio_lib="$withval"
  48. fi
  49. ],
  50. [want_boost="yes"]
  51. )
  52. if test "x$want_boost" = "xyes"; then
  53. AC_REQUIRE([AC_PROG_CC])
  54. CPPFLAGS_SAVED="$CPPFLAGS"
  55. CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
  56. export CPPFLAGS
  57. LDFLAGS_SAVED="$LDFLAGS"
  58. LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
  59. export LDFLAGS
  60. AC_CACHE_CHECK(whether the Boost::ASIO library is available,
  61. ax_cv_boost_asio,
  62. [AC_LANG_PUSH([C++])
  63. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ @%:@include <boost/asio.hpp>
  64. ]],
  65. [[
  66. boost::asio::io_service io;
  67. boost::system::error_code timer_result;
  68. boost::asio::deadline_timer t(io);
  69. t.cancel();
  70. io.run_one();
  71. return 0;
  72. ]])],
  73. ax_cv_boost_asio=yes, ax_cv_boost_asio=no)
  74. AC_LANG_POP([C++])
  75. ])
  76. if test "x$ax_cv_boost_asio" = "xyes"; then
  77. AC_DEFINE(HAVE_BOOST_ASIO,,[define if the Boost::ASIO library is available])
  78. BN=boost_system
  79. BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
  80. if test "x$ax_boost_user_asio_lib" = "x"; then
  81. for ax_lib in `ls $BOOSTLIBDIR/libboost_system*.so* $BOOSTLIBDIR/libboost_system*.dylib* $BOOSTLIBDIR/libboost_system*.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
  82. AC_CHECK_LIB($ax_lib, main, [BOOST_ASIO_LIB="-l$ax_lib" AC_SUBST(BOOST_ASIO_LIB) link_thread="yes" break],
  83. [link_thread="no"])
  84. done
  85. else
  86. for ax_lib in $ax_boost_user_asio_lib $BN-$ax_boost_user_asio_lib; do
  87. AC_CHECK_LIB($ax_lib, main,
  88. [BOOST_ASIO_LIB="-l$ax_lib" AC_SUBST(BOOST_ASIO_LIB) link_asio="yes" break],
  89. [link_asio="no"])
  90. done
  91. fi
  92. if test "x$ax_lib" = "x"; then
  93. AC_MSG_ERROR(Could not find a version of the library!)
  94. fi
  95. if test "x$link_asio" = "xno"; then
  96. AC_MSG_ERROR(Could not link against $ax_lib !)
  97. fi
  98. fi
  99. CPPFLAGS="$CPPFLAGS_SAVED"
  100. LDFLAGS="$LDFLAGS_SAVED"
  101. fi
  102. ])