git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v4 19/19] Makefile & configure: make PCRE v2 the default PCRE implementation

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Apr 25, 2017, 21:05 UTC
Message-ID
<20170425210548.24612-20-avarab@gmail.com>
In-Reply-To
<20170425210548.24612-1-avarab@gmail.com>

Change the USE_LIBPCRE=YesPlease & --with-libpcre flags to the Makefile & configure script, respectively, to mean use PCRE v2, not PCRE v1.

The legacy library previously available via those options is still available on request via USE_LIBPCRE1=YesPlease or --with-libpcre1. The existing USE_LIBPCRE2=YesPlease & --with-libpcre2 still explicitly ask for v2.

The v2 PCRE is stable & end-user compatible, all this change does is change the default. Someone building a new git is likely to also have packaged PCRE v2 sometime in the last 2 years since it was released. If not they can choose to use the legacy v2 library by making the trivial s/USE_LIBPCRE/USE_LIBPCRE1/ change, or package up PCRE v2.

New releases of PCRE v2 are already faster than PCRE v1, and not only is all significant development is happening on v2, but bugs in reported against v1 have started getting WONTFIX'd asking users to just upgrade to v2.

So it makes sense to give our downstream distributors a nudge to switch over to it.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 Makefile     | 21 ++++++++++-----------
 configure.ac | 18 +++++++++---------
 2 files changed, 19 insertions(+), 20 deletions(-)
diff --git a/Makefile b/Makefile
index a792f206b9..42b09f9632 100644
--- a/Makefile
+++ b/Makefile
@@ -29,10 +29,10 @@ all::
 # Perl-compatible regular expressions instead of standard or extended
 # POSIX regular expressions.
 #
-# Currently USE_LIBPCRE is a synonym for USE_LIBPCRE1, define
-# USE_LIBPCRE2 instead if you'd like to use version 2 of the PCRE
-# library. The USE_LIBPCRE flag will likely be changed to mean v2 by
-# default in future releases.
+# The USE_LIBPCRE flag is a synonym for USE_LIBPCRE2, in previous
+# versions it meant the same thing USE_LIBPCRE1 does now. Define
+# USE_LIBPCRE1 instead if you'd like to use the legacy version 1 of
+# the PCRE library.
 #
 # Define LIBPCREDIR=/foo/bar if your PCRE header and library files are in
 # /foo/bar/include and /foo/bar/lib directories.
@@ -1090,18 +1090,17 @@ ifdef NO_LIBGEN_H
 	COMPAT_OBJS += compat/basename.o
 endif
 
-USE_LIBPCRE1 ?= $(USE_LIBPCRE)
-
-ifneq (,$(USE_LIBPCRE1))
-	ifdef USE_LIBPCRE2
-$(error Only set USE_LIBPCRE1 (or its alias USE_LIBPCRE) or USE_LIBPCRE2, not both!)
-	endif
+USE_LIBPCRE2 ?= $(USE_LIBPCRE)
 
+ifdef USE_LIBPCRE1
 	BASIC_CFLAGS += -DUSE_LIBPCRE1
 	EXTLIBS += -lpcre
 endif
 
-ifdef USE_LIBPCRE2
+ifneq (,$(USE_LIBPCRE2))
+	ifdef USE_LIBPCRE1
+$(error Only set USE_LIBPCRE2 (or its alias USE_LIBPCRE) or USE_LIBPCRE1, not both!)
+	endif
 	BASIC_CFLAGS += -DUSE_LIBPCRE2
 	EXTLIBS += -lpcre2-8
 endif
diff --git a/configure.ac b/configure.ac
index 11d083fbe0..f9659daeb7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -255,25 +255,25 @@ GIT_PARSE_WITH([openssl]))
 # Perl-compatible regular expressions instead of standard or extended
 # POSIX regular expressions.
 #
