* [PATCH] make: By default, remove -pthread on Darwin (it is included by cstdlib).
@ 2009-01-26 16:26 Ted Pavlic
2009-01-26 16:33 ` [PATCH (update)] " Ted Pavlic
0 siblings, 1 reply; 5+ messages in thread
From: Ted Pavlic @ 2009-01-26 16:26 UTC (permalink / raw)
To: gitster; +Cc: git, Ted Pavlic
As discussed in
http://lists.apple.com/archives/Unix-porting/2005/Mar/msg00019.html
the Mac OS X C standard library is always thread safe and always
includes the pthread library. So explicitly using -pthread causes an
'unrecognized option' compiler warning.
This patch clears PTHREAD_LIBS by default. However, if
FORCE_DARWIN_PTHREAD_LIBS is defined, then PTHREAD_LIBS will be set as
before.
Signed-off-by: Ted Pavlic <ted@tedpavlic.com>
---
Makefile | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
index b4d9cb4..30764af 100644
--- a/Makefile
+++ b/Makefile
@@ -70,6 +70,15 @@ all::
# specify your own (or DarwinPort's) include directories and
# library directories by defining CFLAGS and LDFLAGS appropriately.
#
+#
+# Define FORCE_DARWIN_PTHREAD_LIBS if you are building on Darwin/Mac OS
+# X and want PTHREAD_LIBS to be set. On Mac OS X, all components of the
+# C standard library that are defined to be thread safe by the POSIX
+# standard already include the pthread library. Hence, the -pthread
+# option is redundant and will generate an 'unrecognized option'
+# warning. So PTHREAD_LIBS will be cleared unless
+# FORCE_DARWIN_PTHREAD_LIBS is set.
+#
# Define PPC_SHA1 environment variable when running make to make use of
# a bundled SHA1 routine optimized for PowerPC.
#
@@ -817,6 +826,9 @@ ifeq ($(uname_S),Darwin)
BASIC_LDFLAGS += -L/opt/local/lib
endif
endif
+ ifndef FORCE_DARWIN_PTHREAD_LIBS
+ PTHREAD_LIBS =
+ endif
endif
ifndef CC_LD_DYNPATH
--
1.6.1.213.g28da8
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH (update)] make: By default, remove -pthread on Darwin (it is included by cstdlib).
2009-01-26 16:26 [PATCH] make: By default, remove -pthread on Darwin (it is included by cstdlib) Ted Pavlic
@ 2009-01-26 16:33 ` Ted Pavlic
2009-01-26 17:47 ` Junio C Hamano
0 siblings, 1 reply; 5+ messages in thread
From: Ted Pavlic @ 2009-01-26 16:33 UTC (permalink / raw)
To: gitster; +Cc: git, Ted Pavlic
As discussed in
http://lists.apple.com/archives/Unix-porting/2005/Mar/msg00019.html
the Mac OS X C standard library is always thread safe and always
includes the pthread library. So explicitly using -pthread causes an
'unrecognized option' compiler warning.
This patch clears PTHREAD_LIBS by default. However, if
FORCE_DARWIN_PTHREAD_LIBS is defined, then PTHREAD_LIBS will be set as
before.
Signed-off-by: Ted Pavlic <ted@tedpavlic.com>
---
This update adds the documentation comment in the Makefile to
configure.ac as well.
Makefile | 11 +++++++++++
configure.ac | 8 ++++++++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
index b4d9cb4..86f0a66 100644
--- a/Makefile
+++ b/Makefile
@@ -70,6 +70,14 @@ all::
# specify your own (or DarwinPort's) include directories and
# library directories by defining CFLAGS and LDFLAGS appropriately.
#
+# Define FORCE_DARWIN_PTHREAD_LIBS if you are building on Darwin/Mac OS
+# X and want PTHREAD_LIBS to be set. On Mac OS X, all components of the
+# C standard library that are defined to be thread safe by the POSIX
+# standard already include the pthread library. Hence, the -pthread
+# option is redundant and will generate an 'unrecognized option'
+# warning. So PTHREAD_LIBS will be cleared unless
+# FORCE_DARWIN_PTHREAD_LIBS is set.
+#
# Define PPC_SHA1 environment variable when running make to make use of
# a bundled SHA1 routine optimized for PowerPC.
#
@@ -817,6 +825,9 @@ ifeq ($(uname_S),Darwin)
BASIC_LDFLAGS += -L/opt/local/lib
endif
endif
+ ifndef FORCE_DARWIN_PTHREAD_LIBS
+ PTHREAD_LIBS =
+ endif
endif
ifndef CC_LD_DYNPATH
diff --git a/configure.ac b/configure.ac
index 082a03d..a53d97c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -578,6 +578,14 @@ GIT_PARSE_WITH(expat))
# specify your own (or DarwinPort's) include directories and
# library directories by defining CFLAGS and LDFLAGS appropriately.
#
+# Define FORCE_DARWIN_PTHREAD_LIBS if you are building on Darwin/Mac OS
+# X and want PTHREAD_LIBS to be set. On Mac OS X, all components of the
+# C standard library that are defined to be thread safe by the POSIX
+# standard already include the pthread library. Hence, the -pthread
+# option is redundant and will generate an 'unrecognized option'
+# warning. So PTHREAD_LIBS will be cleared unless
+# FORCE_DARWIN_PTHREAD_LIBS is set.
+#
# Define NO_MMAP if you want to avoid mmap.
#
# Define NO_ICONV if your libc does not properly support iconv.
--
1.6.1.213.g28da8
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH (update)] make: By default, remove -pthread on Darwin (it is included by cstdlib).
2009-01-26 16:33 ` [PATCH (update)] " Ted Pavlic
@ 2009-01-26 17:47 ` Junio C Hamano
2009-01-26 18:57 ` Ted Pavlic
0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2009-01-26 17:47 UTC (permalink / raw)
To: Ted Pavlic; +Cc: gitster, git
Ted Pavlic <ted@tedpavlic.com> writes:
> As discussed in
>
> http://lists.apple.com/archives/Unix-porting/2005/Mar/msg00019.html
>
> the Mac OS X C standard library is always thread safe and always
> includes the pthread library. So explicitly using -pthread causes an
> 'unrecognized option' compiler warning.
>
> This patch clears PTHREAD_LIBS by default. However, if
> FORCE_DARWIN_PTHREAD_LIBS is defined, then PTHREAD_LIBS will be set as
> before.
Why is this even configurable? You explained pretty clearly that:
- With -pthread, you get an nasty warning;
- By default, we now do not use -pthread;
- By adding FORCE_DARWIN_PTHREAD_LIBS, you can still compile with
-pthread.
But the above leaves the reader wondering in what situation it may be
useful to use FORCE_* and for what purpose other than to get the nasty
warning back (which probably is not most users want to).
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH (update)] make: By default, remove -pthread on Darwin (it is included by cstdlib).
2009-01-26 17:47 ` Junio C Hamano
@ 2009-01-26 18:57 ` Ted Pavlic
2009-01-26 19:03 ` [PATCH] make: Remove " Ted Pavlic
0 siblings, 1 reply; 5+ messages in thread
From: Ted Pavlic @ 2009-01-26 18:57 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
...
>> This patch clears PTHREAD_LIBS by default. However, if
>> FORCE_DARWIN_PTHREAD_LIBS is defined, then PTHREAD_LIBS will be set as
>> before.
>
> Why is this even configurable? You explained pretty clearly that:
...
> But the above leaves the reader wondering in what situation it may be
> useful to use FORCE_* and for what purpose other than to get the nasty
> warning back (which probably is not most users want to).
I was afraid that there would be some strange situation where someone
would have a configuration where they might want pthreads turned on. I
suppose that if someone is in that specialized situation, they will be
able to customize their build environment on their own.
I will submit a new patch without the define.
Thanks --
Ted
--
Ted Pavlic <ted@tedpavlic.com>
Please visit my ALS association page:
http://web.alsa.org/goto/tedpavlic
My family appreciates your support in the fight to defeat ALS.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] make: Remove -pthread on Darwin (it is included by cstdlib).
2009-01-26 18:57 ` Ted Pavlic
@ 2009-01-26 19:03 ` Ted Pavlic
0 siblings, 0 replies; 5+ messages in thread
From: Ted Pavlic @ 2009-01-26 19:03 UTC (permalink / raw)
To: gitster; +Cc: git, Ted Pavlic
As discussed in
http://lists.apple.com/archives/Unix-porting/2005/Mar/msg00019.html
the Mac OS X C standard library is always thread safe and always
includes the pthread library. So explicitly using -pthread causes an
'unrecognized option' compiler warning.
This patch clears PTHREAD_LIBS if Darwin is detected.
Signed-off-by: Ted Pavlic <ted@tedpavlic.com>
---
Rather than simply clearing PTHREAD_LIBS, would it be better to filter
PTHREAD_LIBS to remove "-pthread" if detected?
Makefile | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
index b4d9cb4..9d451cf 100644
--- a/Makefile
+++ b/Makefile
@@ -817,6 +817,7 @@ ifeq ($(uname_S),Darwin)
BASIC_LDFLAGS += -L/opt/local/lib
endif
endif
+ PTHREAD_LIBS =
endif
ifndef CC_LD_DYNPATH
--
1.6.1.213.g28da8
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-01-26 19:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-26 16:26 [PATCH] make: By default, remove -pthread on Darwin (it is included by cstdlib) Ted Pavlic
2009-01-26 16:33 ` [PATCH (update)] " Ted Pavlic
2009-01-26 17:47 ` Junio C Hamano
2009-01-26 18:57 ` Ted Pavlic
2009-01-26 19:03 ` [PATCH] make: Remove " Ted Pavlic
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).