summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-08 04:53:14 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-08 04:53:14 +0000
commit1ef5d9d44356ea8d704936039cba1535d3760730 (patch)
treeedf21260aabb50dfecf131bde37d0788980bf56d /configure.in
parent0f8d55fa98c37fb2b0925620c10fd305f63acd84 (diff)
* configure.in: improvement of pthread check
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in49
1 files changed, 44 insertions, 5 deletions
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)],