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.

117 lines
4.7KB

  1. # ============================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_boost_wserialization.html
  3. # ============================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_BOOST_WSERIALIZATION
  8. #
  9. # DESCRIPTION
  10. #
  11. # Test for Serialization 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_WSERIALIZATION_LIB)
  18. #
  19. # And sets:
  20. #
  21. # HAVE_BOOST_WSERIALIZATION
  22. #
  23. # LICENSE
  24. #
  25. # Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
  26. #
  27. # Copying and distribution of this file, with or without modification, are
  28. # permitted in any medium without royalty provided the copyright notice
  29. # and this notice are preserved. This file is offered as-is, without any
  30. # warranty.
  31. #serial 21
  32. AC_DEFUN([AX_BOOST_WSERIALIZATION],
  33. [
  34. AC_ARG_WITH([boost-wserialization],
  35. AS_HELP_STRING([--with-boost-wserialization@<:@=special-lib@:>@],
  36. [use the WSerialization library from boost - it is possible to specify a certain library for the linker
  37. e.g. --with-boost-wserialization=boost_wserialization-gcc-mt-d-1_33_1 ]),
  38. [
  39. if test "$withval" = "no"; then
  40. want_boost="no"
  41. elif test "$withval" = "yes"; then
  42. want_boost="yes"
  43. ax_boost_user_wserialization_lib=""
  44. else
  45. want_boost="yes"
  46. ax_boost_user_wserialization_lib="$withval"
  47. fi
  48. ],
  49. [want_boost="yes"]
  50. )
  51. if test "x$want_boost" = "xyes"; then
  52. AC_REQUIRE([AC_PROG_CC])
  53. CPPFLAGS_SAVED="$CPPFLAGS"
  54. CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
  55. export CPPFLAGS
  56. LDFLAGS_SAVED="$LDFLAGS"
  57. LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
  58. export LDFLAGS
  59. AC_CACHE_CHECK(whether the Boost::WSerialization library is available,
  60. ax_cv_boost_wserialization,
  61. [AC_LANG_PUSH([C++])
  62. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <fstream>
  63. @%:@include <boost/archive/text_oarchive.hpp>
  64. @%:@include <boost/archive/text_iarchive.hpp>
  65. ]],
  66. [[std::ofstream ofs("filename");
  67. boost::archive::text_oarchive oa(ofs);
  68. return 0;
  69. ]])],
  70. ax_cv_boost_wserialization=yes, ax_cv_boost_wserialization=no)
  71. AC_LANG_POP([C++])
  72. ])
  73. if test "x$ax_cv_boost_wserialization" = "xyes"; then
  74. AC_DEFINE(HAVE_BOOST_WSERIALIZATION,,[define if the Boost::WSerialization library is available])
  75. BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
  76. if test "x$ax_boost_user_wserialization_lib" = "x"; then
  77. for libextension in `ls $BOOSTLIBDIR/libboost_wserialization*.so* $BOOSTLIBDIR/libboost_wserialization*.dylib* $BOOSTLIBDIR/libboost_wserialization*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_wserialization.*\)\.so.*$;\1;' -e 's;^lib\(boost_wserialization.*\)\.dylib.*$;\1;' -e 's;^lib\(boost_wserialization.*\)\.a.*$;\1;'` ; do
  78. ax_lib=${libextension}
  79. AC_CHECK_LIB($ax_lib, exit,
  80. [BOOST_WSERIALIZATION_LIB="-l$ax_lib"; AC_SUBST(BOOST_WSERIALIZATION_LIB) link_wserialization="yes"; break],
  81. [link_wserialization="no"])
  82. done
  83. if test "x$link_wserialization" != "xyes"; then
  84. for libextension in `ls $BOOSTLIBDIR/boost_wserialization*.dll* $BOOSTLIBDIR/boost_wserialization*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_wserialization.*\)\.dll.*$;\1;' -e 's;^\(boost_wserialization.*\)\.a.*$;\1;'` ; do
  85. ax_lib=${libextension}
  86. AC_CHECK_LIB($ax_lib, exit,
  87. [BOOST_WSERIALIZATION_LIB="-l$ax_lib"; AC_SUBST(BOOST_WSERIALIZATION_LIB) link_wserialization="yes"; break],
  88. [link_wserialization="no"])
  89. done
  90. fi
  91. else
  92. for ax_lib in $ax_boost_user_wserialization_lib boost_wserialization-$ax_boost_user_wserialization_lib; do
  93. AC_CHECK_LIB($ax_lib, main,
  94. [BOOST_WSERIALIZATION_LIB="-l$ax_lib"; AC_SUBST(BOOST_WSERIALIZATION_LIB) link_wserialization="yes"; break],
  95. [link_wserialization="no"])
  96. done
  97. fi
  98. if test "x$ax_lib" = "x"; then
  99. AC_MSG_ERROR(Could not find a version of the library!)
  100. fi
  101. if test "x$link_wserialization" != "xyes"; then
  102. AC_MSG_ERROR(Could not link against $ax_lib !)
  103. fi
  104. fi
  105. CPPFLAGS="$CPPFLAGS_SAVED"
  106. LDFLAGS="$LDFLAGS_SAVED"
  107. fi
  108. ])