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.

120 lines
4.3KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_boost_locale.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_BOOST_LOCALE
  8. #
  9. # DESCRIPTION
  10. #
  11. # Test for System library from the Boost C++ libraries. The macro requires
  12. # a 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_LOCALE_LIB)
  18. #
  19. # And sets:
  20. #
  21. # HAVE_BOOST_LOCALE
  22. #
  23. # LICENSE
  24. #
  25. # Copyright (c) 2012 Xiyue Deng <manphiz@gmail.com>
  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 2
  32. AC_DEFUN([AX_BOOST_LOCALE],
  33. [
  34. AC_ARG_WITH([boost-locale],
  35. AS_HELP_STRING([--with-boost-locale@<:@=special-lib@:>@],
  36. [use the Locale library from boost - it is possible to specify a certain library for the linker
  37. e.g. --with-boost-locale=boost_locale-gcc-mt ]),
  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_locale_lib=""
  44. else
  45. want_boost="yes"
  46. ax_boost_user_locale_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. AC_REQUIRE([AC_CANONICAL_BUILD])
  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::Locale library is available,
  61. ax_cv_boost_locale,
  62. [AC_LANG_PUSH([C++])
  63. CXXFLAGS_SAVE=$CXXFLAGS
  64. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/locale.hpp>]],
  65. [[boost::locale::generator gen;
  66. std::locale::global(gen(""));]])],
  67. ax_cv_boost_locale=yes, ax_cv_boost_locale=no)
  68. CXXFLAGS=$CXXFLAGS_SAVE
  69. AC_LANG_POP([C++])
  70. ])
  71. if test "x$ax_cv_boost_locale" = "xyes"; then
  72. AC_SUBST(BOOST_CPPFLAGS)
  73. AC_DEFINE(HAVE_BOOST_LOCALE,,[define if the Boost::Locale library is available])
  74. BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
  75. LDFLAGS_SAVE=$LDFLAGS
  76. if test "x$ax_boost_user_locale_lib" = "x"; then
  77. for libextension in `ls $BOOSTLIBDIR/libboost_locale*.so* $BOOSTLIBDIR/libboost_locale*.dylib* $BOOSTLIBDIR/libboost_locale*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_locale.*\)\.so.*$;\1;' -e 's;^lib\(boost_locale.*\)\.dylib.*$;\1;' -e 's;^lib\(boost_locale.*\)\.a.*$;\1;'` ; do
  78. ax_lib=${libextension}
  79. AC_CHECK_LIB($ax_lib, exit,
  80. [BOOST_LOCALE_LIB="-l$ax_lib"; AC_SUBST(BOOST_LOCALE_LIB) link_locale="yes"; break],
  81. [link_locale="no"])
  82. done
  83. if test "x$link_locale" != "xyes"; then
  84. for libextension in `ls $BOOSTLIBDIR/boost_locale*.dll* $BOOSTLIBDIR/boost_locale*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_locale.*\)\.dll.*$;\1;' -e 's;^\(boost_locale.*\)\.a.*$;\1;'` ; do
  85. ax_lib=${libextension}
  86. AC_CHECK_LIB($ax_lib, exit,
  87. [BOOST_LOCALE_LIB="-l$ax_lib"; AC_SUBST(BOOST_LOCALE_LIB) link_locale="yes"; break],
  88. [link_locale="no"])
  89. done
  90. fi
  91. else
  92. for ax_lib in $ax_boost_user_locale_lib boost_locale-$ax_boost_user_locale_lib; do
  93. AC_CHECK_LIB($ax_lib, exit,
  94. [BOOST_LOCALE_LIB="-l$ax_lib"; AC_SUBST(BOOST_LOCALE_LIB) link_locale="yes"; break],
  95. [link_locale="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_locale" = "xno"; 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. ])