summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--configure.in49
2 files changed, 48 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 0ea4d62730..e31192f4af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Sat Nov 8 13:49:50 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * configure.in: improvement of pthread check
+
Sat Nov 8 13:28:46 2003 Takaaki Tateishi <ttate@ttsky.net>
* ext/dl/sym.c: Add DL.win32_last_error and DL.last_error.
Thanks, Kaoru Shirai.
diff --git a/configure.in b/configure.in
index 2f66c572d7..c662e3fee4 100644
--- a/configure.in
+++ b/configure.in
@@ -321,11 +321,11 @@ freebsd*) LIBS="-lm $LIBS"
rb_cv_supplementary_lib_c_r=yes,
rb_cv_supplementary_lib_c_r=yes)])
if test "$rb_cv_supplementary_lib_c_r" = yes; then
- MAINLIBS="-lc_r $MAINLIBS"
+ MAINLIBS="-lc_r $MAINLIBS"
else
AC_DEFINE(HAVE_LIBPTHREAD)
- MAINLIBS="-pthread $MAINLIBS"
- CFLAGS="-D_THREAD_SAFE $CFLAGS"
+ MAINLIBS="-pthread $MAINLIBS"
+ CFLAGS="-D_THREAD_SAFE -D_REENTRANT $CFLAGS"
fi
fi
;;
@@ -667,8 +667,47 @@ DEFAULT_KCODE="KCODE_NONE"
AC_ARG_WITH(pthread-ext,
[ --with-pthread-ext use pthread library on external modules ],
- [AC_CHECK_LIB(pthread, pthread_mutex_trylock)
- AC_DEFINE(USE_PTHREAD_EXTLIB)])
+ [AC_DEFINE(USE_PTHREAD_EXTLIB)
+ AC_CHECK_LIB(pthread, pthread_mutex_init,
+ rb_use_pthread_ext=yes, rb_use_pthread_ext=no)
+ if test "$rb_use_pthread_ext" = "no"; then
+ AC_CHECK_LIB(pthread, __pthread_mutex_init,
+ rb_use_pthread_ext=yes, rb_use_pthread_ext=no)
+ fi
+ if test "$rb_use_pthread_ext" = "yes"; then
+ LIBS="-lpthread $LIBS"
+ AC_DEFINE(_REENTRANT)
+ AC_DEFINE(_THREAD_SAFE)
+ AC_DEFINE(HAVE_LIBPTHREAD)
+ else
+ AC_CHECK_LIB(pthreads, pthread_mutex_init,
+ rb_use_pthread_ext=yes, rb_use_pthread_ext=no)
+ if test "$rb_use_pthread_ext" = "yes"; then
+ LIBS="-lpthreads $LIBS"
+ AC_DEFINE(_REENTRANT)
+ AC_DEFINE(_THREAD_SAFE)
+ AC_DEFINE(HAVE_LIBPTHREAD)
+ else
+ AC_CHECK_LIB(c_r, pthread_mutex_init,
+ rb_use_pthread_ext=yes, rb_use_pthread_ext=no)
+ if test "$rb_use_pthread_ext" = "yes"; then
+ if test "$with_libc_r" = "yes"; then
+ if test "$rb_cv_supplementary_lib_c_r" = "yes"; then
+ AC_DEFINE(_REENTRANT)
+ AC_DEFINE(_THREAD_SAFE)
+ AC_DEFINE(HAVE_LIBPTHREAD)
+ MAINLIBS="-pthread $MAINLIBS"
+ fi
+ else
+ MAINLIBS="-pthread $MAINLIBS"
+ AC_DEFINE(_REENTRANT)
+ AC_DEFINE(_THREAD_SAFE)
+ AC_DEFINE(HAVE_LIBPTHREAD)
+ fi
+ fi
+ fi
+ fi
+ ])
AC_ARG_WITH(default-kcode,
[ --with-default-kcode=CODE specify default value for \$KCODE (utf8|euc|sjis|none)],