summaryrefslogtreecommitdiff
path: root/lang/ruby16-base/patches/patch-ab
blob: e325eb7715093f47f1ab0f6c7b1712e87606fb84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
$NetBSD: patch-ab,v 1.1.1.1 2005/03/06 16:36:08 taca Exp $

--- configure.orig	2002-11-19 06:49:26.000000000 -0500
+++ configure
@@ -29,6 +29,8 @@ ac_help="$ac_help
 --with-sitedir=DIR        site libraries in DIR [PREFIX/lib/ruby/site_ruby]"
 ac_help="$ac_help
 --with-search-path=DIR	  specify the additional search path"
+ac_help="$ac_help
+--enable-pthread        use pthread library."
 
 # Initialize some variables set by options.
 # The variables have the same names as the options, with
@@ -2324,6 +2326,8 @@ os2_emx*)	LIBS="-lm $LIBS"
 		ac_cv_lib_dir_opendir=no;;
 msdosdjgpp*)	LIBS="-lm $LIBS"
 		ac_cv_func_getpgrp_void=yes;;
+interix3*)	LIBS="-lm $LIBS"
+		ac_cv_func_getpgrp_void=yes;;
 freebsd*)	LIBS="-lm $LIBS"
 		echo $ac_n "checking whether -lxpg4 has to be linked""... $ac_c" 1>&6
 echo "configure:2330: checking whether -lxpg4 has to be linked" >&5
@@ -2877,7 +2881,8 @@ fi
 
 for ac_hdr in stdlib.h string.h unistd.h limits.h sys/file.h sys/ioctl.h\
 		 fcntl.h sys/fcntl.h sys/select.h sys/time.h sys/times.h sys/param.h\
-		 syscall.h pwd.h a.out.h utime.h memory.h direct.h sys/resource.h
+		 syscall.h pwd.h a.out.h utime.h memory.h direct.h sys/resource.h\
+		 pthread.h ucontext.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
@@ -4387,6 +4392,330 @@ EOF
 
 fi
 
