tar: parse in a more locale-independent way.
[midnight-commander.git] / m4.include / ax_path_lib_pcre.m4
blob5355dd700db32d905acd07bb6d33c0db591e2b61
1 # ===========================================================================
2 #     https://www.gnu.org/software/autoconf-archive/ax_path_lib_pcre.html
3 # ===========================================================================
5 # SYNOPSIS
7 #   AX_PATH_LIB_PCRE [(A/NA)]
9 # DESCRIPTION
11 #   check for pcre lib and set PCRE_LIBS and PCRE_CFLAGS accordingly.
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.
17 #   the usual two ACTION-IF-FOUND / ACTION-IF-NOT-FOUND are supported and
18 #   they can take advantage of the LIBS/CFLAGS additions.
20 # LICENSE
22 #   Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
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.
29 #serial 9
31 AC_DEFUN([AX_PATH_LIB_PCRE],[dnl
32 AC_MSG_CHECKING([lib pcre])
33 AC_ARG_WITH(pcre,
34 [  --with-pcre[[=prefix]]    compile xmlpcre part (via libpcre check)],,
35      with_pcre="yes")
36 if test ".$with_pcre" = ".no" ; then
37   AC_MSG_RESULT([disabled])
38   m4_ifval($2,$2)
39 else
40   AC_MSG_RESULT([(testing)])
41   AC_CHECK_LIB(pcre, pcre_study)
42   if test "$ac_cv_lib_pcre_pcre_study" = "yes" ; then
43      PCRE_LIBS="-lpcre"
44      AC_MSG_CHECKING([lib pcre])
45      AC_MSG_RESULT([$PCRE_LIBS])
46      m4_ifval($1,$1)
47   else
48      OLDLDFLAGS="$LDFLAGS" ; LDFLAGS="$LDFLAGS -L$with_pcre/lib"
49      OLDCPPFLAGS="$CPPFLAGS" ; CPPFLAGS="$CPPFLAGS -I$with_pcre/include"
50      AC_CHECK_LIB(pcre, pcre_compile)
51      CPPFLAGS="$OLDCPPFLAGS"
52      LDFLAGS="$OLDLDFLAGS"
53      if test "$ac_cv_lib_pcre_pcre_compile" = "yes" ; then
54         AC_MSG_RESULT(.setting PCRE_LIBS -L$with_pcre/lib -lpcre)
55         PCRE_LIBS="-L$with_pcre/lib -lpcre"
56         test -d "$with_pcre/include" && PCRE_CFLAGS="-I$with_pcre/include"
57         AC_MSG_CHECKING([lib pcre])
58         AC_MSG_RESULT([$PCRE_LIBS])
59         m4_ifval($1,$1)
60      else
61         AC_MSG_CHECKING([lib pcre])
62         AC_MSG_RESULT([no, (WARNING)])
63         m4_ifval($2,$2)
64      fi
65   fi
67 AC_SUBST([PCRE_LIBS])
68 AC_SUBST([PCRE_CFLAGS])