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 <michal.kiedrowicz@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michał Kiedrowicz committed May 9, 2011 at 23:52 UTC a119f91e57f23f89b1f9170613d517d62a91c97d
2 files changed +41
config.mak.in
+1
@@ -61,6 +61,7 @@ NO_INET_PTON=@NO_INET_PTON@
61 NO_ICONV=@NO_ICONV@
62 OLD_ICONV=@OLD_ICONV@
63 NO_REGEX=@NO_REGEX@
64 +USE_LIBPCRE=@USE_LIBPCRE@
65 NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@
66 INLINE=@INLINE@
67 SOCKLEN_T=@SOCKLEN_T@
configure.ac
+40
@@ -220,6 +220,27 @@ AS_HELP_STRING([--with-openssl],[use OpenSSL library (default is YES)])
220 AS_HELP_STRING([], [ARG can be prefix for openssl library and headers]),\
221 GIT_PARSE_WITH(openssl))
222 #
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 +#
244 # Define NO_CURL if you do not have curl installed. git-http-pull and
245 # git-http-push are not built, and you cannot use http:// and https://
246 # transports.
@@ -434,6 +455,25 @@ GIT_UNSTASH_FLAGS($OPENSSLDIR)
455 AC_SUBST(NEEDS_SSL_WITH_CRYPTO)
456 AC_SUBST(NO_OPENSSL)
457
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 +
477 #
478 # Define NO_CURL if you do not have libcurl installed. git-http-pull and
479 # git-http-push are not built, and you cannot use http:// and https://