ax_path_lib_pcre.m4 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_path_lib_pcre.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_PATH_LIB_PCRE [(A/NA)]
  8. #
  9. # DESCRIPTION
  10. #
  11. # check for pcre lib and set PCRE_LIBS and PCRE_CFLAGS accordingly.
  12. #
  13. # also provide --with-pcre option that may point to the $prefix of the
  14. # pcre installation - the macro will check $pcre/include and $pcre/lib to
  15. # contain the necessary files.
  16. #
  17. # the usual two ACTION-IF-FOUND / ACTION-IF-NOT-FOUND are supported and
  18. # they can take advantage of the LIBS/CFLAGS additions.
  19. #
  20. # LICENSE
  21. #
  22. # Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
  23. #
  24. # Copying and distribution of this file, with or without modification, are
  25. # permitted in any medium without royalty provided the copyright notice
  26. # and this notice are preserved. This file is offered as-is, without any
  27. # warranty.
  28. #serial 9
  29. AC_DEFUN([AX_PATH_LIB_PCRE],[dnl
  30. AC_MSG_CHECKING([lib pcre])
  31. AC_ARG_WITH(pcre,
  32. [ --with-pcre[[=prefix]] compile xmlpcre part (via libpcre check)],,
  33. with_pcre="yes")
  34. if test ".$with_pcre" = ".no" ; then
  35. AC_MSG_RESULT([disabled])
  36. m4_ifval($2,$2)
  37. else
  38. AC_MSG_RESULT([(testing)])
  39. AC_CHECK_LIB(pcre, pcre_study)
  40. if test "$ac_cv_lib_pcre_pcre_study" = "yes" ; then
  41. PCRE_LIBS="-lpcre"
  42. AC_MSG_CHECKING([lib pcre])
  43. AC_MSG_RESULT([$PCRE_LIBS])
  44. m4_ifval($1,$1)
  45. else
  46. OLDLDFLAGS="$LDFLAGS" ; LDFLAGS="$LDFLAGS -L$with_pcre/lib"
  47. OLDCPPFLAGS="$CPPFLAGS" ; CPPFLAGS="$CPPFLAGS -I$with_pcre/include"
  48. AC_CHECK_LIB(pcre, pcre_compile)
  49. CPPFLAGS="$OLDCPPFLAGS"
  50. LDFLAGS="$OLDLDFLAGS"
  51. if test "$ac_cv_lib_pcre_pcre_compile" = "yes" ; then
  52. AC_MSG_RESULT(.setting PCRE_LIBS -L$with_pcre/lib -lpcre)
  53. PCRE_LIBS="-L$with_pcre/lib -lpcre"
  54. test -d "$with_pcre/include" && PCRE_CFLAGS="-I$with_pcre/include"
  55. AC_MSG_CHECKING([lib pcre])
  56. AC_MSG_RESULT([$PCRE_LIBS])
  57. m4_ifval($1,$1)
  58. else
  59. AC_MSG_CHECKING([lib pcre])
  60. AC_MSG_RESULT([no, (WARNING)])
  61. m4_ifval($2,$2)
  62. fi
  63. fi
  64. fi
  65. AC_SUBST([PCRE_LIBS])
  66. AC_SUBST([PCRE_CFLAGS])
  67. ])