From 536f65bbf6b444a34423e3fc38300123925629d6 Mon Sep 17 00:00:00 2001
From: echristo <echristo@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed, 5 Jul 2006 17:32:41 +0000
Subject: [PATCH] 2006-07-05  Eric Christopher  <echristo@apple.com>

        * configure.ac: Depend addition of -pthread on host OS.
        * configure: Regenerate.



git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@115205 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog    | 11 ++++++++---
 libgomp/configure    | 11 +++++++++--
 libgomp/configure.ac | 11 +++++++++--
 3 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 8cd5519f404d..bd63f3db772d 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,8 @@
+2006-07-05  Eric Christopher  <echristo@apple.com>
+
+	* configure.ac: Depend addition of -pthread on host OS.
+	* configure: Regenerate.
+
 2006-06-21  Jakub Jelinek  <jakub@redhat.com>
 
 	* critical.c (GOMP_critical_name_start): Fix *pptr initialization
@@ -154,7 +159,7 @@
 
 	PR libgomp/25936
 	* configure.tgt: Link against -lrt for sem_init on HPUX v11 systems.
- 
+
 2006-02-08  Ulrich Weigand  <uweigand@de.ibm.com>
 
 	* testsuite/lib/libgomp-dg.exp: Load scanrtl.exp library.
@@ -982,7 +987,7 @@
 	* configure.tgt (x86_64-linux): Also test CC for -m32.
 	* config/linux/x86_64/futex.h (futex_wait): Fix r10 usage.
 
-	* testsuite/lib/libgomp-dg.exp (libgomp_link_flags): Add / 
+	* testsuite/lib/libgomp-dg.exp (libgomp_link_flags): Add /
 	after $gccpath.
 
 	* Makefile.am (SUBDIRS): New.
@@ -1078,7 +1083,7 @@
 
 	* iter.c (gomp_iter_runtime_next_locked): Remove.
 	* loop.c (gomp_loop_static_start, gomp_loop_dynamic_start,
-	gomp_loop_guided_start, gomp_loop_ordered_static_start, 
+	gomp_loop_guided_start, gomp_loop_ordered_static_start,
 	gomp_loop_ordered_dynamic_start, gomp_loop_ordered_guided_start,
 	gomp_loop_static_next, gomp_loop_dynamic_next, gomp_loop_guided_next,
 	gomp_loop_ordered_static_next, gomp_loop_ordered_dynamic_next,
diff --git a/libgomp/configure b/libgomp/configure
index 058b81b8486e..28e3c998a369 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -8296,7 +8296,8 @@ fi
 # Check to see if -pthread or -lpthread is needed.  Prefer the former.
 # In case the pthread.h system header is not found, this test will fail.
 XPCFLAGS=""
-CFLAGS="$CFLAGS -pthread"
+
+# Darwin doesn't need the -pthread option since threads are in libSystem
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -8335,7 +8336,13 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  XPCFLAGS=" -Wc,-pthread"
+  case $host in
+   *-darwin*)
+     ;;
+   default)
+     XPCFLAGS=" -Wc,-pthread"
+     ;;
+     esac
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index f653b70422d5..5d11982b157a 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -145,13 +145,20 @@ GCC_HEADER_STDINT(gstdint.h)
 # Check to see if -pthread or -lpthread is needed.  Prefer the former.
 # In case the pthread.h system header is not found, this test will fail.
 XPCFLAGS=""
-CFLAGS="$CFLAGS -pthread"
+
+# Darwin doesn't need the -pthread option since threads are in libSystem
 AC_LINK_IFELSE(
  [AC_LANG_PROGRAM(
   [#include <pthread.h>
    void *g(void *d) { return NULL; }],
   [pthread_t t; pthread_create(&t,NULL,g,NULL);])],
- [XPCFLAGS=" -Wc,-pthread"],
+ [case $host in
+   *-darwin*)
+     ;;
+   default)
+     XPCFLAGS=" -Wc,-pthread"
+     ;;
+     esac],
  [CFLAGS="$save_CFLAGS" LIBS="-lpthread $LIBS"
   AC_LINK_IFELSE(
    [AC_LANG_PROGRAM(
-- 
GitLab