[前][次][番号順一覧][スレッド一覧]

ruby-changes:6050

From: nobu <ko1@a...>
Date: Tue, 24 Jun 2008 17:21:18 +0900 (JST)
Subject: [ruby-changes:6050] Ruby:r17559 (trunk, mvm): * configure.in (rb_cv_fork_with_pthread): check after check for

nobu	2008-06-24 17:20:42 +0900 (Tue, 24 Jun 2008)

  New Revision: 17559

  Modified files:
    branches/mvm/ChangeLog
    branches/mvm/configure.in
    trunk/ChangeLog
    trunk/configure.in

  Log:
    * configure.in (rb_cv_fork_with_pthread): check after check for
      pthread library, and define the macro when checked only.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=17559&r2=17558&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/mvm/ChangeLog?r1=17559&r2=17558&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/mvm/configure.in?r1=17559&r2=17558&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/configure.in?r1=17559&r2=17558&diff_format=u

Index: configure.in
===================================================================
--- configure.in	(revision 17558)
+++ configure.in	(revision 17559)
@@ -766,64 +766,6 @@
 AC_DEFINE_UNQUOTED([RUBY_LONGJMP(env,val)], [${setjmp_prefix}longjmp(env,val)])
 AC_DEFINE_UNQUOTED(RUBY_JMP_BUF, ${setjmp_sigmask+${setjmp_prefix}}jmp_buf)
 
-
-case $target_os in
-*bsd*|darwin*)
-AC_CACHE_CHECK([if fork works with pthread], rb_cv_fork_with_pthread,
-[AC_TRY_RUN([
-#include <stdlib.h>
-#include <unistd.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <signal.h>
-
-void *
-thread_func(void *dmy)
-{
-    return dmy;
-}
-
-void *use_threads(void)
-{
-    pthread_t tid;
-    if (pthread_create(&tid, 0, thread_func, 0) != 0) {
-	exit(1);
-    }
-    if (pthread_join(tid, 0) != 0) {
-	exit(1);
-    }
-}
-
-int
-main(int argc, char *argv[])
-{
-    pid_t pid;
-    use_threads();
-    pid = fork();
-
-    if (pid) {
-	int loc;
-	sleep(1);
-	if (waitpid(pid, &loc, WNOHANG) == 0) {
-	    kill(pid, SIGKILL);
-	    return 1;
-	}
-    }
-    else {
-	use_threads();
-    }
-
-    return 0;
-}]
-	rb_cv_fork_with_pthread=yes,
-	rb_cv_fork_with_pthread=no,
-	rb_cv_fork_with_pthread=yes)])
-    ;;
-esac
-test x$rb_cv_fork_with_pthread = xyes || AC_DEFINE(CANNOT_FORK_WITH_PTHREAD)
-
 AC_ARG_ENABLE(setreuid,
        [  --enable-setreuid       use setreuid()/setregid() according to need even if obsolete.],
        [use_setreuid=$enableval])
@@ -1161,6 +1103,69 @@
     fi
 fi
 
+if test "$ac_cv_func_fork" = "yes" -a "$rb_with_pthread" = "yes"; then
+    AC_CACHE_CHECK([if fork works with pthread], rb_cv_fork_with_pthread,
+	[AC_TRY_RUN([
+#include <stdlib.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <signal.h>
+#ifndef EXIT_SUCCESS
+#define EXIT_SUCCESS 0
+#endif
+#ifndef EXIT_FAILURE
+#define EXIT_FAILURE 1
+#endif
+
+void *
+thread_func(void *dmy)
+{
+    return dmy;
+}
+
+int
+use_threads(void)
+{
+    pthread_t tid;
+    if (pthread_create(&tid, 0, thread_func, 0) != 0) {
+	return -1;
+    }
+    if (pthread_join(tid, 0) != 0) {
+	return -1;
+    }
+    return 0;
+}
+
+int
+main(int argc, char *argv[])
+{
+    pid_t pid;
+    if (use_threads()) return EXIT_FAILURE;
+    pid = fork();
+
+    if (pid) {
+	int loc;
+	sleep(1);
+	if (waitpid(pid, &loc, WNOHANG) == 0) {
+	    kill(pid, SIGKILL);
+	    return EXIT_FAILURE;
+	}
+    }
+    else {
+	if (use_threads()) return EXIT_FAILURE;
+    }
+
+    return EXIT_SUCCESS;
+}]
+	rb_cv_fork_with_pthread=yes,
+	rb_cv_fork_with_pthread=no,
+	rb_cv_fork_with_pthread=yes)])
+    test x$rb_cv_fork_with_pthread = xyes || AC_DEFINE(CANNOT_FORK_WITH_PTHREAD)
+fi
+
 AC_CHECK_FUNCS(backtrace)
 
 AC_ARG_WITH(valgrind,
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 17558)
+++ ChangeLog	(revision 17559)
@@ -1,3 +1,8 @@
+Tue Jun 24 17:20:39 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* configure.in (rb_cv_fork_with_pthread): check after check for
+	  pthread library, and define the macro when checked only.
+
 Tue Jun 24 17:04:39 2008  NAKAMURA Usaku  <usa@r...>
 
 	* ext/io/wait/extconf.rb: check sys/socket.h for cygwin.
