Skip to content

Commit 68683c3

Browse files
authored
Merge pull request #2975 from martinhsv/v2/master
Configure: do not check for pcre1 if pcre2 requested
2 parents 0dbdc2b + d4310f5 commit 68683c3

File tree

1 file changed

+57
-53
lines changed

1 file changed

+57
-53
lines changed

build/find_pcre.m4

Lines changed: 57 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -21,69 +21,73 @@ AC_ARG_WITH(
2121
[test_paths="${with_pcre}"],
2222
[test_paths="/usr/local/libpcre /usr/local/pcre /usr/local /opt/libpcre /opt/pcre /opt /usr"])
2323
24-
AC_MSG_CHECKING([for libpcre config script])
25-
26-
dnl # Determine pcre lib directory
27-
if test -z "${with_pcre}"; then
28-
test_paths="/usr/local/pcre /usr/local /usr"
24+
if test "x${with_pcre2}" != "x" && test "x${with_pcre2}" != "xno"; then
25+
AC_MSG_NOTICE([pcre2 specified; omitting check for pcre])
2926
else
30-
test_paths="${with_pcre}"
31-
fi
27+
AC_MSG_CHECKING([for libpcre config script])
3228
33-
for x in ${test_paths}; do
34-
dnl # Determine if the script was specified and use it directly
35-
if test ! -d "$x" -a -e "$x"; then
36-
PCRE_CONFIG=$x
37-
pcre_path="no"
38-
break
29+
dnl # Determine pcre lib directory
30+
if test -z "${with_pcre}"; then
31+
test_paths="/usr/local/pcre /usr/local /usr"
32+
else
33+
test_paths="${with_pcre}"
3934
fi
4035
41-
dnl # Try known config script names/locations
42-
for PCRE_CONFIG in pcre-config; do
43-
if test -e "${x}/bin/${PCRE_CONFIG}"; then
44-
pcre_path="${x}/bin"
36+
for x in ${test_paths}; do
37+
dnl # Determine if the script was specified and use it directly
38+
if test ! -d "$x" -a -e "$x"; then
39+
PCRE_CONFIG=$x
40+
pcre_path="no"
4541
break
46-
elif test -e "${x}/${PCRE_CONFIG}"; then
47-
pcre_path="${x}"
42+
fi
43+
44+
dnl # Try known config script names/locations
45+
for PCRE_CONFIG in pcre-config; do
46+
if test -e "${x}/bin/${PCRE_CONFIG}"; then
47+
pcre_path="${x}/bin"
48+
break
49+
elif test -e "${x}/${PCRE_CONFIG}"; then
50+
pcre_path="${x}"
51+
break
52+
else
53+
pcre_path=""
54+
fi
55+
done
56+
if test -n "$pcre_path"; then
4857
break
49-
else
50-
pcre_path=""
5158
fi
5259
done
53-
if test -n "$pcre_path"; then
54-
break
55-
fi
56-
done
5760
58-
if test -n "${pcre_path}"; then
59-
if test "${pcre_path}" != "no"; then
60-
PCRE_CONFIG="${pcre_path}/${PCRE_CONFIG}"
61+
if test -n "${pcre_path}"; then
62+
if test "${pcre_path}" != "no"; then
63+
PCRE_CONFIG="${pcre_path}/${PCRE_CONFIG}"
64+
fi
65+
AC_MSG_RESULT([${PCRE_CONFIG}])
66+
PCRE_VERSION="`${PCRE_CONFIG} --version`"
67+
if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(pcre VERSION: $PCRE_VERSION); fi
68+
PCRE_CFLAGS="`${PCRE_CONFIG} --cflags`"
69+
if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(pcre CFLAGS: $PCRE_CFLAGS); fi
70+
PCRE_LDADD="`${PCRE_CONFIG} --libs`"
71+
if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(pcre LDADD: $PCRE_LDADD); fi
72+
PCRE_LD_PATH="/`${PCRE_CONFIG} --libs | cut -d'/' -f2,3,4,5,6 | cut -d ' ' -f1`"
73+
if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(pcre PCRE_LD_PATH: $PCRE_LD_PATH); fi
74+
else
75+
AC_MSG_RESULT([no])
6176
fi
62-
AC_MSG_RESULT([${PCRE_CONFIG}])
63-
PCRE_VERSION="`${PCRE_CONFIG} --version`"
64-
if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(pcre VERSION: $PCRE_VERSION); fi
65-
PCRE_CFLAGS="`${PCRE_CONFIG} --cflags`"
66-
if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(pcre CFLAGS: $PCRE_CFLAGS); fi
67-
PCRE_LDADD="`${PCRE_CONFIG} --libs`"
68-
if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(pcre LDADD: $PCRE_LDADD); fi
69-
PCRE_LD_PATH="/`${PCRE_CONFIG} --libs | cut -d'/' -f2,3,4,5,6 | cut -d ' ' -f1`"
70-
if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(pcre PCRE_LD_PATH: $PCRE_LD_PATH); fi
71-
else
72-
AC_MSG_RESULT([no])
73-
fi
7477
75-
AC_SUBST(PCRE_CONFIG)
76-
AC_SUBST(PCRE_VERSION)
77-
AC_SUBST(PCRE_CPPFLAGS)
78-
AC_SUBST(PCRE_CFLAGS)
79-
AC_SUBST(PCRE_LDFLAGS)
80-
AC_SUBST(PCRE_LDADD)
81-
AC_SUBST(PCRE_LD_PATH)
78+
AC_SUBST(PCRE_CONFIG)
79+
AC_SUBST(PCRE_VERSION)
80+
AC_SUBST(PCRE_CPPFLAGS)
81+
AC_SUBST(PCRE_CFLAGS)
82+
AC_SUBST(PCRE_LDFLAGS)
83+
AC_SUBST(PCRE_LDADD)
84+
AC_SUBST(PCRE_LD_PATH)
8285
83-
if test -z "${PCRE_VERSION}"; then
84-
AC_MSG_NOTICE([*** pcre library not found.])
85-
else
86-
AC_MSG_NOTICE([using pcre v${PCRE_VERSION}])
87-
ifelse([$1], , , $1)
88-
fi
86+
if test -z "${PCRE_VERSION}"; then
87+
AC_MSG_NOTICE([*** pcre library not found.])
88+
else
89+
AC_MSG_NOTICE([using pcre v${PCRE_VERSION}])
90+
ifelse([$1], , , $1)
91+
fi
92+
fi
8993
])

0 commit comments

Comments
 (0)