永井@知能.九工大です. From: matz / ruby-lang.org (Yukihiro Matsumoto) Subject: [ruby-dev:22003] Re: purge pthread at configure Date: Sat, 22 Nov 2003 21:21:06 +0900 Message-ID: <1069503661.215948.14910.nullmailer / picachu.netlab.jp> > In message "[ruby-dev:22000] purge pthread at configure" > on 03/11/22, "U.Nakamura" <usa / osb.att.ne.jp> writes: > |例のpthread関連の対応が入った後、私の手元のNetBSD/i386-current > |な環境ではmake testが通らなくなりました。 > |いろいろ試してみたところ、-lpthreadを外せば問題はないというこ > |とがわかりました。 > Linuxでもときどき発生します。どうやら、-lpthreadが指定されて > いると実行そのものがひとつのスレッドの中で行われ、スレッドに > 割り当てられているスタック領域はgetrlimitで得られる限界より > もはるかに小さくなるということのようです。 はぁ...なかなかうまくいかないものですね...(;_;) From: "U.Nakamura" <usa / osb.att.ne.jp> Subject: [ruby-dev:22002] Re: purge pthread at configure Date: Sat, 22 Nov 2003 21:13:41 +0900 Message-ID: <20031122210924.FAFF.USA / osb.att.ne.jp> > で、この問題のデバッグはそれはそれでやりますが(というかやって > ますが)、どっちにしろ、pthreadを外すオプションはあってしかる > べきだと思います。 こんなもんでしょうか? Index: configure.in =================================================================== RCS file: /src/ruby/configure.in,v retrieving revision 1.195 diff -u -r1.195 configure.in --- configure.in 22 Nov 2003 03:59:17 -0000 1.195 +++ configure.in 22 Nov 2003 13:26:27 -0000 @@ -265,6 +265,10 @@ *) with_libc_r=no;; esac], [with_libc_r=no]) +AC_ARG_ENABLE(pthread, + [ --enable-pthread use pthread library [--enable-pthread].], + [enable_pthread=$enableval], [enable_pthread=yes]) + dnl Checks for libraries. case "$target_os" in nextstep*) ;; @@ -318,7 +322,7 @@ if test "$rb_cv_lib_xpg4_needed" = yes; then AC_CHECK_LIB(xpg4, setlocale) fi - if test "$with_libc_r" = yes; then + if test "$with_libc_r" = yes -a "$enable_pthread" = 'yes'; then AC_CACHE_CHECK([whether libc_r is supplementary to libc], rb_cv_supplementary_lib_c_r, [AC_TRY_CPP([ @@ -672,52 +676,54 @@ ], rb_cv_stack_grow_dir=-1, rb_cv_stack_grow_dir=+1, rb_cv_stack_grow_dir=0)]) AC_DEFINE_UNQUOTED(STACK_GROW_DIRECTION, $rb_cv_stack_grow_dir) -AC_CHECK_LIB(pthread, pthread_mutex_init, - rb_with_pthread=yes, rb_with_pthread=no) -if test "$rb_with_pthread" = "no"; then - AC_CHECK_LIB(pthread, __pthread_mutex_init, - rb_with_pthread=yes, rb_with_pthread=no) -fi -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_mutex_init, +if test "$enable_pthread" = "yes"; then + AC_CHECK_LIB(pthread, pthread_mutex_init, rb_with_pthread=yes, rb_with_pthread=no) + if test "$rb_with_pthread" = "no"; then + AC_CHECK_LIB(pthread, __pthread_mutex_init, + rb_with_pthread=yes, rb_with_pthread=no) + fi if test "$rb_with_pthread" = "yes"; then - LIBS="-lpthreads $LIBS" + LIBS="-lpthread $LIBS" AC_DEFINE(_REENTRANT) AC_DEFINE(_THREAD_SAFE) AC_DEFINE(HAVE_LIBPTHREAD) else - AC_CHECK_LIB(c, pthread_mutex_init, + AC_CHECK_LIB(pthreads, pthread_mutex_init, rb_with_pthread=yes, rb_with_pthread=no) if test "$rb_with_pthread" = "yes"; then - AC_DEFINE(_REENTRANT) + LIBS="-lpthreads $LIBS" + AC_DEFINE(_REENTRANT) AC_DEFINE(_THREAD_SAFE) AC_DEFINE(HAVE_LIBPTHREAD) else - AC_CHECK_LIB(c_r, pthread_mutex_init, + AC_CHECK_LIB(c, pthread_mutex_init, rb_with_pthread=yes, rb_with_pthread=no) - if test "$rb_with_pthread" = "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" + 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_mutex_init, + rb_with_pthread=yes, rb_with_pthread=no) + if test "$rb_with_pthread" = "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 else - MAINLIBS="-pthread $MAINLIBS" - AC_DEFINE(_REENTRANT) - AC_DEFINE(_THREAD_SAFE) - AC_DEFINE(HAVE_LIBPTHREAD) + AC_MSG_WARN("Don't know how to find pthread library on your system -- thread support disabled") fi - else - AC_MSG_WARN("Don't know how to find pthread library on your system -- thread support disabled") - fi + fi fi fi fi -- 永井 秀利 (九工大 知能情報) nagai / ai.kyutech.ac.jp