summaryrefslogtreecommitdiff
path: root/lang/ruby16/patches/patch-aa
blob: 9c8c5be3e5174fd6feaa4a7b94d7211da74a85d3 (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
$NetBSD: patch-aa,v 1.3 2005/01/21 16:36:41 tv Exp $

--- configure.in.orig	2002-11-13 13:59:18.000000000 -0500
+++ configure.in
@@ -264,6 +264,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"
 		AC_CACHE_CHECK([whether -lxpg4 has to be linked],
 		  rb_cv_lib_xpg4_needed,
@@ -324,7 +326,8 @@ AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS(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)
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_TYPE_UID_T
@@ -456,6 +459,49 @@ else
   AC_DEFINE_UNQUOTED(FILE_COUNT, $rb_cv_fcnt)
 fi
 
+if test "$enable_pthread" = "yes"; then
+   AC_CHECK_LIB(pthread, pthread_kill, 
+                rb_with_pthread=yes, rb_with_pthread=no)
+   if test "$rb_with_pthread" = "yes"; then
+      LIBS="-lpthread $LIBS"
+      AC_DEFINE(_REENTRANT)
+      AC_DEFINE(_THREAD_SAFE)
+      AC_DEFINE(HAVE_LIBPTHREAD)
+   else
+      AC_CHECK_LIB(pthreads, pthread_kill, 
+                   rb_with_pthread=yes, rb_with_pthread=no)
+      if test "$rb_with_pthread" = "yes"; then
+         LIBS="-lpthreads $LIBS"
+	 AC_DEFINE(_REENTRANT)
+	 AC_DEFINE(_THREAD_SAFE)
+	 AC_DEFINE(HAVE_LIBPTHREAD)
+      else
+         AC_CHECK_LIB(c, pthread_kill, 
+                      rb_with_pthread=yes, rb_with_pthread=no)
+         if test "$rb_with_pthread" = "yes"; then
+            AC_DEFINE(_REENTRANT)
+	    AC_DEFINE(_THREAD_SAFE)
+	    AC_DEFINE(HAVE_LIBPTHREAD)
+         else
+	    AC_CHECK_LIB(c_r, pthread_kill, 
+                         rb_with_pthread=yes, rb_with_pthread=no)
+	    if test "$rb_with_pthread" = "yes"; then
+	       AC_DEFINE(_REENTRANT)
+	       AC_DEFINE(_THREAD_SAFE)
+	       AC_DEFINE(HAVE_LIBPTHREAD)
+	       MAINLIBS="-pthread $MAINLIBS"
+	    else
+	       AC_MSG_WARN('Don\'t know how to find pthread library on your system -- thread support disabled')
+	    fi
+         fi
+      fi
+   fi
+   AC_CHECK_FUNC(nanosleep)
+   if test "$ac_cv_func_nanosleep" = "no"; then
+       AC_CHECK_LIB(rt, nanosleep, AC_DEFINE(HAVE_NANOSLEEP))
+   fi
+fi
+
 dnl default value for $KANJI
 DEFAULT_KCODE="KCODE_NONE"
 
@@ -549,6 +595,7 @@ if test "$with_dln_a_out" != yes; then
     cygwin*)	;;
     mingw*)	;;
     netbsd*) CCDLFLAGS=-fPIC;;
+    interix3*)	;;
     *) CCDLFLAGS=-fPIC;;
     esac
   else
@@ -563,7 +610,7 @@ if test "$with_dln_a_out" != yes; then
 
   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
@@ -578,7 +625,8 @@ if test "$with_dln_a_out" != yes; then
 			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;;
@@ -589,6 +637,12 @@ if test "$with_dln_a_out" != yes; then
 	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
@@ -601,8 +655,18 @@ if test "$with_dln_a_out" != yes; then
 	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
@@ -858,6 +922,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*)
@@ -879,6 +944,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)'
  	;;
@@ -1071,6 +1144,10 @@ if test "$search_path" != ""; then
     AC_DEFINE_UNQUOTED(RUBY_SEARCH_PATH,"$search_path")
 fi
 
+AC_ARG_ENABLE(pthread,
+       [--enable-pthread        use pthread library.],
+       [enable_pthread=$enableval], [enable_pthread=no])
+
 if test -f config.h && tr -d '\015' < confdefs.h | cmp -s config.h -; then
   echo "config.h unchanged"
 else