Gentoo Archives: gentoo-commits

From: "Markos Chandras (hwoarang)" <hwoarang@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-libs/rb_libtorrent/files: rb_libtorrent-0.15.1-ax_pthread_asneeded.patch
Date: Thu, 01 Jul 2010 08:32:28
Message-Id: 20100701083226.097FF2C096@corvid.gentoo.org
1 hwoarang 10/07/01 08:32:25
2
3 Added: rb_libtorrent-0.15.1-ax_pthread_asneeded.patch
4 Log:
5 Version bump.Fixes bug #325313. Remove old configure options. FIx pthread linking
6 (Portage version: 2.2_rc67/cvs/Linux x86_64)
7
8 Revision Changes Path
9 1.1 net-libs/rb_libtorrent/files/rb_libtorrent-0.15.1-ax_pthread_asneeded.patch
10
11 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-libs/rb_libtorrent/files/rb_libtorrent-0.15.1-ax_pthread_asneeded.patch?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-libs/rb_libtorrent/files/rb_libtorrent-0.15.1-ax_pthread_asneeded.patch?rev=1.1&content-type=text/plain
13
14 Index: rb_libtorrent-0.15.1-ax_pthread_asneeded.patch
15 ===================================================================
16 http://bugs.gentoo.org/247067
17
18 --- m4/ax_pthread.m4
19 +++ m4/ax_pthread.m4
20 @@ -266,6 +266,117 @@
21 else
22 PTHREAD_CC=$CC
23 fi
24 +
25 + # The next part tries to detect GCC inconsistency with -shared on some
26 + # architectures and systems. The problem is that in certain
27 + # configurations, when -shared is specified, GCC "forgets" to
28 + # internally use various flags which are still necessary.
29 +
30 + #
31 + # Prepare the flags
32 + #
33 + save_LDFLAGS="$LDFLAGS"
34 + save_CFLAGS="$CFLAGS"
35 + save_LIBS="$LIBS"
36 + save_CC="$CC"
37 +
38 + # Try with the flags determined by the earlier checks.
39 + #
40 + # -Wl,-z,defs forces link-time symbol resolution, so that the
41 + # linking checks with -shared actually have any value
42 + #
43 + # FIXME: -fPIC is required for -shared on many architectures,
44 + # so we specify it here, but the right way would probably be to
45 + # properly detect whether it is actually required.
46 + CFLAGS="-shared -fPIC -Wl,-z,defs $CFLAGS $PTHREAD_CFLAGS"
47 + LIBS="$PTHREAD_LIBS $LIBS"
48 + CC="$PTHREAD_CC"
49 +
50 + # In order not to create several levels of indentation, we test
51 + # the value of "$done" until we find the cure or run out of ideas.
52 + done="no"
53 +
54 + # First, make sure the CFLAGS we added are actually accepted by our
55 + # compiler. If not (and OS X's ld, for instance, does not accept -z),
56 + # then we can't do this test.
57 + if test x"$done" = xno; then
58 + AC_MSG_CHECKING([whether to check for GCC pthread/shared inconsistencies])
59 + AC_TRY_LINK(,, , [done=yes])
60 +
61 + if test "x$done" = xyes ; then
62 + AC_MSG_RESULT([no])
63 + else
64 + AC_MSG_RESULT([yes])
65 + fi
66 + fi
67 +
68 + if test x"$done" = xyes; then
69 + done="no"
70 + AC_MSG_CHECKING([whether -pthread is sufficient with -shared])
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])
76 +
77 + if test "x$done" = xyes; then
78 + AC_MSG_RESULT([yes])
79 + else
80 + AC_MSG_RESULT([no])
81 + fi
82 + fi
83 +
84 + #
85 + # Linux gcc on some architectures such as mips/mipsel forgets
86 + # about -lpthread
87 + #
88 + if test x"$done" = xno; then
89 + AC_MSG_CHECKING([whether -lpthread fixes that])
90 + LIBS="-lpthread $PTHREAD_LIBS $save_LIBS"
91 + AC_TRY_LINK([#include <pthread.h>],
92 + [pthread_t th; pthread_join(th, 0);
93 + pthread_attr_init(0); pthread_cleanup_push(0, 0);
94 + pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
95 + [done=yes])
96 +
97 + if test "x$done" = xyes; then
98 + AC_MSG_RESULT([yes])
99 + PTHREAD_LIBS="-lpthread $PTHREAD_LIBS"
100 + else
101 + AC_MSG_RESULT([no])
102 + fi
103 + fi
104 + #
105 + # FreeBSD 4.10 gcc forgets to use -lc_r instead of -lc
106 + #
107 + if test x"$done" = xno; then
108 + AC_MSG_CHECKING([whether -lc_r fixes that])
109 + LIBS="-lc_r $PTHREAD_LIBS $save_LIBS"
110 + AC_TRY_LINK([#include <pthread.h>],
111 + [pthread_t th; pthread_join(th, 0);
112 + pthread_attr_init(0); pthread_cleanup_push(0, 0);
113 + pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
114 + [done=yes])
115 +
116 + if test "x$done" = xyes; then
117 + AC_MSG_RESULT([yes])
118 + PTHREAD_LIBS="-lc_r $PTHREAD_LIBS"
119 + else
120 + AC_MSG_RESULT([no])
121 + fi
122 + fi
123 + if test x"$done" = xno; then
124 + # OK, we have run out of ideas
125 + AC_MSG_WARN([Impossible to determine how to use pthreads with shared libraries])
126 +
127 + # so it's not safe to assume that we may use pthreads
128 + acx_pthread_ok=no
129 + fi
130 +
131 + CFLAGS="$save_CFLAGS"
132 + LIBS="$save_LIBS"
133 + CC="$save_CC"
134 +
135 else
136 PTHREAD_CC="$CC"
137 fi