Index: mvm/configure.in
===================================================================
--- mvm/configure.in	(revision 17558)
+++ mvm/configure.in	(revision 17559)
@@ -766,64 +766,6 @@
 AC_DEFINE_UNQUOTED([RUBY_LONGJMP(env,val)], [${setjmp_prefix}longjmp(env,val)])
 AC_DEFINE_UNQUOTED(RUBY_JMP_BUF, ${setjmp_sigmask+${setjmp_prefix}}jmp_buf)
 
-
-case $target_os in
-*bsd*|darwin*)
-AC_CACHE_CHECK([if fork works with pthread], rb_cv_fork_with_pthread,
-[AC_TRY_RUN([
-#include <stdlib.h>
-#include <unistd.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <signal.h>
-
-void *
-thread_func(void *dmy)
-{
-    return dmy;
-}
-
-void *use_threads(void)
-{
-    pthread_t tid;
-    if (pthread_create(&tid, 0, thread_func, 0) != 0) {
-	exit(1);
-    }
-    if (pthread_join(tid, 0) != 0) {
-	exit(1);
-    }
-}
-
-int
-main(int argc, char *argv[])
-{
-    pid_t pid;
-    use_threads();
-    pid = fork();
-
-    if (pid) {
-	int loc;
-	sleep(1);
-	if (waitpid(pid, &loc, WNOHANG) == 0) {
-	    kill(pid, SIGKILL);
-	    return 1;
-	}
-    }
-    else {
-	use_threads();
-    }
-
-    return 0;
-}]
-	rb_cv_fork_with_pthread=yes,
-	rb_cv_fork_with_pthread=no,
-	rb_cv_fork_with_pthread=yes)])
-    ;;
-esac
-test x$rb_cv_fork_with_pthread = xyes || AC_DEFINE(CANNOT_FORK_WITH_PTHREAD)
-
 AC_ARG_ENABLE(setreuid,
        [  --enable-setreuid       use setreuid()/setregid() according to need even if obsolete.],
        [use_setreuid=$enableval])
@@ -1167,6 +1109,69 @@
     fi
 fi
 
+if test "$ac_cv_func_fork" = "yes" -a "$rb_with_pthread" = "yes"; then
+    AC_CACHE_CHECK([if fork works with pthread], rb_cv_fork_with_pthread,
+	[AC_TRY_RUN([
+#include <stdlib.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <signal.h>
+#ifndef EXIT_SUCCESS
+#define EXIT_SUCCESS 0
+#endif
+#ifndef EXIT_FAILURE
+#define EXIT_FAILURE 1
+#endif
+
+void *
+thread_func(void *dmy)
+{
+    return dmy;
+}
+
+int
+use_threads(void)
+{
+    pthread_t tid;
+    if (pthread_create(&tid, 0, thread_func, 0) != 0) {
+	return -1;
+    }
+    if (pthread_join(tid, 0) != 0) {
+	return -1;
+    }
+    return 0;
+}
+
+int
+main(int argc, char *argv[])
+{
+    pid_t pid;
+    if (use_threads()) return EXIT_FAILURE;
+    pid = fork();
+
+    if (pid) {
+	int loc;
+	sleep(1);
+	if (waitpid(pid, &loc, WNOHANG) == 0) {
+	    kill(pid, SIGKILL);
+	    return EXIT_FAILURE;
+	}
+    }
+    else {
+	if (use_threads()) return EXIT_FAILURE;
+    }
+
+    return EXIT_SUCCESS;
+}]
+	rb_cv_fork_with_pthread=yes,
+	rb_cv_fork_with_pthread=no,
+	rb_cv_fork_with_pthread=yes)])
+    test x$rb_cv_fork_with_pthread = xyes || AC_DEFINE(CANNOT_FORK_WITH_PTHREAD)
+fi
+
 AC_CHECK_FUNCS(backtrace)
 
 AC_ARG_WITH(valgrind,
Index: mvm/ChangeLog
===================================================================
--- mvm/ChangeLog	(revision 17558)
+++ mvm/ChangeLog	(revision 17559)
@@ -1,3 +1,8 @@
+Tue Jun 24 17:20:39 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* configure.in (rb_cv_fork_with_pthread): check after check for
+	  pthread library, and define the macro when checked only.
+
 Sun Jun 22 16:45:27 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* vm_core.h (ENABLE_VM_OBJSPACE): enabled.

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]