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
|
$NetBSD: patch-aa,v 1.1.1.1 2004/11/27 14:14:05 taca Exp $
--- configure.in.orig 2002-11-14 03:59:18.000000000 +0900
+++ configure.in
@@ -324,7 +324,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 +457,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"
@@ -563,7 +607,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 +622,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 +634,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,6 +652,9 @@ 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 ;;
openbsd*) LDSHARED="ld -Bforcearchive -Bshareable"
@@ -858,6 +912,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*)
@@ -1071,6 +1126,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
|