git@vger.kernel.org mailing list mirror (one of many)
 help / Atom feed
* [PATCH 1/3] configure: fix a regression in PCRE v1 detection
  2018-03-11 13:26 [PATCH 0/3] Switch the default PCRE from v1 to v2 + configure fixes Ævar Arnfjörð Bjarmason
@ 2018-03-11 13:26 ` Ævar Arnfjörð Bjarmason
  2018-03-11 13:26 ` [PATCH 2/3] configure: detect redundant --with-libpcre & --with-libpcre1 Ævar Arnfjörð Bjarmason
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2018-03-11 13:26 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Michał Kiedrowicz,
	Ævar Arnfjörð Bjarmason

Change the check for PCRE v1 to disable the --with-libpcre1 option if
the pcre_version() function can't be found in the pcre library. I
unintentionally changed this in my 94da9193a6 ("grep: add support for
PCRE v2", 2017-06-01) while renaming moving some variables.

The intent of this check ever since it was added in
a119f91e57 ("configure: Check for libpcre", 2011-05-09) is to
second-guess the user and turn off an explicitly provided
--with-libpcre if the library can't be found.

I don't think that behavior makes any sense, we shouldn't be
second-guessing the user with an auto-detection, but changing that
needs a bigger refactoring of this script, and only has marginal
benefits. So let's fix it to work as it was intended to work again.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 configure.ac | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7f8415140f..41ceb2ac81 100644
--- a/configure.ac
+++ b/configure.ac
@@ -549,8 +549,8 @@ if test -n "$USE_LIBPCRE1"; then
 GIT_STASH_FLAGS($LIBPCREDIR)
 
 AC_CHECK_LIB([pcre], [pcre_version],
-[USE_LIBPCRE=YesPlease],
-[USE_LIBPCRE=])
+[USE_LIBPCRE1=YesPlease],
+[USE_LIBPCRE1=])
 
 GIT_UNSTASH_FLAGS($LIBPCREDIR)
 
-- 
2.15.1.424.g9478a66081


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/3] configure: detect redundant --with-libpcre & --with-libpcre1
  2018-03-11 13:26 [PATCH 0/3] Switch the default PCRE from v1 to v2 + configure fixes Ævar Arnfjörð Bjarmason
  2018-03-11 13:26 ` [PATCH 1/3] configure: fix a regression in PCRE v1 detection Ævar Arnfjörð Bjarmason
@ 2018-03-11 13:26 ` Ævar Arnfjörð Bjarmason
  2018-03-11 13:26 ` [PATCH 3/3] Makefile: make USE_LIBPCRE=YesPlease mean v2, not v1 Ævar Arnfjörð Bjarmason
  2018-03-14 22:41 ` [PATCH 0/3] Switch the default PCRE from v1 to v2 + configure fixes Junio C Hamano
  3 siblings, 0 replies; 4+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2018-03-11 13:26 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Michał Kiedrowicz,
	Ævar Arnfjörð Bjarmason

The --with-libpcre option is a synonym for the --with-libpcre1 flag,
but the configure script allowed for redundantly specifying both.

Nothing broke as a result of this, but it's confusing, so let's
disallow it.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 configure.ac | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/configure.ac b/configure.ac
index 41ceb2ac81..d1b3b143c4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -280,6 +280,10 @@ AS_HELP_STRING([--with-libpcre],[synonym for --with-libpcre1]),
 AC_ARG_WITH(libpcre1,
 AS_HELP_STRING([--with-libpcre1],[support Perl-compatible regexes via libpcre1 (default is NO)])
 AS_HELP_STRING([],           [ARG can be also prefix for libpcre library and headers]),
+    if test -n "$USE_LIBPCRE1"; then
+        AC_MSG_ERROR([Only supply one of --with-libpcre or its synonym --with-libpcre1!])
+    fi
+
     if test "$withval" = "no"; then
 	USE_LIBPCRE1=
     elif test "$withval" = "yes"; then
-- 
2.15.1.424.g9478a66081


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/3] Makefile: make USE_LIBPCRE=YesPlease mean v2, not v1
  2018-03-11 13:26 [PATCH 0/3] Switch the default PCRE from v1 to v2 + configure fixes Ævar Arnfjörð Bjarmason
  2018-03-11 13:26 ` [PATCH 1/3] configure: fix a regression in PCRE v1 detection Ævar Arnfjörð Bjarmason
  2018-03-11 13:26 ` [PATCH 2/3] configure: detect redundant --with-libpcre & --with-libpcre1 Ævar Arnfjörð Bjarmason
