[PATCH] Makefile: avoid a fork in Cygwin version check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Eric Blake <eblake@xxxxxxxxxx>

It is nice to use fewer processes, since forking is so expensive on
cygwin.  So use a case statement instead of expr.

But does that work to have unbalanced ) in a makefile $(shell)?  On
the other hand, this is already in a chunk guarded by $(uname_S) being
cygwin, and we know that cygwin shells understand:

	case '$(uname_R)' in (1.[1-6].*) echo old;; esac

even though it is not portable to other shells, like NetBSD ash.

Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
---
Eric Blake wrote:
>> Eric Blake wrote:

>>> ifeq ($(shell case '$(uname_R)' in (1.[1-6].*) echo old;; esac),old)
[...]
> Junio mentioned he had already queued your first version of the patch;
> are you going to re-submit it with this tweak?

Since the patch to future-proof the version check has already hit master,
here’s the change as an independent patch against master.

 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index e210a42..767fb66 100644
--- a/Makefile
+++ b/Makefile
@@ -831,7 +831,7 @@ ifeq ($(uname_S),SunOS)
 	BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__ -DHAVE_ALLOCA_H
 endif
 ifeq ($(uname_O),Cygwin)
-	ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)
+	ifeq ($(shell case '$(uname_R)' in (1.[1-6].*) echo old;; esac),old)
 		NO_D_TYPE_IN_DIRENT = YesPlease
 		NO_D_INO_IN_DIRENT = YesPlease
 		NO_STRCASESTR = YesPlease
-- 
1.7.0.3

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]