1 This file describes how to make a threaded X11R6.
3 You need the source-code of XFree-3.2. I used the sources of X11R6.1
4 (files: xc-1.tar.gz xc-2.tar.gz xc-3.tar.gz) and the patches to
5 XFree-3.2 (files: README.X11.patch R6.1pl1-3.2.diff.gz cfont32.tgz).
7 Untar the xc-?.tar.gz files in a directory called XF3.2 and apply
8 the XFree-3.2 patches as described in README.X11.patch or use the
11 Now apply the thread patch with
13 patch -p0 < XF3.2.xc.diff
15 Go to the XF3.2/xc directory and make the whole thing:
16 nice make World >& world.log &
19 Wait a few hours or interrupt the process after the shared libs
20 are made. The shared libs are:
22 XF3.2/xc/lib/ICE/libICE.so.6.0*
23 XF3.2/xc/lib/PEX5/libPEX5.so.6.0*
24 XF3.2/xc/lib/SM/libSM.so.6.0*
25 XF3.2/xc/lib/X11/libX11.so.6.1*
26 XF3.2/xc/lib/XIE/libXIE.so.6.0*
27 XF3.2/xc/lib/XThrStub/libXThrStub.so.6.0*
28 XF3.2/xc/lib/Xaw/libXaw.so.6.1*
29 XF3.2/xc/lib/Xext/libXext.so.6.1*
30 XF3.2/xc/lib/Xi/libXi.so.6.0*
31 XF3.2/xc/lib/Xmu/libXmu.so.6.0*
32 XF3.2/xc/lib/Xt/libXt.so.6.0*
33 XF3.2/xc/lib/Xtst/libXtst.so.6.1*
35 (The Program dga didn't compile, but I have not check out why.)
37 Now you can copy the resulting libs
39 cp XF3.2/xc/lib/*/*.so.?.? /usr/X11R6/lib/
44 ln -s libXThrStub.so.6.0 libXThrStub.so.6
45 ln -s libXThrStub.so.6 libXThrStub.so
47 or use make install (not tested, and needs new configuration).
49 It is possible with the libXThrSub to compile X11 programs without linking
50 libpthread to them and not necessary to recompile already installed
51 unthreaded X11 programs, because libXThrSub keeps the dynamic linker quit.
52 On the other hand you can link libpthread to a X11 program to use threads.
54 I used linux 2.0.23 and libc 5.4.7 .
56 Hans-Helmut Bühmann hans@expmech.ing.tu-bs.de
58 ----------------------------------------------------------------------------
61 -----------------------------------------------------------------------------
62 diff -u --recursive XF3.2.orig/xc/config/cf/linux.cf XF3.2/xc/config/cf/linux.cf
63 --- XF3.2.orig/xc/config/cf/linux.cf Sun Nov 10 17:05:30 1996
64 +++ XF3.2/xc/config/cf/linux.cf Sun Nov 10 16:30:55 1996
66 #define HasSnprintf YES
69 +#define HasPosixThreads YES
70 +#define ThreadedX YES
71 +#define BuildThreadStubLibrary YES
72 +#define NeedUIThrStubs YES
73 +#define HasThreadSafeAPI NO
74 +#define SystemMTDefines -D_REENTRANT
75 +#define ThreadsLibraries -lpthread
77 #define AvoidNullMakeCommand YES
78 #define StripInstalledPrograms YES
79 #define CompressAllFonts YES
81 #define LdPostLib /* Never needed */
83 #ifdef i386Architecture
84 -#define OptimizedCDebugFlags DefaultGcc2i386Opt -m486
85 +#define OptimizedCDebugFlags DefaultGcc2i386Opt -m486 -pipe
86 #define StandardDefines -Dlinux -D__i386__ -D_POSIX_SOURCE \
87 -D_BSD_SOURCE -D_SVID_SOURCE -DX_LOCALE
88 #define XawI18nDefines -DUSE_XWCHAR_STRING -DUSE_XMBTOWC
89 diff -u --recursive XF3.2.orig/xc/config/cf/lnxLib.tmpl XF3.2/xc/config/cf/lnxLib.tmpl
90 --- XF3.2.orig/xc/config/cf/lnxLib.tmpl Sun Nov 10 17:05:30 1996
91 +++ XF3.2/xc/config/cf/lnxLib.tmpl Sat Nov 9 14:52:39 1996
96 -#define SharedX11Reqs
97 +#define SharedX11Reqs -L$(BUILDLIBDIR) -lXThrStub
98 #define SharedOldXReqs $(LDPRELIB) $(XLIBONLY)
99 #define SharedXtReqs $(LDPRELIB) $(XLIBONLY) $(SMLIB) $(ICELIB)
100 #define SharedXawReqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
101 diff -u --recursive XF3.2.orig/xc/include/Xthreads.h XF3.2/xc/include/Xthreads.h
102 --- XF3.2.orig/xc/include/Xthreads.h Thu Dec 7 02:19:09 1995
103 +++ XF3.2/xc/include/Xthreads.h Sat Nov 9 01:04:55 1996
104 @@ -229,12 +229,12 @@
105 #define xcondition_wait(c,m) pthread_cond_wait(c,m)
106 #define xcondition_signal(c) pthread_cond_signal(c)
107 #define xcondition_broadcast(c) pthread_cond_broadcast(c)
109 +#if defined(_DECTHREADS_) || defined(linux)
110 static xthread_t _X_no_thread_id;
111 #define xthread_have_id(id) !pthread_equal(id, _X_no_thread_id)
112 #define xthread_clear_id(id) id = _X_no_thread_id
113 #define xthread_equal(id1,id2) pthread_equal(id1, id2)
114 -#endif /* _DECTHREADS_ */
115 +#endif /* _DECTHREADS_ || linux */
116 #if _CMA_VENDOR_ == _CMA__IBM
117 #ifdef DEBUG /* too much of a hack to enable normally */
118 /* see also cma__obj_set_name() */
119 diff -u --recursive XF3.2.orig/xc/lib/X11/util/makekeys.c XF3.2/xc/lib/X11/util/makekeys.c
120 --- XF3.2.orig/xc/lib/X11/util/makekeys.c Mon Apr 18 02:22:22 1994
121 +++ XF3.2/xc/lib/X11/util/makekeys.c Sat Nov 9 00:44:14 1996
131 diff -u --recursive XF3.2.orig/xc/lib/XThrStub/Imakefile XF3.2/xc/lib/XThrStub/Imakefile
132 --- XF3.2.orig/xc/lib/XThrStub/Imakefile Sun Nov 10 17:08:12 1996
133 +++ XF3.2/xc/lib/XThrStub/Imakefile Sat Nov 9 19:04:51 1996
135 DEFINES = $(ALLOC_DEFINES)
140 LINTLIBS = $(LINTXLIB)
142 #include <Library.tmpl>
143 diff -u --recursive XF3.2.orig/xc/lib/XThrStub/UIThrStubs.c XF3.2/xc/lib/XThrStub/UIThrStubs.c
144 --- XF3.2.orig/xc/lib/XThrStub/UIThrStubs.c Sun Nov 10 17:08:12 1996
145 +++ XF3.2/xc/lib/XThrStub/UIThrStubs.c Sun Nov 10 15:14:55 1996
147 * specificies the thread library on the link line.
151 +#include <pthread.h>
158 +static pthread_t no_thread_id;
159 +#endif /* defined(linux) */
162 +#pragma weak pthread_self = _Xthr_self_stub_
166 + return(no_thread_id);
168 +#else /* defined(linux) */
169 #pragma weak thr_self = _Xthr_self_stub_
175 +#endif /* defined(linux) */
178 +#pragma weak pthread_mutex_init = _Xmutex_init_stub_
180 +_Xmutex_init_stub_(m, a)
181 + pthread_mutex_t *m;
182 + __const pthread_mutexattr_t *a;
186 +#else /* defined(linux) */
187 #pragma weak mutex_init = _Xmutex_init_stub_
189 _Xmutex_init_stub_(m, t, a)
194 +#endif /* defined(linux) */
197 +#pragma weak pthread_mutex_destroy = _Xmutex_destroy_stub_
199 +_Xmutex_destroy_stub_(m)
200 + pthread_mutex_t *m;
204 +#else /* defined(linux) */
205 #pragma weak mutex_destroy = _Xmutex_destroy_stub_
207 _Xmutex_destroy_stub_(m)
212 +#endif /* defined(linux) */
215 +#pragma weak pthread_mutex_lock = _Xmutex_lock_stub_
217 +_Xmutex_lock_stub_(m)
218 + pthread_mutex_t *m;
222 +#else /* defined(linux) */
223 #pragma weak mutex_lock = _Xmutex_lock_stub_
225 _Xmutex_lock_stub_(m)
230 +#endif /* defined(linux) */
233 +#pragma weak pthread_mutex_unlock = _Xmutex_unlock_stub_
235 +_Xmutex_unlock_stub_(m)
236 + pthread_mutex_t *m;
240 +#else /* defined(linux) */
241 #pragma weak mutex_unlock = _Xmutex_unlock_stub_
243 _Xmutex_unlock_stub_(m)
248 +#endif /* defined(linux) */
251 +#pragma weak pthread_cond_init = _Xcond_init_stub_
253 +_Xcond_init_stub_(c, a)
255 + __const pthread_condattr_t *a;
259 +#else /* defined(linux) */
260 #pragma weak cond_init = _Xcond_init_stub_
262 _Xcond_init_stub_(c, t, a)
267 +#endif /* defined(linux) */
270 +#pragma weak pthread_cond_destroy = _Xcond_destroy_stub_
272 +_Xcond_destroy_stub_(c)
277 +#else /* defined(linux) */
278 #pragma weak cond_destroy = _Xcond_destroy_stub_
280 _Xcond_destroy_stub_(c)
285 +#endif /* defined(linux) */
288 +#pragma weak pthread_cond_wait = _Xcond_wait_stub_
290 +_Xcond_wait_stub_(c,m)
292 + pthread_mutex_t *m;
296 +#else /* defined(linux) */
297 #pragma weak cond_wait = _Xcond_wait_stub_
299 _Xcond_wait_stub_(c,m)
304 +#endif /* defined(linux) */
307 +#pragma weak pthread_cond_signal = _Xcond_signal_stub_
309 +_Xcond_signal_stub_(c)
314 +#else /* defined(linux) */
315 #pragma weak cond_signal = _Xcond_signal_stub_
317 _Xcond_signal_stub_(c)
322 +#endif /* defined(linux) */
325 +#pragma weak pthread_cond_broadcast = _Xcond_broadcast_stub_
327 +_Xcond_broadcast_stub_(c)
332 +#else /* defined(linux) */
333 #pragma weak cond_broadcast = _Xcond_broadcast_stub_
335 _Xcond_broadcast_stub_(c)
340 +#endif /* defined(linux) */
343 +#pragma weak pthread_equal = _Xthr_equal_stub_
345 +_Xthr_equal_stub_(t1, t2)
351 +#endif /* defined(linux) */
352 -------------------------------------------------------------------------