(gaih_inet): Little code cleanup. Move variable h into gethosts macro.
[glibc.git] / linuxthreads / README.Xfree3.2
blobac08e15832466dd4d3e0449826d01c0f7ac6b8df
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
9 whole XFree86 source.
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 &
17 tail -f 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/
41 and create some links
43 cd /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 ----------------------------------------------------------------------------
60 XF3.2.xc.diff:
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
65 @@ -61,6 +61,14 @@
66  #define HasSnprintf            YES
67  #endif
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
80 @@ -158,7 +166,7 @@
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
92 @@ -19,7 +19,7 @@
94  #define CplusplusLibC
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)
108 -#ifdef _DECTHREADS_
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
122 @@ -73,7 +73,7 @@
123      register char c;
124      int first;
125      int best_max_rehash;
126 -    int best_z;
127 +    int best_z = 0;
128      int num_found;
129      KeySym val;
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
134 @@ -25,7 +25,7 @@
135        DEFINES = $(ALLOC_DEFINES)
136       INCLUDES = 
137           SRCS = $(STUBSRCS)
138 -         OBJS = $(STUBOBJS
139 +         OBJS = $(STUBOBJS)
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
146 @@ -37,16 +37,43 @@
147   * specificies the thread library on the link line.
148   */
150 +#if defined(linux)
151 +#include <pthread.h>
152 +#else
153  #include <thread.h>
154  #include <synch.h>
155 +#endif
157 +#if defined(linux)
158 +static pthread_t no_thread_id;
159 +#endif /* defined(linux) */
161 +#if defined(linux)
162 +#pragma weak pthread_self = _Xthr_self_stub_
163 +pthread_t 
164 +_Xthr_self_stub_()
166 +    return(no_thread_id);
168 +#else /* defined(linux) */
169  #pragma weak thr_self = _Xthr_self_stub_
170  thread_t 
171  _Xthr_self_stub_()
173      return((thread_t)0);
175 +#endif /* defined(linux) */
177 +#if defined(linux)
178 +#pragma weak pthread_mutex_init = _Xmutex_init_stub_
179 +int 
180 +_Xmutex_init_stub_(m, a)
181 +    pthread_mutex_t *m;
182 +    __const pthread_mutexattr_t *a;
184 +    return(0);
186 +#else /* defined(linux) */
187  #pragma weak mutex_init = _Xmutex_init_stub_
188  int 
189  _Xmutex_init_stub_(m, t, a)
190 @@ -56,7 +83,17 @@
192      return(0);
194 +#endif /* defined(linux) */
196 +#if defined(linux)
197 +#pragma weak pthread_mutex_destroy = _Xmutex_destroy_stub_
198 +int
199 +_Xmutex_destroy_stub_(m)
200 +    pthread_mutex_t *m;
202 +    return(0);
204 +#else /* defined(linux) */
205  #pragma weak mutex_destroy = _Xmutex_destroy_stub_
206  int
207  _Xmutex_destroy_stub_(m)
208 @@ -64,7 +101,17 @@
210      return(0);
212 +#endif /* defined(linux) */
214 +#if defined(linux)
215 +#pragma weak pthread_mutex_lock = _Xmutex_lock_stub_
216 +int
217 +_Xmutex_lock_stub_(m)
218 +    pthread_mutex_t *m;
220 +    return(0);
222 +#else /* defined(linux) */
223  #pragma weak mutex_lock = _Xmutex_lock_stub_
224  int
225  _Xmutex_lock_stub_(m)
226 @@ -72,7 +119,17 @@
228      return(0);
230 +#endif /* defined(linux) */
232 +#if defined(linux)
233 +#pragma weak pthread_mutex_unlock = _Xmutex_unlock_stub_
234 +int
235 +_Xmutex_unlock_stub_(m)
236 +    pthread_mutex_t *m;
238 +    return(0);
240 +#else /* defined(linux) */
241  #pragma weak mutex_unlock = _Xmutex_unlock_stub_
242  int
243  _Xmutex_unlock_stub_(m)
244 @@ -80,7 +137,18 @@
246      return(0);
248 +#endif /* defined(linux) */
250 +#if defined(linux)
251 +#pragma weak  pthread_cond_init = _Xcond_init_stub_
252 +int 
253 +_Xcond_init_stub_(c, a)
254 +    pthread_cond_t *c;
255 +    __const pthread_condattr_t *a;
257 +    return(0);
259 +#else /* defined(linux) */
260  #pragma weak cond_init = _Xcond_init_stub_
261  int 
262  _Xcond_init_stub_(c, t, a)
263 @@ -90,7 +158,17 @@
265      return(0);
267 +#endif /* defined(linux) */
269 +#if defined(linux)
270 +#pragma weak pthread_cond_destroy = _Xcond_destroy_stub_
271 +int
272 +_Xcond_destroy_stub_(c)
273 +    pthread_cond_t *c;
275 +    return(0);
277 +#else /* defined(linux) */
278  #pragma weak cond_destroy = _Xcond_destroy_stub_
279  int
280  _Xcond_destroy_stub_(c)
281 @@ -98,7 +176,18 @@
283      return(0);
285 +#endif /* defined(linux) */
287 +#if defined(linux)
288 +#pragma weak pthread_cond_wait = _Xcond_wait_stub_
289 +int
290 +_Xcond_wait_stub_(c,m)
291 +    pthread_cond_t *c;
292 +    pthread_mutex_t *m;
294 +    return(0);
296 +#else /* defined(linux) */
297  #pragma weak cond_wait = _Xcond_wait_stub_
298  int
299  _Xcond_wait_stub_(c,m)
300 @@ -107,7 +196,17 @@
302      return(0);
304 +#endif /* defined(linux) */
306 +#if defined(linux)
307 +#pragma weak pthread_cond_signal = _Xcond_signal_stub_
308 +int
309 +_Xcond_signal_stub_(c)
310 +    pthread_cond_t *c;
312 +    return(0);
314 +#else /* defined(linux) */
315  #pragma weak cond_signal = _Xcond_signal_stub_
316  int
317  _Xcond_signal_stub_(c)
318 @@ -115,7 +214,17 @@
320      return(0);
322 +#endif /* defined(linux) */
324 +#if defined(linux)
325 +#pragma weak pthread_cond_broadcast = _Xcond_broadcast_stub_
326 +int
327 +_Xcond_broadcast_stub_(c)
328 +    pthread_cond_t *c;
330 +    return(0);
332 +#else /* defined(linux) */
333  #pragma weak cond_broadcast = _Xcond_broadcast_stub_
334  int
335  _Xcond_broadcast_stub_(c)
336 @@ -123,3 +232,15 @@
338      return(0);
340 +#endif /* defined(linux) */
342 +#if defined(linux)
343 +#pragma weak pthread_equal = _Xthr_equal_stub_
344 +int
345 +_Xthr_equal_stub_(t1, t2)
346 +    pthread_t t1;
347 +    pthread_t t2;
349 +    return(1);
351 +#endif /* defined(linux) */
352 -------------------------------------------------------------------------