1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
# BEGIN COPYRIGHT BLOCK
# Copyright (C) 2007 Red Hat, Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# END COPYRIGHT BLOCK
AC_CHECKING(for pcre)
dnl - check for --with-pcre
AC_MSG_CHECKING(for --with-pcre)
AC_ARG_WITH(pcre, [ --with-pcre=PATH Perl Compatible Regular Expression directory],
[
if test "$withval" = "yes"; then
AC_MSG_RESULT(yes)
dnl - check in system locations
if test -f "/usr/include/pcre.h"; then
pcre_incdir="/usr/include"
pcre_inc="-I/usr/include"
pcre_lib='-L$(libdir)'
pcre_libdir='$(libdir)'
else
AC_MSG_ERROR([pcre.h not found])
fi
elif test -d "$withval"/include -a -d "$withval"/lib; then
AC_MSG_RESULT([using $withval])
dnl - check the user provided location
PCREDIR=$withval
pcre_lib="-L$PCREDIR/lib"
pcre_libdir="$PCREDIR/lib"
pcre_incdir="$PCREDIR/include"
if ! test -e "$pcre_incdir/pcre.h" ; then
AC_MSG_ERROR([$withval include dir not found])
fi
pcre_inc="-I$pcre_incdir"
else
echo
AC_MSG_ERROR([$withval not found])
fi
],
AC_MSG_RESULT(no))
#
# if PCRE is not found yet, try pkg-config
if test -z "$pcre_inc" -o -z "$pcre_lib" -o -z "$pcre_libdir"; then
AC_PATH_PROG(PKG_CONFIG, pkg-config)
AC_MSG_CHECKING(for pcre with pkg-config)
if test -n "$PKG_CONFIG"; then
if $PKG_CONFIG --exists pcre; then
pcre_inc=`$PKG_CONFIG --cflags-only-I pcre`
pcre_lib=`$PKG_CONFIG --libs-only-L pcre`
pcre_libdir=`$PKG_CONFIG --libs-only-L pcre | sed -e s/-L// | sed -e s/\ .*$//`
AC_MSG_RESULT([using system PCRE])
elif $PKG_CONFIG --exists libpcre; then
pcre_inc=`$PKG_CONFIG --cflags-only-I libpcre`
pcre_lib=`$PKG_CONFIG --libs-only-L libpcre`
pcre_libdir=`$PKG_CONFIG --libs-only-L libpcre | sed -e s/-L// | sed -e s/\ .*$//`
AC_MSG_RESULT([using system PCRE])
else
AC_MSG_ERROR([PCRE not found, specify with --with-pcre.])
fi
fi
fi
dnl last resort
dnl - check in system locations
if test -z "$pcre_inc"; then
AC_MSG_CHECKING(for pcre.h)
if test -f "/usr/include/pcre.h"; then
AC_MSG_RESULT([using /usr/include/pcre.h])
pcre_incdir="/usr/include"
pcre_inc="-I/usr/include"
pcre_lib='-L$(libdir)'
pcre_libdir='$(libdir)'
else
AC_MSG_RESULT(no)
AC_MSG_ERROR([pcre not found, specify with --with-pcre.])
fi
fi
|