* [PATCH v2 0/2] auto-detect getdelim()
@ 2015-06-02 21:15 Eric Sunshine
2015-06-02 21:15 ` [PATCH v2 1/2] config.mak.uname: Darwin: define HAVE_GETDELIM for modern OS X releases Eric Sunshine
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Eric Sunshine @ 2015-06-02 21:15 UTC (permalink / raw)
To: git; +Cc: Jeff King, Eric Sunshine
This series updates config.mak.uname to define HAVE_GETDELIM on Mac OS X
when appropriate, and adds a configure check for the same.
Changes since v1[1]:
patch 1/2 -- optimize OS X version recognition:
* Use `...` for 'expr' invocation to extract digits from $(uname_R),
thus only a fork(), rather than gmake $(shell...), which spawns via
fork()+exec().
* Use 'test' relational operator -ge rather than 'expr >=', along with
'echo' to compare version number. Since 'test' and 'echo' are
typically shell builtins, this should be faster than invoking 'expr' a
second time.
patch 2/2 -- unchanged
[1]: http://thread.gmane.org/gmane.comp.version-control.git/270576
Eric Sunshine (2):
config.mak.uname: Darwin: define HAVE_GETDELIM for modern OS X
releases
configure: add getdelim() check
config.mak.uname | 3 +++
configure.ac | 6 ++++++
2 files changed, 9 insertions(+)
--
2.4.2.598.gb4379f4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/2] config.mak.uname: Darwin: define HAVE_GETDELIM for modern OS X releases
2015-06-02 21:15 [PATCH v2 0/2] auto-detect getdelim() Eric Sunshine
@ 2015-06-02 21:15 ` Eric Sunshine
2015-06-02 21:15 ` [PATCH v2 2/2] configure: add getdelim() check Eric Sunshine
2015-06-03 4:35 ` [PATCH v2 0/2] auto-detect getdelim() Jeff King
2 siblings, 0 replies; 4+ messages in thread
From: Eric Sunshine @ 2015-06-02 21:15 UTC (permalink / raw)
To: git; +Cc: Jeff King, Eric Sunshine
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
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
---
config.mak.uname | 3 +++
1 file changed, 3 insertions(+)
diff --git a/config.mak.uname b/config.mak.uname
index d26665f..943c439 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 test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 11 && echo 1),1)
+ HAVE_GETDELIM = YesPlease
+ endif
NO_MEMMEM = YesPlease
USE_ST_TIMESPEC = YesPlease
HAVE_DEV_TTY = YesPlease
--
2.4.2.598.gb4379f4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] configure: add getdelim() check
2015-06-02 21:15 [PATCH v2 0/2] auto-detect getdelim() Eric Sunshine
2015-06-02 21:15 ` [PATCH v2 1/2] config.mak.uname: Darwin: define HAVE_GETDELIM for modern OS X releases Eric Sunshine
@ 2015-06-02 21:15 ` Eric Sunshine
2015-06-03 4:35 ` [PATCH v2 0/2] auto-detect getdelim() Jeff King
2 siblings, 0 replies; 4+ messages in thread
From: Eric Sunshine @ 2015-06-02 21:15 UTC (permalink / raw)
To: git; +Cc: Jeff King, Eric Sunshine
As an optimization, strbuf will take advantage of getdelim() if
available, so add a configure check which defines HAVE_GETDELIM if
found.
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
---
configure.ac | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/configure.ac b/configure.ac
index bbdde85..14012fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1041,6 +1041,12 @@ GIT_CHECK_FUNC(initgroups,
[NO_INITGROUPS=YesPlease])
GIT_CONF_SUBST([NO_INITGROUPS])
#
+# Define HAVE_GETDELIM if you have getdelim in the C library.
+GIT_CHECK_FUNC(getdelim,
+[HAVE_GETDELIM=YesPlease],
+[HAVE_GETDELIM=])
+GIT_CONF_SUBST([HAVE_GETDELIM])
+#
#
# Define NO_MMAP if you want to avoid mmap.
#
--
2.4.2.598.gb4379f4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 0/2] auto-detect getdelim()
2015-06-02 21:15 [PATCH v2 0/2] auto-detect getdelim() Eric Sunshine
2015-06-02 21:15 ` [PATCH v2 1/2] config.mak.uname: Darwin: define HAVE_GETDELIM for modern OS X releases Eric Sunshine
2015-06-02 21:15 ` [PATCH v2 2/2] configure: add getdelim() check Eric Sunshine
@ 2015-06-03 4:35 ` Jeff King
2 siblings, 0 replies; 4+ messages in thread
From: Jeff King @ 2015-06-03 4:35 UTC (permalink / raw)
To: Eric Sunshine; +Cc: git
On Tue, Jun 02, 2015 at 05:15:42PM -0400, Eric Sunshine wrote:
> This series updates config.mak.uname to define HAVE_GETDELIM on Mac OS X
> when appropriate, and adds a configure check for the same.
>
> Changes since v1[1]:
>
> patch 1/2 -- optimize OS X version recognition:
>
> * Use `...` for 'expr' invocation to extract digits from $(uname_R),
> thus only a fork(), rather than gmake $(shell...), which spawns via
> fork()+exec().
>
> * Use 'test' relational operator -ge rather than 'expr >=', along with
> 'echo' to compare version number. Since 'test' and 'echo' are
> typically shell builtins, this should be faster than invoking 'expr' a
> second time.
>
> patch 2/2 -- unchanged
Thanks, this version looks good to me.
-Peff
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-06-03 4:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-02 21:15 [PATCH v2 0/2] auto-detect getdelim() Eric Sunshine
2015-06-02 21:15 ` [PATCH v2 1/2] config.mak.uname: Darwin: define HAVE_GETDELIM for modern OS X releases Eric Sunshine
2015-06-02 21:15 ` [PATCH v2 2/2] configure: add getdelim() check Eric Sunshine
2015-06-03 4:35 ` [PATCH v2 0/2] auto-detect getdelim() Jeff King
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).