1 | # pcre.m4 - check for libpcre support
|
---|
2 | # serial 1
|
---|
3 |
|
---|
4 | # Copyright (C) 2010-2012 Free Software Foundation, Inc.
|
---|
5 | # This file is free software; the Free Software Foundation
|
---|
6 | # gives unlimited permission to copy and/or distribute it,
|
---|
7 | # with or without modifications, as long as this notice is preserved.
|
---|
8 |
|
---|
9 | AC_DEFUN([gl_FUNC_PCRE],
|
---|
10 | [
|
---|
11 | AC_ARG_ENABLE([perl-regexp],
|
---|
12 | AC_HELP_STRING([--disable-perl-regexp],
|
---|
13 | [disable perl-regexp (pcre) support]),
|
---|
14 | [case $enableval in
|
---|
15 | yes|no) test_pcre=$enableval;;
|
---|
16 | *) AC_MSG_ERROR([invalid value $enableval for --disable-perl-regexp]);;
|
---|
17 | esac],
|
---|
18 | [test_pcre=yes])
|
---|
19 |
|
---|
20 | LIB_PCRE=
|
---|
21 | AC_SUBST([LIB_PCRE])
|
---|
22 | use_pcre=no
|
---|
23 |
|
---|
24 | if test x"$test_pcre" = x"yes"; then
|
---|
25 | AC_CHECK_HEADERS([pcre.h])
|
---|
26 | AC_CHECK_HEADERS([pcre/pcre.h])
|
---|
27 | if test $ac_cv_header_pcre_h = yes \
|
---|
28 | || test $ac_cv_header_pcre_pcre_h = yes; then
|
---|
29 | pcre_saved_LIBS=$LIBS
|
---|
30 | AC_SEARCH_LIBS([pcre_compile], [pcre],
|
---|
31 | [test "$ac_cv_search_pcre_compile" = "none required" ||
|
---|
32 | LIB_PCRE=$ac_cv_search_pcre_compile])
|
---|
33 | AC_CHECK_FUNCS([pcre_compile])
|
---|
34 | LIBS=$pcre_saved_LIBS
|
---|
35 | if test $ac_cv_func_pcre_compile = yes; then
|
---|
36 | use_pcre=yes
|
---|
37 | fi
|
---|
38 | fi
|
---|
39 | if test $use_pcre = no; then
|
---|
40 | AC_MSG_WARN([libpcre development library was not found or not usable.])
|
---|
41 | AC_MSG_WARN([AC_PACKAGE_NAME will be built without pcre support.])
|
---|
42 | fi
|
---|
43 | fi
|
---|
44 |
|
---|
45 | AC_DEFINE_UNQUOTED([HAVE_LIBPCRE], [`test $use_pcre != yes; echo $?`],
|
---|
46 | [Define to 1 if you have the `pcre' library (-lpcre).])
|
---|
47 | ])
|
---|