git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: j6t@kdbg.org
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	git@vger.kernel.org, "Paolo Bonzini" <paolo.bonzini@gmail.com>,
	"Andreas Schwab" <schwab@linux-m68k.org>,
	"Junio C Hamano" <gitster@pobox.com>,
	"Frank Li" <lznuaa@gmail.com>,
	"Marius Storm-Olsen" <mstormo@gmail.com>,
	"René Scharfe" <rene.scharfe@lsrfire.ath.cx>
Subject: [PATCH 5/5 v2] autoconf: don't use platform regex if it lacks REG_STARTEND
Date: Tue, 17 Aug 2010 16:47:09 -0500	[thread overview]
Message-ID: <20100817214709.GB2221@burratino> (raw)
In-Reply-To: <mtranet.20100817145038.1501455151@telekom.at>

If the platform regex cannot match null bytes, we might as well
use the glibc version instead.

Cc: René Scharfe <rene.scharfe@lsrfire.ath.cx>
Tested-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Helped-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
j6t@kdbg.org wrote:
> Ævar Arnfjörð Bjarmason schrieb:
>> +[#ifdef REG_STARTEND
>> +yippeeyeswehaveit
>> +#endif
>> +]),
>> +	[ac_cv_c_excellent_regex=yes],
>> +	[ac_cv_c_excellent_regex=yes])
>> +])
>
> Do you have REG_STARTEND?
> 
>   o Yes
>   o Yes
> 
> Choose wisely! :)

Good catch.  Warning: I only tested the following with glibc.
Testing on platforms with missing or ancient regex support would
be very welcome.

 config.mak.in |    1 +
 configure.ac  |   21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/config.mak.in b/config.mak.in
index b4e65c3..67dbd3b 100644
--- a/config.mak.in
+++ b/config.mak.in
@@ -58,6 +58,7 @@ NO_INET_NTOP=@NO_INET_NTOP@
 NO_INET_PTON=@NO_INET_PTON@
 NO_ICONV=@NO_ICONV@
 OLD_ICONV=@OLD_ICONV@
+NO_REGEX=@NO_REGEX@
 NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@
 INLINE=@INLINE@
 SOCKLEN_T=@SOCKLEN_T@
diff --git a/configure.ac b/configure.ac
index 5601e8b..ed0561b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -706,6 +706,27 @@ else
 fi
 AC_SUBST(NO_C99_FORMAT)
 #
+# Define NO_REGEX if you have no or inferior regex support in your C library.
+AC_CACHE_CHECK([whether the platform regex can handle null bytes],
+ [ac_cv_c_excellent_regex], [
+AC_EGREP_CPP(yippeeyeswehaveit,
+	AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
+#include <regex.h>
+],
+[#ifdef REG_STARTEND
+yippeeyeswehaveit
+#endif
+]),
+	[ac_cv_c_excellent_regex=yes],
+	[ac_cv_c_excellent_regex=no])
+])
+if test $ac_cv_c_excellent_regex = yes; then
+	NO_REGEX=
+else
+	NO_REGEX=YesPlease
+fi
+AC_SUBST(NO_REGEX)
+#
 # Define FREAD_READS_DIRECTORIES if your are on a system which succeeds
 # when attempting to read from an fopen'ed directory.
 AC_CACHE_CHECK([whether system succeeds to read fopen'ed directory],
-- 
1.7.2.1.544.ga752d.dirty

  reply	other threads:[~2010-08-17 21:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-17 12:50 [PATCH 5/5] autoconf: don't use platform regex if it lacks REG_STARTEND j6t
2010-08-17 21:47 ` Jonathan Nieder [this message]
2010-08-18  8:49   ` [PATCH 5/5 v2] " Ævar Arnfjörð Bjarmason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100817214709.GB2221@burratino \
    --to=jrnieder@gmail.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=lznuaa@gmail.com \
    --cc=mstormo@gmail.com \
    --cc=paolo.bonzini@gmail.com \
    --cc=rene.scharfe@lsrfire.ath.cx \
    --cc=schwab@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).