@@ -18,70 +18,76 @@ AC_DEFUN([CHECK_PCRE2],
18
18
AC_ARG_WITH (
19
19
pcre2 ,
20
20
[ AC_HELP_STRING ([ --with-pcre2=PATH] ,[ Path to pcre2 prefix or config script] )] ,
21
- , with_pcre2=yes )
21
+ , with_pcre2=no )
22
22
23
23
AS_CASE ( [ "${with_pcre2}"] ,
24
24
[ no] , [ test_paths=] ,
25
25
[ yes] , [ test_paths="/usr/local/libpcre2 /usr/local/pcre2 /usr/local /opt/libpcre2 /opt/pcre2 /opt /usr"] ,
26
26
[ test_paths="${with_pcre2}"] )
27
27
28
- AC_MSG_CHECKING ( [ for libpcre2 config script] )
28
+ if test "x${with_pcre2}" == "x" || test "x${with_pcre2}" == "xno"; then
29
+ AC_MSG_NOTICE ( [ pcre2 not specified; omitting check] )
30
+ else
29
31
30
- for x in ${test_paths}; do
31
- dnl # Determine if the script was specified and use it directly
32
- if test ! -d "$x" -a -e "$x"; then
33
- PCRE2_CONFIG=$x
34
- pcre2_path="no"
35
- break
36
- fi
32
+ AC_MSG_CHECKING ( [ for libpcre2 config script] )
37
33
38
- dnl # Try known config script names/locations
39
- for PCRE2_CONFIG in pcre2-config; do
40
- if test -e "${x}/bin/${PCRE2_CONFIG}"; then
41
- pcre2_path="${x}/bin"
34
+ for x in ${test_paths}; do
35
+ dnl # Determine if the script was specified and use it directly
36
+ if test ! -d "$x" -a -e "$x"; then
37
+ PCRE2_CONFIG=$x
38
+ pcre2_path="no"
42
39
break
43
- elif test -e "${x}/${PCRE2_CONFIG}"; then
44
- pcre2_path="${x}"
40
+ fi
41
+
42
+ dnl # Try known config script names/locations
43
+ for PCRE2_CONFIG in pcre2-config; do
44
+ if test -e "${x}/bin/${PCRE2_CONFIG}"; then
45
+ pcre2_path="${x}/bin"
46
+ break
47
+ elif test -e "${x}/${PCRE2_CONFIG}"; then
48
+ pcre2_path="${x}"
49
+ break
50
+ else
51
+ pcre2_path=""
52
+ fi
53
+ done
54
+ if test -n "$pcre2_path"; then
45
55
break
46
- else
47
- pcre2_path=""
48
56
fi
49
57
done
50
- if test -n "$pcre2_path"; then
51
- break
52
- fi
53
- done
54
58
55
- if test -n "${pcre2_path}"; then
56
- if test "${pcre2_path}" != "no"; then
57
- PCRE2_CONFIG="${pcre2_path}/${PCRE2_CONFIG}"
59
+ if test -n "${pcre2_path}"; then
60
+ if test "${pcre2_path}" != "no"; then
61
+ PCRE2_CONFIG="${pcre2_path}/${PCRE2_CONFIG}"
62
+ fi
63
+ AC_MSG_RESULT ( [ ${PCRE2_CONFIG}] )
64
+ PCRE2_VERSION="`${PCRE2_CONFIG} --version`"
65
+ if test "$verbose_output" -eq 1; then AC_MSG_NOTICE ( pcre2 VERSION: $PCRE2_VERSION ) ; fi
66
+ PCRE2_CFLAGS="`${PCRE2_CONFIG} --cflags`"
67
+ if test "$verbose_output" -eq 1; then AC_MSG_NOTICE ( pcre2 CFLAGS: $PCRE2_CFLAGS ) ; fi
68
+ PCRE2_LDADD="`${PCRE2_CONFIG} --libs8`"
69
+ if test "$verbose_output" -eq 1; then AC_MSG_NOTICE ( pcre2 LDADD: $PCRE2_LDADD ) ; fi
70
+ PCRE_LD_PATH="/`${PCRE2_CONFIG} --libs8 | cut -d'/' -f2,3,4,5,6 | cut -d ' ' -f1`"
71
+ if test "$verbose_output" -eq 1; then AC_MSG_NOTICE ( pcre2 PCRE_LD_PATH: $PCRE_LD_PATH ) ; fi
72
+ else
73
+ AC_MSG_RESULT ( [ no] )
58
74
fi
59
- AC_MSG_RESULT ( [ ${PCRE2_CONFIG}] )
60
- PCRE2_VERSION="`${PCRE2_CONFIG} --version`"
61
- if test "$verbose_output" -eq 1; then AC_MSG_NOTICE ( pcre2 VERSION: $PCRE2_VERSION ) ; fi
62
- PCRE2_CFLAGS="`${PCRE2_CONFIG} --cflags`"
63
- if test "$verbose_output" -eq 1; then AC_MSG_NOTICE ( pcre2 CFLAGS: $PCRE2_CFLAGS ) ; fi
64
- PCRE2_LDADD="`${PCRE2_CONFIG} --libs8`"
65
- if test "$verbose_output" -eq 1; then AC_MSG_NOTICE ( pcre2 LDADD: $PCRE2_LDADD ) ; fi
66
- PCRE_LD_PATH="/`${PCRE2_CONFIG} --libs8 | cut -d'/' -f2,3,4,5,6 | cut -d ' ' -f1`"
67
- if test "$verbose_output" -eq 1; then AC_MSG_NOTICE ( pcre2 PCRE_LD_PATH: $PCRE_LD_PATH ) ; fi
68
- else
69
- AC_MSG_RESULT ( [ no] )
70
- fi
71
75
72
- AC_SUBST ( PCRE2_CONFIG )
73
- AC_SUBST ( PCRE2_VERSION )
74
- AC_SUBST ( PCRE2_CPPFLAGS )
75
- AC_SUBST ( PCRE2_CFLAGS )
76
- AC_SUBST ( PCRE2_LDFLAGS )
77
- AC_SUBST ( PCRE2_LDADD )
78
- AC_SUBST ( PCRE_LD_PATH )
76
+ AC_SUBST ( PCRE2_CONFIG )
77
+ AC_SUBST ( PCRE2_VERSION )
78
+ AC_SUBST ( PCRE2_CPPFLAGS )
79
+ AC_SUBST ( PCRE2_CFLAGS )
80
+ AC_SUBST ( PCRE2_LDFLAGS )
81
+ AC_SUBST ( PCRE2_LDADD )
82
+ AC_SUBST ( PCRE_LD_PATH )
79
83
80
- if test -z "${PCRE2_VERSION}"; then
81
- AC_MSG_NOTICE ( [ *** pcre2 library not found.] )
82
- else
83
- AC_MSG_NOTICE ( [ using pcre2 v${PCRE2_VERSION}] )
84
- PCRE2_CFLAGS="-DWITH_PCRE2 ${PCRE2_CFLAGS}"
85
- ifelse ( [ $1 ] , , , $1 )
86
- fi
84
+ if test -z "${PCRE2_VERSION}"; then
85
+ AC_MSG_NOTICE ( [ *** pcre2 library not found.] )
86
+ ifelse ( [ $2 ] , , AC_MSG_ERROR ( [ pcre2 library is required] ) , $2 )
87
+ else
88
+ AC_MSG_NOTICE ( [ using pcre2 v${PCRE2_VERSION}] )
89
+ PCRE2_CFLAGS="-DWITH_PCRE2 ${PCRE2_CFLAGS}"
90
+ ifelse ( [ $1 ] , , , $1 )
91
+ fi
92
+ fi
87
93
] )
0 commit comments