Skip to content

Commit a119f91

Browse files
mkiedrowiczgitster
authored andcommitted
configure: Check for libpcre
This patch adds checks for libpcre to configure. By default libpcre is disabled, --with-libpcre enables it (if it works). Signed-off-by: Michał Kiedrowicz <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 63e7e9d commit a119f91

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

config.mak.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ NO_INET_PTON=@NO_INET_PTON@
6161
NO_ICONV=@NO_ICONV@
6262
OLD_ICONV=@OLD_ICONV@
6363
NO_REGEX=@NO_REGEX@
64+
USE_LIBPCRE=@USE_LIBPCRE@
6465
NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@
6566
INLINE=@INLINE@
6667
SOCKLEN_T=@SOCKLEN_T@

configure.ac

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,27 @@ AS_HELP_STRING([--with-openssl],[use OpenSSL library (default is YES)])
220220
AS_HELP_STRING([], [ARG can be prefix for openssl library and headers]),\
221221
GIT_PARSE_WITH(openssl))
222222
#
223+
# Define USE_LIBPCRE if you have and want to use libpcre. git-grep will be
224+
# able to use Perl-compatible regular expressions.
225+
#
226+
# Define LIBPCREDIR=/foo/bar if your libpcre header and library files are in
227+
# /foo/bar/include and /foo/bar/lib directories.
228+
#
229+
AC_ARG_WITH(libpcre,
230+
AS_HELP_STRING([--with-libpcre],[support Perl-compatible regexes (default is NO)])
231+
AS_HELP_STRING([], [ARG can be also prefix for libpcre library and headers]),
232+
if test "$withval" = "no"; then \
233+
USE_LIBPCRE=; \
234+
elif test "$withval" = "yes"; then \
235+
USE_LIBPCRE=YesPlease; \
236+
else
237+
USE_LIBPCRE=YesPlease; \
238+
LIBPCREDIR=$withval; \
239+
AC_MSG_NOTICE([Setting LIBPCREDIR to $withval]); \
240+
GIT_CONF_APPEND_LINE(LIBPCREDIR=$withval); \
241+
fi \
242+
)
243+
#
223244
# Define NO_CURL if you do not have curl installed. git-http-pull and
224245
# git-http-push are not built, and you cannot use http:// and https://
225246
# transports.
@@ -434,6 +455,25 @@ GIT_UNSTASH_FLAGS($OPENSSLDIR)
434455
AC_SUBST(NEEDS_SSL_WITH_CRYPTO)
435456
AC_SUBST(NO_OPENSSL)
436457

458+
#
459+
# Define USE_LIBPCRE if you have and want to use libpcre. git-grep will be
460+
# able to use Perl-compatible regular expressions.
461+
#
462+
463+
if test -n "$USE_LIBPCRE"; then
464+
465+
GIT_STASH_FLAGS($LIBPCREDIR)
466+
467+
AC_CHECK_LIB([pcre], [pcre_version],
468+
[USE_LIBPCRE=YesPlease],
469+
[USE_LIBPCRE=])
470+
471+
GIT_UNSTASH_FLAGS($LIBPCREDIR)
472+
473+
AC_SUBST(USE_LIBPCRE)
474+
475+
fi
476+
437477
#
438478
# Define NO_CURL if you do not have libcurl installed. git-http-pull and
439479
# git-http-push are not built, and you cannot use http:// and https://

0 commit comments

Comments
 (0)