POSIX compliant grep invocation in OpenJDK configure script
Matthew Dempsky
mdempsky at google.com
Fri Nov 1 03:03:49 UTC 2013
[I tried sending this yesterday, but it got stuck in the moderation queue;
I've cancelled that attempt and subscribed to build-dev, so I'm posting it
again.]
According to POSIX Issue
7<http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html>,
only Extended Regular Expressions (EREs) support pattern alternation; Basic
Regular Expressions (BREs) do not. GNU grep (and apparently grep on
Solaris and OS X) support \| for alternation in BREs, but grep on OpenBSD
does not. This causes the GNU make version check in configure to
incorrectly fail on OpenBSD.
The easy fix is to use the standardized -E
option<http://pubs.opengroup.org/onlinepubs/9699919799/utilities/grep.html>
to
have grep use EREs instead of BREs. This works with GNU and OpenBSD grep,
and according to online manuals should work with Solaris and OS X grep too.
I've never submitted a patch to OpenJDK before, so I've included it inline
for simplicity (sorry that gmail mangled it). If you'd prefer I post it
another way, I'm happy to do so.
Patch is against JDK8 (
http://hg.openjdk.java.net/jdk8/jdk8/file/a36df87b3901/common/autoconf/basics.m4
).
diff -r a36df87b3901 common/autoconf/basics.m4
--- a/common/autoconf/basics.m4 Thu Oct 24 09:10:01 2013 -0700
+++ b/common/autoconf/basics.m4 Mon Oct 28 15:53:55 2013 -0700
@@ -514,7 +514,7 @@
if test "x$IS_GNU_MAKE" = x; then
AC_MSG_NOTICE([Found potential make at $MAKE_CANDIDATE, however,
this is not GNU Make. Ignoring.])
else
- IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP
'\(3\.8[[12]]\)\|\(4\.\)'`
+ IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -E
'(3\.8[[12]])|(4\.)'`
if test "x$IS_MODERN_MAKE" = x; then
AC_MSG_NOTICE([Found GNU make at $MAKE_CANDIDATE, however this is
not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring.])
else
More information about the build-dev
mailing list