1
1
dnl Check for PCRE2 Libraries
2
2
dnl CHECK_PCRE2(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
3
3
4
- AC_DEFUN ( [ PROG_PCRE2 ] , [
4
+ AC_DEFUN ( [ CHECK_PCRE2 ] , [
5
5
6
6
# Possible names for the pcre2 library/package (pkg-config)
7
7
PCRE2_POSSIBLE_LIB_NAMES="pcre2 pcre2-8 libpcre2-8"
@@ -13,105 +13,76 @@ PCRE2_POSSIBLE_EXTENSIONS="so so0 la sl dll dylib so.0.0.0"
13
13
PCRE2_POSSIBLE_PATHS="/usr/lib /usr/local/lib /usr/local/libpcre2-8 /usr/local/pcre2 /usr/local /opt/libpcre2-8 /opt/pcre2 /opt /usr /usr/lib64 /opt/local"
14
14
15
15
# Variables to be set by this very own script.
16
- PCRE2_VERSION =""
17
- PCRE2_CFLAGS =""
18
- PCRE2_CPPFLAGS =""
19
- PCRE2_LDADD =""
20
- PCRE2_LDFLAGS =""
16
+ PCRE_VERSION =""
17
+ PCRE_CFLAGS =""
18
+ PCRE_LDADD =""
19
+ PCRE_LDFLAGS =""
20
+ PCRE_DISPLAY =""
21
21
22
22
AC_ARG_WITH (
23
23
pcre2 ,
24
24
[ AS_HELP_STRING ( [ --with-pcre2=PATH] ,[ Path to pcre2 prefix or config script] ) ]
25
25
)
26
26
27
- if test "x${with_pcre2}" == "xno"; then
28
- AC_DEFINE ( HAVE_PCRE2 , 0 , [ Support for PCRE2 was disabled by the utilization of --without-pcre2 or --with-pcre2=no] )
29
- AC_MSG_NOTICE ( [ Support for PCRE2 was disabled by the utilization of --without-pcre2 or --with-pcre2=no] )
30
- PCRE2_DISABLED=yes
31
- else
32
- if test "x${with_pcre2}" == "xyes"; then
33
- PCRE2_MANDATORY=yes
34
- AC_MSG_NOTICE ( [ PCRE2 support was marked as mandatory by the utilization of --with-pcre2=yes] )
35
- fi
36
- # for x in ${PCRE2_POSSIBLE_LIB_NAMES}; do
37
- # CHECK_FOR_PCRE2_AT(${x})
38
- # if test -n "${PCRE2_VERSION}"; then
39
- # break
40
- # fi
41
- # done
42
-
43
- # if test "x${with_pcre2}" != "xyes" or test "x${with_pcre2}" == "xyes"; then
44
- if test "x${with_pcre2}" == "x" || test "x${with_pcre2}" == "xyes"; then
45
- # Nothing about PCRE2 was informed, using the pkg-config to figure things out.
46
- if test -n "${PKG_CONFIG}"; then
47
- PCRE2_PKG_NAME=""
48
- for x in ${PCRE2_POSSIBLE_LIB_NAMES}; do
49
- if ${PKG_CONFIG} --exists ${x}; then
50
- PCRE2_PKG_NAME="$x"
51
- break
52
- fi
53
- done
27
+ PCRE2_MANDATORY=yes
28
+ AC_MSG_NOTICE ( [ pcre2 is mandatory] )
29
+
30
+ if test "x${with_pcre2}" == "x" || test "x${with_pcre2}" == "xyes"; then
31
+ # Nothing about PCRE2 was informed, using the pkg-config to figure things out.
32
+ if test -n "${PKG_CONFIG}"; then
33
+ PCRE2_PKG_NAME=""
34
+ for x in ${PCRE2_POSSIBLE_LIB_NAMES}; do
35
+ if ${PKG_CONFIG} --exists ${x}; then
36
+ PCRE2_PKG_NAME="$x"
37
+ break
54
38
fi
55
- AC_MSG_NOTICE ( [ Nothing about PCRE2 was informed during the configure phase. Trying to detect it on the platform...] )
56
- if test -n "${PCRE2_PKG_NAME}"; then
57
- # Package was found using the pkg-config scripts
58
- PCRE2_VERSION="`${PKG_CONFIG} ${PCRE2_PKG_NAME} --modversion`"
59
- PCRE2_CFLAGS="`${PKG_CONFIG} ${PCRE2_PKG_NAME} --cflags`"
60
- PCRE2_LDADD="`${PKG_CONFIG} ${PCRE2_PKG_NAME} --libs-only-l`"
61
- PCRE2_LDFLAGS="`${PKG_CONFIG} ${PCRE2_PKG_NAME} --libs-only-L --libs-only-other`"
62
- PCRE2_DISPLAY="${PCRE2_LDADD}, ${PCRE2_CFLAGS}"
63
- else
64
- # If pkg-config did not find anything useful, go over file lookup.
65
- for x in ${PCRE2_POSSIBLE_PATHS}; do
66
- CHECK_FOR_PCRE2_AT(${x})
67
- if test -n "${PCRE2_VERSION}"; then
68
- break
69
- fi
70
- done
39
+ done
40
+ fi
41
+ AC_MSG_NOTICE ( [ Nothing about PCRE2 was informed during the configure phase. Trying to detect it on the platform...] )
42
+ if test -n "${PCRE2_PKG_NAME}"; then
43
+ # Package was found using the pkg-config scripts
44
+ PCRE_VERSION="`${PKG_CONFIG} ${PCRE2_PKG_NAME} --modversion`"
45
+ PCRE_CFLAGS="`${PKG_CONFIG} ${PCRE2_PKG_NAME} --cflags`"
46
+ PCRE_LDADD="`${PKG_CONFIG} ${PCRE2_PKG_NAME} --libs-only-l`"
47
+ PCRE_LDFLAGS="`${PKG_CONFIG} ${PCRE2_PKG_NAME} --libs-only-L --libs-only-other`"
48
+ else
49
+ # If pkg-config did not find anything useful, go over file lookup.
50
+ for x in ${PCRE2_POSSIBLE_PATHS}; do
51
+ CHECK_FOR_PCRE2_AT(${x})
52
+ if test -n "${PCRE_LDADD}"; then
53
+ break
71
54
fi
72
- fi
73
- if test "x${with_pcre2}" != "x"; then
74
- # An specific path was informed, lets check.
75
- PCRE2_MANDATORY=yes
76
- CHECK_FOR_PCRE2_AT(${with_pcre2})
77
- fi
78
- # fi
55
+ done
56
+ fi
57
+ elif test "x${with_pcre2}" != "x"; then
58
+ # A specific path was informed, let's check.
59
+ CHECK_FOR_PCRE2_AT(${with_pcre2})
79
60
fi
80
61
81
- if test -z "${PCRE2_LDADD}"; then
82
- if test -z "${PCRE2_MANDATORY}"; then
83
- if test -z "${PCRE2_DISABLED}"; then
84
- AC_MSG_NOTICE ( [ PCRE2 library was not found] )
85
- PCRE2_FOUND=0
86
- else
87
- PCRE2_FOUND=2
88
- fi
89
- else
90
- AC_MSG_ERROR ( [ PCRE2 was explicitly referenced but it was not found] )
91
- PCRE2_FOUND=-1
92
- fi
62
+ if test -z "${PCRE_LDADD}"; then
63
+ AC_MSG_ERROR ( [ PCRE2 is mandatory but it was not found] )
64
+ PCRE2_FOUND=-1
93
65
else
94
66
if test -z "${PCRE2_MANDATORY}"; then
95
67
PCRE2_FOUND=2
96
68
AC_MSG_NOTICE ( [ PCRE2 is disabled by default.] )
97
69
else
98
70
PCRE2_FOUND=1
99
- AC_MSG_NOTICE ( [ using PCRE2 v${PCRE2_VERSION}] )
100
- PCRE2_CFLAGS="-DWITH_PCRE2 ${PCRE2_CFLAGS}"
101
- PCRE2_DISPLAY="${PCRE2_LDADD}, ${PCRE2_CFLAGS}"
102
- AC_SUBST ( PCRE2_VERSION )
103
- AC_SUBST ( PCRE2_LDADD )
104
- AC_SUBST ( PCRE2_LIBS )
105
- AC_SUBST ( PCRE2_LDFLAGS )
106
- AC_SUBST ( PCRE2_CFLAGS )
107
- AC_SUBST ( PCRE2_DISPLAY )
71
+ AC_MSG_NOTICE ( [ using PCRE2 v${PCRE_VERSION}] )
72
+ PCRE_CFLAGS="${PCRE_CFLAGS}"
73
+ PCRE_DISPLAY="${PCRE_LDADD}, ${PCRE_CFLAGS}"
74
+ AC_SUBST ( PCRE_VERSION )
75
+ AC_SUBST ( PCRE_LDADD )
76
+ AC_SUBST ( PCRE_LDFLAGS )
77
+ AC_SUBST ( PCRE_CFLAGS )
78
+ AC_SUBST ( PCRE_DISPLAY )
108
79
fi
109
80
fi
110
81
111
82
112
83
AC_SUBST ( PCRE2_FOUND )
113
84
114
- ] ) # AC_DEFUN [PROG_PCRE2 ]
85
+ ] ) # AC_DEFUN [CHECK_PCRE2 ]
115
86
116
87
117
88
AC_DEFUN ( [ CHECK_FOR_PCRE2_AT] , [
@@ -172,9 +143,8 @@ AC_DEFUN([CHECK_FOR_PCRE2_AT], [
172
143
173
144
if test -n "${pcre2_lib_path}" -a -n "${pcre2_inc_path}"; then
174
145
# TODO: Compile a piece of code to check the version.
175
- PCRE2_CFLAGS="-I${pcre2_inc_path}"
176
- PCRE2_LDADD="-l${pcre2_lib_name}"
177
- PCRE2_LDFLAGS="-L${pcre2_lib_path}"
178
- PCRE2_DISPLAY="${pcre2_lib_file}, ${pcre2_inc_path}"
146
+ PCRE_CFLAGS="-I${pcre2_inc_path}"
147
+ PCRE_LDADD="-l${pcre2_lib_name}"
148
+ PCRE_LDFLAGS="-L${pcre2_lib_path}"
179
149
fi
180
150
] ) # AC_DEFUN [CHECK_FOR_PCRE2_AT]
0 commit comments