[PATCH 1/2] config.mak.uname: Darwin: define HAVE_GETDELIM for modern OS X releases

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

 



On Mac OS X, getdelim() first became available with Xcode 4.1[1], which
was released the same day as OS X 10.7 "Lion", so assume getdelim()
availability from 10.7 onward. (As of this writing, OS X is at 10.10
"Yosemite".)

According to Wikipedia[2], 4.1 was also available for download by paying
developers on OS X 10.6 "Snow Leopard", so it's possible that some 10.6
machines may have getdelim(). However, as strbuf's use of getdelim() is
purely an optimization, let's be conservative and assume 10.6 and
earlier lack getdelim().

[1]: Or, possibly with Xcode 4.0, but that version is no longer
     available for download, or not available to non-paying developers,
     so testing is not possible.

[2]: http://en.wikipedia.org/wiki/Xcode

Signed-off-by: Eric Sunshine <sunshine@xxxxxxxxxxxxxx>
---

Tested on OS X 10.10.3 "Yosemite" with Xcode 6.3.2 and OS X 10.5.8
"Leopard" with Xcode 3.1.

The use of 'expr' in this new test is decidedly different from existing
instances which merely check if `uname -R` matches a particular single
digit and a period. If the new test took the same approach, it would
have to match either one digit (in a particular range) plus a period, or
two digits with the first being "1", plus a period. The resulting 'expr'
expression quickly becomes ugly and quite difficult to decipher. Hence,
the new test instead takes advantage of expr's relational operator '>='
to keep things simple and make the test easy to understand at a glance
("if version >= 11" where 11 is the Darwin major version number of OS X
10.7).

 config.mak.uname | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/config.mak.uname b/config.mak.uname
index d26665f..46a415c 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -102,6 +102,9 @@ ifeq ($(uname_S),Darwin)
 	ifeq ($(shell expr "$(uname_R)" : '[15]\.'),2)
 		NO_STRLCPY = YesPlease
 	endif
+	ifeq ($(shell expr $(shell expr "$(uname_R)" : '\([0-9][0-9]*\)\.') '>=' 11),1)
+		HAVE_GETDELIM = YesPlease
+	endif
 	NO_MEMMEM = YesPlease
 	USE_ST_TIMESPEC = YesPlease
 	HAVE_DEV_TTY = YesPlease
-- 
2.4.2.598.gb4379f4

--
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]