+if test "$enable_pthread" = "yes"; then
+   echo $ac_n "checking for pthread_kill in -lpthread""... $ac_c" 1>&6
+echo "configure:4388: checking for pthread_kill in -lpthread" >&5
+ac_lib_var=`echo pthread'_'pthread_kill | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lpthread  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 4396 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char pthread_kill();
+
+int main() {
+pthread_kill()
+; return 0; }
+EOF
+if { (eval echo configure:4407: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  rb_with_pthread=yes
+else
+  echo "$ac_t""no" 1>&6
+rb_with_pthread=no
+fi
+
+   if test "$rb_with_pthread" = "yes"; then
+      LIBS="-lpthread $LIBS"
+      cat >> confdefs.h <<\EOF
+#define _REENTRANT 1
+EOF
+
+      cat >> confdefs.h <<\EOF
+#define _THREAD_SAFE 1
+EOF
+
+      cat >> confdefs.h <<\EOF
+#define HAVE_LIBPTHREAD 1
+EOF
+
+   else
+      echo $ac_n "checking for pthread_kill in -lpthreads""... $ac_c" 1>&6
+echo "configure:4444: checking for pthread_kill in -lpthreads" >&5
+ac_lib_var=`echo pthreads'_'pthread_kill | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lpthreads  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 4452 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char pthread_kill();
+
+int main() {
+pthread_kill()
+; return 0; }
+EOF
+if { (eval echo configure:4463: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  rb_with_pthread=yes
+else
+  echo "$ac_t""no" 1>&6
+rb_with_pthread=no
+fi
+
+      if test "$rb_with_pthread" = "yes"; then
+         LIBS="-lpthreads $LIBS"
+	 cat >> confdefs.h <<\EOF
+#define _REENTRANT 1
+EOF
+
+	 cat >> confdefs.h <<\EOF
+#define _THREAD_SAFE 1
+EOF
+
+	 cat >> confdefs.h <<\EOF
+#define HAVE_LIBPTHREAD 1
+EOF
+
+      else
+         echo $ac_n "checking for pthread_kill in -lc""... $ac_c" 1>&6
+echo "configure:4500: checking for pthread_kill in -lc" >&5
+ac_lib_var=`echo c'_'pthread_kill | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lc  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 4508 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char pthread_kill();
+
+int main() {
+pthread_kill()
+; return 0; }
+EOF
+if { (eval echo configure:4519: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  rb_with_pthread=yes
+else
+  echo "$ac_t""no" 1>&6
+rb_with_pthread=no
+fi
+
+         if test "$rb_with_pthread" = "yes"; then
+            cat >> confdefs.h <<\EOF
+#define _REENTRANT 1
+EOF
+
+	    cat >> confdefs.h <<\EOF
+#define _THREAD_SAFE 1
+EOF
+
+	    cat >> confdefs.h <<\EOF
+#define HAVE_LIBPTHREAD 1
+EOF
+
+         else
+	    echo $ac_n "checking for pthread_kill in -lc_r""... $ac_c" 1>&6
+echo "configure:4555: checking for pthread_kill in -lc_r" >&5
+ac_lib_var=`echo c_r'_'pthread_kill | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lc_r  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 4563 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char pthread_kill();
+
+int main() {
+pthread_kill()
+; return 0; }
+EOF
+if { (eval echo configure:4574: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  rb_with_pthread=yes
+else
+  echo "$ac_t""no" 1>&6
+rb_with_pthread=no
+fi
+
+	    if test "$rb_with_pthread" = "yes"; then
+	       cat >> confdefs.h <<\EOF
+#define _REENTRANT 1
+EOF
+
+	       cat >> confdefs.h <<\EOF
+#define _THREAD_SAFE 1
+EOF
+
+	       cat >> confdefs.h <<\EOF
+#define HAVE_LIBPTHREAD 1
+EOF
+
+	       MAINLIBS="-pthread $MAINLIBS"
+	    else
+	       echo "configure: warning: 'Don\'t know how to find pthread library on your system -- thread support disabled'" 1>&2
+	    fi
+         fi
+      fi
+   fi
+   echo $ac_n "checking for nanosleep""... $ac_c" 1>&6
+echo "configure:4616: checking for nanosleep" >&5
+if eval "test \"`echo '$''{'ac_cv_func_nanosleep'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 4621 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char nanosleep(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char nanosleep();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_nanosleep) || defined (__stub___nanosleep)
+choke me
+#else
+nanosleep();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:4644: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_nanosleep=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_nanosleep=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'nanosleep`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  :
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+   if test "$ac_cv_func_nanosleep" = "no"; then
+       echo $ac_n "checking for nanosleep in -lrt""... $ac_c" 1>&6
+echo "configure:4665: checking for nanosleep in -lrt" >&5
+ac_lib_var=`echo rt'_'nanosleep | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lrt  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 4673 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char nanosleep();
+
+int main() {
+nanosleep()
+; return 0; }
+EOF
+if { (eval echo configure:4684: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_NANOSLEEP 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+   fi
+fi
+
 DEFAULT_KCODE="KCODE_NONE"
 
 # Check whether --with-default-kcode or --without-default-kcode was given.
@@ -4510,6 +4839,7 @@ echo "configure:4501: checking whether O
     cygwin*)	;;
     mingw*)	;;
     netbsd*) CCDLFLAGS=-fPIC;;
+    interix3*)	;;
     *) CCDLFLAGS=-fPIC;;
     esac
   else
@@ -4524,7 +4854,7 @@ echo "configure:4501: checking whether O
 
   case "$target_os" in
 	hpux*)		DLDFLAGS="-E"
-			LDSHARED='ld -b'
+			LDSHARED="ld -b $LDSHARED"
 			LDFLAGS="-Wl,-E"
 			rb_cv_dlopen=yes;;
 	solaris*) 	if test "$GCC" = yes; then
@@ -4539,7 +4869,8 @@ echo "configure:4501: checking whether O
 			rb_cv_dlopen=yes;;
 	sunos*) 	LDSHARED='ld -assert nodefinitions'
 			rb_cv_dlopen=yes;;
-	irix*)		LDSHARED='ld -shared'
+	irix*)		LDSHARED='ld -shared -L${X11BASE}/lib${ABI}'
+			LDFLAGS="-L${X11BASE}/lib${ABI} ${LDFLAGS}"
 			rb_cv_dlopen=yes;;
 	sysv4*) 	LDSHARED='ld -G'
 			rb_cv_dlopen=yes;;
@@ -4550,6 +4881,12 @@ echo "configure:4501: checking whether O
 	osf*) 		LDSHARED="$CC -shared"
 			rb_cv_dlopen=yes ;;
 	linux*) 	LDSHARED="$CC -shared"
+			if test "$rb_cv_binary_elf" = yes; then
+			    LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
+			    DLDFLAGS="$DLDFLAGS "'-Wl,-soname,$(.TARGET)'
+			    LIBPATHFLAG=' -L%1$-s'
+			    RPATHFLAG=' -Wl,-R%1$-s'
+			fi
 			rb_cv_dlopen=yes ;;
 	freebsd*)       LDSHARED="$CC -shared"
 			if test "$rb_cv_binary_elf" = yes; then
@@ -4562,8 +4899,18 @@ echo "configure:4501: checking whether O
 	netbsd*)	LDSHARED='${CC} -shared'
 			if test "$rb_cv_binary_elf" = yes; then
 			    LDFLAGS="-Wl,-export-dynamic"
+			    DLDFLAGS="$DLDFLAGS "'-Wl,-soname,$(.TARGET)'
+			    LIBPATHFLAG=' -L%1$-s'
+			    RPATHFLAG=' -Wl,-R%1$-s'
 			fi
 			rb_cv_dlopen=yes ;;
+	interix3*)	LDSHARED='${CC} -shared'
+			LDFLAGS="-Wl,-E"
+			# use special random-slot linkage in 0x[56]XXXXXXX
+			DLDFLAGS="$DLDFLAGS "'-Wl,-h,$(.TARGET) -Wl,--image-base,$$(($$RANDOM %4096/2*262144+1342177280))'
+			LIBPATHFLAG=' -L%1$-s'
+			RPATHFLAG=' -Wl,-R%1$-s'
+			rb_cv_dlopen=yes ;;
 	openbsd*) 	LDSHARED="ld -Bforcearchive -Bshareable"
 			rb_cv_dlopen=yes ;;
 	bsdi3*) 	case "$CC" in
@@ -5070,6 +5417,7 @@ if test "$enable_shared" = 'yes'; then
 	;;
     linux*)
 	LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR)'
+	LIBRUBYARG_SHARED='-Wl,-R -Wl,${libdir} -L${libdir} -L. -l$(RUBY_SO_NAME)'
 	LIBRUBY_ALIASES='lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_INSTALL_NAME).so'
 	;;
     freebsd*)
@@ -5091,6 +5439,14 @@ if test "$enable_shared" = 'yes'; then
 	   LIBRUBY_ALIASES=""
 	fi
  	;;
+    interix3*)
+	SOLIBS='$(LIBS)'
+	LIBRUBY_SO='lib$(RUBY_INSTALL_NAME).so.$(MAJOR)$(MINOR).$(TEENY)'
+	# link explicitly to 0x48000000
+	LIBRUBY_DLDFLAGS='-Wl,-h,lib$(RUBY_INSTALL_NAME).so.$(MAJOR)$(MINOR) -Wl,--image-base,1207959552'
+	LIBRUBYARG='-Wl,-R -Wl,${prefix}/lib -L${prefix}/lib -L. -l$(RUBY_INSTALL_NAME)'
+	LIBRUBY_ALIASES='lib$(RUBY_INSTALL_NAME).so.$(MAJOR)$(MINOR) lib$(RUBY_INSTALL_NAME).so'
+ 	;;
     openbsd*)
 	SOLIBS='$(LIBS)'
  	;;
@@ -5315,6 +5671,15 @@ EOF
 
 fi
 
+# Check whether --enable-pthread or --disable-pthread was given.
+if test "${enable_pthread+set}" = set; then
+  enableval="$enable_pthread"
+  enable_pthread=$enableval
+else
+  enable_pthread=no
+fi
+
+
 if test -f config.h && tr -d '\015' < confdefs.h | cmp -s config.h -; then
   echo "config.h unchanged"
 else