-# Currently USE_LIBPCRE is a synonym for USE_LIBPCRE1, define
-# USE_LIBPCRE2 instead if you'd like to use version 2 of the PCRE
-# library. The USE_LIBPCRE flag will likely be changed to mean v2 by
-# default in future releases.
+# The USE_LIBPCRE flag is a synonym for USE_LIBPCRE2, in previous
+# versions it meant the same thing USE_LIBPCRE1 does now. Define
+# USE_LIBPCRE1 instead if you'd like to use the legacy version 1 of
+# the PCRE library.
 #
 # Define LIBPCREDIR=/foo/bar if your PCRE header and library files are in
 # /foo/bar/include and /foo/bar/lib directories.
 #
 AC_ARG_WITH(libpcre,
-AS_HELP_STRING([--with-libpcre],[synonym for --with-libpcre1]),
+AS_HELP_STRING([--with-libpcre],[synonym for --with-libpcre2]),
     if test "$withval" = "no"; then
-	USE_LIBPCRE1=
+	USE_LIBPCRE2=
     elif test "$withval" = "yes"; then
-	USE_LIBPCRE1=YesPlease
+	USE_LIBPCRE2=YesPlease
     else
-	USE_LIBPCRE1=YesPlease
+	USE_LIBPCRE2=YesPlease
 	LIBPCREDIR=$withval
 	AC_MSG_NOTICE([Setting LIBPCREDIR to $LIBPCREDIR])
-        dnl USE_LIBPCRE1 can still be modified below, so don't substitute
+        dnl USE_LIBPCRE2 can still be modified below, so don't substitute
         dnl it yet.
 	GIT_CONF_SUBST([LIBPCREDIR])
     fi)
-- 
2.11.0
Previous: Ævar Arnfjörð Bjarmason
Message 24 of 24 in “PCRE v1 improvements & PCRE v2 support”
  1. 00/19 PCRE v1 improvements & PCRE v2 supportÆvar Arnfjörð Bjarmason, Apr 25, 2017
  2. 01/19 grep: amend submodule recursion test in preparation for rx engine testingÆvar Arnfjörð Bjarmason, Apr 25, 2017
  3. 02/19 grep: add tests for grep pattern types being passed to submodulesÆvar Arnfjörð Bjarmason, Apr 25, 2017
  4. 03/19 grep: submodule-related case statements should die if new fields are addedÆvar Arnfjörð Bjarmason, Apr 25, 2017
  5. 04/19 grep: remove redundant regflags assignment under PCREÆvar Arnfjörð Bjarmason, Apr 25, 2017
  6. 05/19 grep: remove redundant `regflags &= ~REG_EXTENDED` assignmentsÆvar Arnfjörð Bjarmason, Apr 25, 2017
  7. Junio C HamanoApr 26, 2017
  8. Junio C HamanoApr 26, 2017
  9. 05/19 grep: remove redundant `regflags &= ~REG_EXTENDED` assignmentsÆvar Arnfjörð Bjarmason, Apr 26, 2017
  10. Junio C HamanoApr 27, 2017
  11. 06/19 Makefile & configure: reword outdated comment about PCREÆvar Arnfjörð Bjarmason, Apr 25, 2017
  12. 07/19 grep: add a test for backreferences in PCRE patternsÆvar Arnfjörð Bjarmason, Apr 25, 2017
  13. 09/19 log: add -P as a synonym for --perl-regexpÆvar Arnfjörð Bjarmason, Apr 25, 2017
  14. 08/19 log: add exhaustive tests for pattern style options & configÆvar Arnfjörð Bjarmason, Apr 25, 2017
  15. 10/19 grep & rev-list doc: stop promising libpcre for --perl-regexpÆvar Arnfjörð Bjarmason, Apr 25, 2017
  16. 12/19 test-lib: rename the LIBPCRE prerequisite to PCREÆvar Arnfjörð Bjarmason, Apr 25, 2017
  17. 13/19 grep: change the internal PCRE macro names to be PCRE1Ævar Arnfjörð Bjarmason, Apr 25, 2017
  18. 14/19 grep: change the internal PCRE code & header names to be PCRE1Ævar Arnfjörð Bjarmason, Apr 25, 2017
  19. 15/19 perf: add a performance comparison test of grep -E and -PÆvar Arnfjörð Bjarmason, Apr 25, 2017
  20. 11/19 grep: make grep.patternType=[pcre|pcre1] a synonym for "perl"Ævar Arnfjörð Bjarmason, Apr 25, 2017
  21. 16/19 grep: add support for the PCRE v1 JIT APIÆvar Arnfjörð Bjarmason, Apr 25, 2017
  22. 17/19 grep: add support for PCRE v2Ævar Arnfjörð Bjarmason, Apr 25, 2017
  23. 18/19 grep: remove support for concurrent use of both PCRE v1 & v2Ævar Arnfjörð Bjarmason, Apr 25, 2017
  24. 19/19 Makefile & configure: make PCRE v2 the default PCRE implementationÆvar Arnfjörð Bjarmason, Apr 25, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.