{"thread":{"id":"17374","subject":"[PATCH] make: By default, remove -pthread on Darwin (it is included by cstdlib).","startedAt":"2009-01-26T16:26:00Z","lastAt":"2009-01-26T19:03:59Z","messageCount":5,"participants":["Ted Pavlic","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"101998","messageId":"1232987160-5635-1-git-send-email-ted@tedpavlic.com","threadId":"17374","inReplyTo":null,"subject":"[PATCH] make: By default, remove -pthread on Darwin (it is included by cstdlib).","fromName":"Ted Pavlic","fromEmail":"ted@tedpavlic.com","sentAt":"2009-01-26T16:26:00Z","receivedAt":"2009-01-26T16:26:00Z","isPatch":true,"sender":{"key":"ted@tedpavlic.com","avatar":"https://gravatar.com/avatar/d085392370ff4c028cf17a0e81e0647744c9682fbcb36b499f31d08ef80ef569?d=mp&s=160"},"body":"As discussed in\n\nhttp://lists.apple.com/archives/Unix-porting/2005/Mar/msg00019.html\n\nthe Mac OS X C standard library is always thread safe and always\nincludes the pthread library. So explicitly using -pthread causes an\n'unrecognized option' compiler warning.\n\nThis patch clears PTHREAD_LIBS by default. However, if\nFORCE_DARWIN_PTHREAD_LIBS is defined, then PTHREAD_LIBS will be set as\nbefore.\n\nSigned-off-by: Ted Pavlic <ted@tedpavlic.com>\n---\n Makefile |   12 ++++++++++++\n 1 files changed, 12 insertions(+), 0 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex b4d9cb4..30764af 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -70,6 +70,15 @@ all::\n # specify your own (or DarwinPort's) include directories and\n # library directories by defining CFLAGS and LDFLAGS appropriately.\n #\n+#\n+# Define FORCE_DARWIN_PTHREAD_LIBS if you are building on Darwin/Mac OS\n+# X and want PTHREAD_LIBS to be set. On Mac OS X, all components of the\n+# C standard library that are defined to be thread safe by the POSIX\n+# standard already include the pthread library. Hence, the -pthread\n+# option is redundant and will generate an 'unrecognized option'\n+# warning. So PTHREAD_LIBS will be cleared unless\n+# FORCE_DARWIN_PTHREAD_LIBS is set.\n+#\n # Define PPC_SHA1 environment variable when running make to make use of\n # a bundled SHA1 routine optimized for PowerPC.\n #\n@@ -817,6 +826,9 @@ ifeq ($(uname_S),Darwin)\n \t\t\tBASIC_LDFLAGS += -L/opt/local/lib\n \t\tendif\n \tendif\n+\tifndef FORCE_DARWIN_PTHREAD_LIBS\n+\t\tPTHREAD_LIBS =\n+\tendif\n endif\n \n ifndef CC_LD_DYNPATH\n-- \n1.6.1.213.g28da8\n"},{"id":"102003","messageId":"1232987609-6229-1-git-send-email-ted@tedpavlic.com","threadId":"17374","inReplyTo":"1232987160-5635-1-git-send-email-ted@tedpavlic.com","subject":"[PATCH (update)] make: By default, remove -pthread on Darwin (it is included by cstdlib).","fromName":"Ted Pavlic","fromEmail":"ted@tedpavlic.com","sentAt":"2009-01-26T16:33:29Z","receivedAt":"2009-01-26T16:33:29Z","isPatch":true,"sender":{"key":"ted@tedpavlic.com","avatar":"https://gravatar.com/avatar/d085392370ff4c028cf17a0e81e0647744c9682fbcb36b499f31d08ef80ef569?d=mp&s=160"},"body":"As discussed in\n\nhttp://lists.apple.com/archives/Unix-porting/2005/Mar/msg00019.html\n\nthe Mac OS X C standard library is always thread safe and always\nincludes the pthread library. So explicitly using -pthread causes an\n'unrecognized option' compiler warning.\n\nThis patch clears PTHREAD_LIBS by default. However, if\nFORCE_DARWIN_PTHREAD_LIBS is defined, then PTHREAD_LIBS will be set as\nbefore.\n\nSigned-off-by: Ted Pavlic <ted@tedpavlic.com>\n---\n\nThis update adds the documentation comment in the Makefile to\nconfigure.ac as well.\n\n Makefile     |   11 +++++++++++\n configure.ac |    8 ++++++++\n 2 files changed, 19 insertions(+), 0 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex b4d9cb4..86f0a66 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -70,6 +70,14 @@ all::\n # specify your own (or DarwinPort's) include directories and\n # library directories by defining CFLAGS and LDFLAGS appropriately.\n #\n+# Define FORCE_DARWIN_PTHREAD_LIBS if you are building on Darwin/Mac OS\n+# X and want PTHREAD_LIBS to be set. On Mac OS X, all components of the\n+# C standard library that are defined to be thread safe by the POSIX\n+# standard already include the pthread library. Hence, the -pthread\n+# option is redundant and will generate an 'unrecognized option'\n+# warning. So PTHREAD_LIBS will be cleared unless\n+# FORCE_DARWIN_PTHREAD_LIBS is set.\n+#\n # Define PPC_SHA1 environment variable when running make to make use of\n # a bundled SHA1 routine optimized for PowerPC.\n #\n@@ -817,6 +825,9 @@ ifeq ($(uname_S),Darwin)\n \t\t\tBASIC_LDFLAGS += -L/opt/local/lib\n \t\tendif\n \tendif\n+\tifndef FORCE_DARWIN_PTHREAD_LIBS\n+\t\tPTHREAD_LIBS =\n+\tendif\n endif\n \n ifndef CC_LD_DYNPATH\ndiff --git a/configure.ac b/configure.ac\nindex 082a03d..a53d97c 100644\n--- a/configure.ac\n+++ b/configure.ac\n@@ -578,6 +578,14 @@ GIT_PARSE_WITH(expat))\n # specify your own (or DarwinPort's) include directories and\n # library directories by defining CFLAGS and LDFLAGS appropriately.\n #\n+# Define FORCE_DARWIN_PTHREAD_LIBS if you are building on Darwin/Mac OS\n+# X and want PTHREAD_LIBS to be set. On Mac OS X, all components of the\n+# C standard library that are defined to be thread safe by the POSIX\n+# standard already include the pthread library. Hence, the -pthread\n+# option is redundant and will generate an 'unrecognized option'\n+# warning. So PTHREAD_LIBS will be cleared unless\n+# FORCE_DARWIN_PTHREAD_LIBS is set.\n+#\n # Define NO_MMAP if you want to avoid mmap.\n #\n # Define NO_ICONV if your libc does not properly support iconv.\n-- \n1.6.1.213.g28da8\n"},{"id":"102014","messageId":"7vr62q6jtp.fsf@gitster.siamese.dyndns.org","threadId":"17374","inReplyTo":"1232987609-6229-1-git-send-email-ted@tedpavlic.com","subject":"Re: [PATCH (update)] make: By default, remove -pthread on Darwin (it is included by cstdlib).","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-26T17:47:14Z","receivedAt":"2009-01-26T17:47:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ted Pavlic <ted@tedpavlic.com> writes:\n\n> As discussed in\n>\n> http://lists.apple.com/archives/Unix-porting/2005/Mar/msg00019.html\n>\n> the Mac OS X C standard library is always thread safe and always\n> includes the pthread library. So explicitly using -pthread causes an\n> 'unrecognized option' compiler warning.\n>\n> This patch clears PTHREAD_LIBS by default. However, if\n> FORCE_DARWIN_PTHREAD_LIBS is defined, then PTHREAD_LIBS will be set as\n> before.\n\nWhy is this even configurable?  You explained pretty clearly that:\n\n - With -pthread, you get an nasty warning;\n - By default, we now do not use -pthread;\n - By adding FORCE_DARWIN_PTHREAD_LIBS, you can still compile with\n   -pthread.\n\nBut the above leaves the reader wondering in what situation it may be\nuseful to use FORCE_* and for what purpose other than to get the nasty\nwarning back (which probably is not most users want to).\n"},{"id":"102019","messageId":"497E079C.7090303@tedpavlic.com","threadId":"17374","inReplyTo":"7vr62q6jtp.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH (update)] make: By default, remove -pthread on Darwin (it is included by cstdlib).","fromName":"Ted Pavlic","fromEmail":"ted@tedpavlic.com","sentAt":"2009-01-26T18:57:32Z","receivedAt":"2009-01-26T18:57:32Z","isPatch":true,"sender":{"key":"ted@tedpavlic.com","avatar":"https://gravatar.com/avatar/d085392370ff4c028cf17a0e81e0647744c9682fbcb36b499f31d08ef80ef569?d=mp&s=160"},"body":"...\n>> This patch clears PTHREAD_LIBS by default. However, if\n>> FORCE_DARWIN_PTHREAD_LIBS is defined, then PTHREAD_LIBS will be set as\n>> before.\n>\n> Why is this even configurable?  You explained pretty clearly that:\n...\n> But the above leaves the reader wondering in what situation it may be\n> useful to use FORCE_* and for what purpose other than to get the nasty\n> warning back (which probably is not most users want to).\n\nI was afraid that there would be some strange situation where someone \nwould have a configuration where they might want pthreads turned on. I \nsuppose that if someone is in that specialized situation, they will be \nable to customize their build environment on their own.\n\nI will submit a new patch without the define.\n\nThanks --\nTed\n\n-- \nTed Pavlic <ted@tedpavlic.com>\n\n   Please visit my ALS association page:\n         http://web.alsa.org/goto/tedpavlic\n   My family appreciates your support in the fight to defeat ALS.\n"},{"id":"102022","messageId":"1232996639-12450-1-git-send-email-ted@tedpavlic.com","threadId":"17374","inReplyTo":"497E079C.7090303@tedpavlic.com","subject":"[PATCH] make: Remove -pthread on Darwin (it is included by cstdlib).","fromName":"Ted Pavlic","fromEmail":"ted@tedpavlic.com","sentAt":"2009-01-26T19:03:59Z","receivedAt":"2009-01-26T19:03:59Z","isPatch":true,"sender":{"key":"ted@tedpavlic.com","avatar":"https://gravatar.com/avatar/d085392370ff4c028cf17a0e81e0647744c9682fbcb36b499f31d08ef80ef569?d=mp&s=160"},"body":"As discussed in\n\nhttp://lists.apple.com/archives/Unix-porting/2005/Mar/msg00019.html\n\nthe Mac OS X C standard library is always thread safe and always\nincludes the pthread library. So explicitly using -pthread causes an\n'unrecognized option' compiler warning.\n\nThis patch clears PTHREAD_LIBS if Darwin is detected.\n\nSigned-off-by: Ted Pavlic <ted@tedpavlic.com>\n---\n\nRather than simply clearing PTHREAD_LIBS, would it be better to filter\nPTHREAD_LIBS to remove \"-pthread\" if detected?\n\n Makefile |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex b4d9cb4..9d451cf 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -817,6 +817,7 @@ ifeq ($(uname_S),Darwin)\n \t\t\tBASIC_LDFLAGS += -L/opt/local/lib\n \t\tendif\n \tendif\n+\tPTHREAD_LIBS =\n endif\n \n ifndef CC_LD_DYNPATH\n-- \n1.6.1.213.g28da8\n"}]}