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.

118 lines
4.7KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_boost_serialization.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_BOOST_SERIALIZATION
  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_SERIALIZATION_LIB)
  18. #
  19. # And sets:
  20. #
  21. # HAVE_BOOST_SERIALIZATION
  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 22
  32. AC_DEFUN([AX_BOOST_SERIALIZATION],
  33. [
  34. AC_ARG_WITH([boost-serialization],
  35. AS_HELP_STRING([--with-boost-serialization@<:@=special-lib@:>@],
  36. [use the Serialization library from boost - it is possible to specify a certain library for the linker
  37. e.g. --with-boost-serialization=boost_serialization-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_serialization_lib=""
  44. else
  45. want_boost="yes"
  46. ax_boost_user_serialization_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. AC_MSG_WARN(BOOST_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::Serialization library is available,
  61. ax_cv_boost_serialization,
  62. [AC_LANG_PUSH([C++])
  63. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <fstream>
  64. @%:@include <boost/archive/text_oarchive.hpp>
  65. @%:@include <boost/archive/text_iarchive.hpp>
  66. ]],
  67. [[std::ofstream ofs("filename");
  68. boost::archive::text_oarchive oa(ofs);
  69. return 0;
  70. ]])],
  71. ax_cv_boost_serialization=yes, ax_cv_boost_serialization=no)
  72. AC_LANG_POP([C++])
  73. ])
  74. if test "x$ax_cv_boost_serialization" = "xyes"; then
  75. AC_DEFINE(HAVE_BOOST_SERIALIZATION,,[define if the Boost::Serialization library is available])
  76. BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
  77. if test "x$ax_boost_user_serialization_lib" = "x"; then
  78. for libextension in `ls $BOOSTLIBDIR/libboost_serialization*.so* $BOOSTLIBDIR/libboost_serialization*.dylib* $BOOSTLIBDIR/libboost_serialization*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_serialization.*\)\.so.*$;\1;' -e 's;^lib\(boost_serialization.*\)\.dylib.*$;\1;' -e 's;^lib\(boost_serialization.*\)\.a*$;\1;'` ; do
  79. ax_lib=${libextension}
  80. AC_CHECK_LIB($ax_lib, exit,
  81. [BOOST_SERIALIZATION_LIB="-l$ax_lib"; AC_SUBST(BOOST_SERIALIZATION_LIB) link_serialization="yes"; break],
  82. [link_serialization="no"])
  83. done
  84. if test "x$link_serialization" != "xyes"; then
  85. for libextension in `ls $BOOSTLIBDIR/boost_serialization*.dll* $BOOSTLIBDIR/boost_serialization*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_serialization.*\)\.dll.*$;\1;' -e 's;^\(boost_serialization.*\)\.a.*$;\1;'` ; do
  86. ax_lib=${libextension}
  87. AC_CHECK_LIB($ax_lib, exit,
  88. [BOOST_SERIALIZATION_LIB="-l$ax_lib"; AC_SUBST(BOOST_SERIALIZATION_LIB) link_serialization="yes"; break],
  89. [link_serialization="no"])
  90. done
  91. fi
  92. else
  93. for ax_lib in $ax_boost_user_serialization_lib boost_serialization-$ax_boost_user_serialization_lib; do
  94. AC_CHECK_LIB($ax_lib, main,
  95. [BOOST_SERIALIZATION_LIB="-l$ax_lib"; AC_SUBST(BOOST_SERIALIZATION_LIB) link_serialization="yes"; break],
  96. [link_serialization="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_serialization" != "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. fi
  109. ])