git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH (update)] make: By default, remove -pthread on Darwin (it is included by cstdlib).

From
Ted Pavlic <ted@tedpavlic.com>
Date
Jan 26, 2009, 16:33 UTC
Message-ID
<1232987609-6229-1-git-send-email-ted@tedpavlic.com>
In-Reply-To
<1232987160-5635-1-git-send-email-ted@tedpavlic.com>
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
Previous: Ted PavlicNext: Junio C Hamano
Message 2 of 5 in “make: By default, remove -pthread on Darwin (it is included by cstdlib).”
  1. make: By default, remove -pthread on Darwin (it is included by cstdlib).Ted Pavlic, Jan 26, 2009
  2. make: By default, remove -pthread on Darwin (it is included by cstdlib).Ted Pavlic, Jan 26, 2009
  3. Junio C HamanoJan 26, 2009
  4. Ted PavlicJan 26, 2009
  5. make: Remove -pthread on Darwin (it is included by cstdlib).Ted Pavlic, Jan 26, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.