PageRenderTime 35ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/m4/ax_boost_regex.m4

http://github.com/mozy/mordor
m4 | 111 lines | 72 code | 7 blank | 32 comment | 0 complexity | 02dea1be638ed7a82f40aaee2e8d0b07 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. # ===========================================================================
  2. # http://www.gnu.org/software/autoconf-archive/ax_boost_regex.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_BOOST_REGEX
  8. #
  9. # DESCRIPTION
  10. #
  11. # Test for Regex 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_REGEX_LIB)
  18. #
  19. # And sets:
  20. #
  21. # HAVE_BOOST_REGEX
  22. #
  23. # LICENSE
  24. #
  25. # Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
  26. # Copyright (c) 2008 Michael Tindal
  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 19
  33. AC_DEFUN([AX_BOOST_REGEX],
  34. [
  35. AC_ARG_WITH([boost-regex],
  36. AS_HELP_STRING([--with-boost-regex@<:@=special-lib@:>@],
  37. [use the Regex library from boost - it is possible to specify a certain library for the linker
  38. e.g. --with-boost-regex=boost_regex-gcc-mt-d-1_33_1 ]),
  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_regex_lib=""
  45. else
  46. want_boost="yes"
  47. ax_boost_user_regex_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::Regex library is available,
  61. ax_cv_boost_regex,
  62. [AC_LANG_PUSH([C++])
  63. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/regex.hpp>
  64. ]],
  65. [[boost::regex r(); return 0;]])],
  66. ax_cv_boost_regex=yes, ax_cv_boost_regex=no)
  67. AC_LANG_POP([C++])
  68. ])
  69. if test "x$ax_cv_boost_regex" = "xyes"; then
  70. AC_DEFINE(HAVE_BOOST_REGEX,,[define if the Boost::Regex library is available])
  71. BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
  72. if test "x$ax_boost_user_regex_lib" = "x"; then
  73. for libextension in `ls $BOOSTLIBDIR/libboost_regex*.so* $BOOSTLIBDIR/libboost_regex*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_regex.*\)\.so.*$;\1;' -e 's;^lib\(boost_regex.*\)\.a*$;\1;'` ; do
  74. ax_lib=${libextension}
  75. AC_CHECK_LIB($ax_lib, exit,
  76. [BOOST_REGEX_LIB="-l$ax_lib"; AC_SUBST(BOOST_REGEX_LIB) link_regex="yes"; break],
  77. [link_regex="no"])
  78. done
  79. if test "x$link_regex" != "xyes"; then
  80. for libextension in `ls $BOOSTLIBDIR/boost_regex*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_regex.*\)\.dll.*$;\1;' -e 's;^\(boost_regex.*\)\.a*$;\1;'` ; do
  81. ax_lib=${libextension}
  82. AC_CHECK_LIB($ax_lib, exit,
  83. [BOOST_REGEX_LIB="-l$ax_lib"; AC_SUBST(BOOST_REGEX_LIB) link_regex="yes"; break],
  84. [link_regex="no"])
  85. done
  86. fi
  87. else
  88. for ax_lib in $ax_boost_user_regex_lib boost_regex-$ax_boost_user_regex_lib; do
  89. AC_CHECK_LIB($ax_lib, main,
  90. [BOOST_REGEX_LIB="-l$ax_lib"; AC_SUBST(BOOST_REGEX_LIB) link_regex="yes"; break],
  91. [link_regex="no"])
  92. done
  93. fi
  94. if test "x$ax_lib" = "x"; then
  95. AC_MSG_ERROR(Could not find a version of the library!)
  96. fi
  97. if test "x$link_regex" != "xyes"; then
  98. AC_MSG_ERROR(Could not link against $ax_lib !)
  99. fi
  100. fi
  101. CPPFLAGS="$CPPFLAGS_SAVED"
  102. LDFLAGS="$LDFLAGS_SAVED"
  103. fi
  104. ])