1 |
jsbronder 12/11/02 05:09:23 |
2 |
|
3 |
Added: configure-fix-pthread-linking.patch |
4 |
Log: |
5 |
Fix #371647, no response from maintainer since Oct 17. |
6 |
|
7 |
(Portage version: 2.1.11.30/cvs/Linux x86_64, signed Manifest commit with key 4D7043C9) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 dev-cpp/gtest/files/configure-fix-pthread-linking.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-cpp/gtest/files/configure-fix-pthread-linking.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-cpp/gtest/files/configure-fix-pthread-linking.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: configure-fix-pthread-linking.patch |
16 |
=================================================================== |
17 |
From fb71154012e634a5e780e93af5434bcdafaf2b24 Mon Sep 17 00:00:00 2001 |
18 |
From: Justin Bronder <jsbronder@×××××.com> |
19 |
Date: Mon, 15 Oct 2012 17:25:07 -0400 |
20 |
Subject: [PATCH] configure: fix pthread linking |
21 |
|
22 |
- Update the pthread check to make sure that we don't need -lpthread when |
23 |
compiling with -nostdlib. |
24 |
|
25 |
- Make sure that the necessary pthread library is passed to libtool. |
26 |
|
27 |
Fixes: |
28 |
|
29 |
$ ldd -r /usr/lib/libgtest.so |
30 |
linux-vdso.so.1 (0x00007fffe7dff000) |
31 |
libstdc++.so.6 => /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/libstdc++.so.6 (0x00007fbe09a9f000) |
32 |
libc.so.6 => /lib64/libc.so.6 (0x00007fbe096f7000) |
33 |
libgcc_s.so.1 => /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/libgcc_s.so.1 (0x00007fbe094e1000) |
34 |
libm.so.6 => /lib64/libm.so.6 (0x00007fbe091ee000) |
35 |
/lib64/ld-linux-x86-64.so.2 (0x00007fbe0a005000) |
36 |
undefined symbol: pthread_key_create (/usr/lib/libgtest.so) |
37 |
undefined symbol: pthread_getspecific (/usr/lib/libgtest.so) |
38 |
undefined symbol: pthread_key_delete (/usr/lib/libgtest.so) |
39 |
undefined symbol: pthread_setspecific (/usr/lib/libgtest.so) |
40 |
--- |
41 |
Makefile.am | 1 + |
42 |
m4/acx_pthread.m4 | 39 ++++++++++++++++++++++++++++++++++++++- |
43 |
2 files changed, 39 insertions(+), 1 deletions(-) |
44 |
|
45 |
diff --git a/Makefile.am b/Makefile.am |
46 |
index cb350b7..db2606e 100644 |
47 |
--- a/Makefile.am |
48 |
+++ b/Makefile.am |
49 |
@@ -181,6 +181,7 @@ endif |
50 |
lib_LTLIBRARIES = lib/libgtest.la lib/libgtest_main.la |
51 |
|
52 |
lib_libgtest_la_SOURCES = src/gtest-all.cc |
53 |
+lib_libgtest_la_LIBADD = $(AM_LIBS) |
54 |
|
55 |
pkginclude_HEADERS = \ |
56 |
include/gtest/gtest-death-test.h \ |
57 |
diff --git a/m4/acx_pthread.m4 b/m4/acx_pthread.m4 |
58 |
index 2cf20de..7fba4d9 100644 |
59 |
--- a/m4/acx_pthread.m4 |
60 |
+++ b/m4/acx_pthread.m4 |
61 |
@@ -339,7 +339,44 @@ if test "x$acx_pthread_ok" = xyes; then |
62 |
# so it's not safe to assume that we may use pthreads |
63 |
acx_pthread_ok=no |
64 |
fi |
65 |
- |
66 |
+ |
67 |
+ AC_MSG_CHECKING([whether what we have so far is sufficient with -nostdlib]) |
68 |
+ CFLAGS="-nostdlib $CFLAGS" |
69 |
+ # we need c with nostdlib |
70 |
+ LIBS="$LIBS -lc" |
71 |
+ AC_TRY_LINK([#include <pthread.h>], |
72 |
+ [pthread_t th; pthread_join(th, 0); |
73 |
+ pthread_attr_init(0); pthread_cleanup_push(0, 0); |
74 |
+ pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], |
75 |
+ [done=yes],[done=no]) |
76 |
+ |
77 |
+ if test "x$done" = xyes; then |
78 |
+ AC_MSG_RESULT([yes]) |
79 |
+ else |
80 |
+ AC_MSG_RESULT([no]) |
81 |
+ fi |
82 |
+ |
83 |
+ if test x"$done" = xno; then |
84 |
+ AC_MSG_CHECKING([whether -lpthread saves the day]) |
85 |
+ LIBS="-lpthread $LIBS" |
86 |
+ AC_TRY_LINK([#include <pthread.h>], |
87 |
+ [pthread_t th; pthread_join(th, 0); |
88 |
+ pthread_attr_init(0); pthread_cleanup_push(0, 0); |
89 |
+ pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], |
90 |
+ [done=yes],[done=no]) |
91 |
+ |
92 |
+ if test "x$done" = xyes; then |
93 |
+ AC_MSG_RESULT([yes]) |
94 |
+ PTHREAD_LIBS="$PTHREAD_LIBS -lpthread" |
95 |
+ else |
96 |
+ AC_MSG_RESULT([no]) |
97 |
+ AC_MSG_WARN([Impossible to determine how to use pthreads with shared libraries and -nostdlib]) |
98 |
+ fi |
99 |
+ fi |
100 |
+ |
101 |
+ CFLAGS="$save_CFLAGS" |
102 |
+ LIBS="$save_LIBS" |
103 |
+ CC="$save_CC" |
104 |
CFLAGS="$save_CFLAGS" |
105 |
LIBS="$save_LIBS" |
106 |
CC="$save_CC" |
107 |
-- |
108 |
1.7.8.6 |