@ 2018-03-11 13:26 ` Ævar Arnfjörð Bjarmason
  2018-03-14 22:41 ` [PATCH 0/3] Switch the default PCRE from v1 to v2 + configure fixes Junio C Hamano
  3 siblings, 0 replies; 4+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2018-03-11 13:26 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Michał Kiedrowicz,
	Ævar Arnfjörð Bjarmason

Change the USE_LIBPCRE flag from being an alias for USE_LIBPCRE1 to
being an alias for USE_LIBPCRE2.

When support for v2 was added in my 94da9193a6 ("grep: add support for
PCRE v2", 2017-06-01) the existing USE_LIBPCRE flag was left as
meaning v1, with a note that this would likely change in a future
release. That optional support for v2 first made it into Git version
2.14.0.

The PCRE v2 support has been shown to be stable, and the upstream PCRE
project is highly encouraging downstream users to move to v2, so it
makes sense to give packagers of Git who haven't heard the news about
PCRE v2 a further nudge to move to v2.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 Makefile     | 26 +++++++++++++-------------
 configure.ac | 26 +++++++++++++-------------
 2 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/Makefile b/Makefile
index de4b8f0c02..449ff71f45 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.
+# USE_LIBPCRE is a synonym for USE_LIBPCRE2, define USE_LIBPCRE1
+# instead if you'd like to use the legacy version 1 of the PCRE
+# library. Support for version 1 will likely be removed in some future
+# release of Git, as upstream has all but abandoned it.
 #
 # When using USE_LIBPCRE1, define NO_LIBPCRE1_JIT if the PCRE v1
 # library is compiled without --enable-jit. We will auto-detect
@@ -1164,13 +1164,18 @@ ifdef NO_LIBGEN_H
 	COMPAT_OBJS += compat/basename.o
 endif
 
-USE_LIBPCRE1 ?= $(USE_LIBPCRE)
+USE_LIBPCRE2 ?= $(USE_LIBPCRE)
 
-ifneq (,$(USE_LIBPCRE1))
-	ifdef USE_LIBPCRE2
-$(error Only set USE_LIBPCRE1 (or its alias USE_LIBPCRE) or USE_LIBPCRE2, not both!)
+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
+
+ifdef USE_LIBPCRE1
 	BASIC_CFLAGS += -DUSE_LIBPCRE1
 	EXTLIBS += -lpcre
 
@@ -1179,11 +1184,6 @@ ifdef NO_LIBPCRE1_JIT
 endif
 endif
 
-ifdef USE_LIBPCRE2
-	BASIC_CFLAGS += -DUSE_LIBPCRE2
-	EXTLIBS += -lpcre2-8
-endif
-
 ifdef LIBPCREDIR
 	BASIC_CFLAGS += -I$(LIBPCREDIR)/include
 	EXTLIBS += -L$(LIBPCREDIR)/$(lib) $(CC_LD_DYNPATH)$(LIBPCREDIR)/$(lib)
diff --git a/configure.ac b/configure.ac
index d1b3b143c4..6f1fd9df35 100644
--- a/configure.ac
+++ b/configure.ac
@@ -254,25 +254,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.
+# USE_LIBPCRE is a synonym for USE_LIBPCRE2, define USE_LIBPCRE1
+# instead if you'd like to use the legacy version 1 of the PCRE
+# library. Support for version 1 will likely be removed in some future
+# release of Git, as upstream has all but abandoned it.
 #
 # 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)
@@ -280,10 +280,6 @@ AS_HELP_STRING([--with-libpcre],[synonym for --with-libpcre1]),
 AC_ARG_WITH(libpcre1,
 AS_HELP_STRING([--with-libpcre1],[support Perl-compatible regexes via libpcre1 (default is NO)])
 AS_HELP_STRING([],           [ARG can be also prefix for libpcre library and headers]),
-    if test -n "$USE_LIBPCRE1"; then
-        AC_MSG_ERROR([Only supply one of --with-libpcre or its synonym --with-libpcre1!])
-    fi
-
     if test "$withval" = "no"; then
 	USE_LIBPCRE1=
     elif test "$withval" = "yes"; then
@@ -300,6 +296,10 @@ AS_HELP_STRING([],           [ARG can be also prefix for libpcre library and hea
 AC_ARG_WITH(libpcre2,
 AS_HELP_STRING([--with-libpcre2],[support Perl-compatible regexes via libpcre2 (default is NO)])
 AS_HELP_STRING([],           [ARG can be also prefix for libpcre library and headers]),
+    if test -n "$USE_LIBPCRE2"; then
+        AC_MSG_ERROR([Only supply one of --with-libpcre or its synonym --with-libpcre2!])
+    fi
+
     if test -n "$USE_LIBPCRE1"; then
         AC_MSG_ERROR([Only supply one of --with-libpcre1 or --with-libpcre2!])
     fi
-- 
2.15.1.424.g9478a66081


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/3] Switch the default PCRE from v1 to v2 + configure fixes
  2018-03-11 13:26 [PATCH 0/3] Switch the default PCRE from v1 to v2 + configure fixes Ævar Arnfjörð Bjarmason
                   ` (2 preceding siblings ...)
  2018-03-11 13:26 ` [PATCH 3/3] Makefile: make USE_LIBPCRE=YesPlease mean v2, not v1 Ævar Arnfjörð Bjarmason
@ 2018-03-14 22:41 ` Junio C Hamano
  3 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2018-03-14 22:41 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason; +Cc: git, Michał Kiedrowicz

Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:

> This small series makes USE_LIBPCRE=YesPlease mean
> USE_LIBPCRE2=YesPlease, instead of USE_LIBPCRE1=YesPlease is it does
> now. Along the way I fixed a couple of minor issues in the PCRE
> detection in the autoconf script.
>
> Ævar Arnfjörð Bjarmason (3):
>   configure: fix a regression in PCRE v1 detection
>   configure: detect redundant --with-libpcre & --with-libpcre1
>   Makefile: make USE_LIBPCRE=YesPlease mean v2, not v1
>
>  Makefile     | 26 +++++++++++++-------------
>  configure.ac | 26 +++++++++++++++-----------
>  2 files changed, 28 insertions(+), 24 deletions(-)

Makes sense.  Will queue.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-11 13:26 [PATCH 0/3] Switch the default PCRE from v1 to v2 + configure fixes Ævar Arnfjörð Bjarmason
2018-03-11 13:26 ` [PATCH 1/3] configure: fix a regression in PCRE v1 detection Ævar Arnfjörð Bjarmason
2018-03-11 13:26 ` [PATCH 2/3] configure: detect redundant --with-libpcre & --with-libpcre1 Ævar Arnfjörð Bjarmason
2018-03-11 13:26 ` [PATCH 3/3] Makefile: make USE_LIBPCRE=YesPlease mean v2, not v1 Ævar Arnfjörð Bjarmason
2018-03-14 22:41 ` [PATCH 0/3] Switch the default PCRE from v1 to v2 + configure fixes Junio C Hamano

git@vger.kernel.org mailing list mirror (one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox