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

ruby-changes:6921

From: nobu <ko1@a...>
Date: Fri, 8 Aug 2008 17:03:27 +0900 (JST)
Subject: [ruby-changes:6921] Ruby:r18439 (trunk): * configure.in (shutdown, sched_yield, pthread_attr_setinheritsched):

nobu	2008-08-08 17:03:19 +0900 (Fri, 08 Aug 2008)

  New Revision: 18439

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=18439

  Log:
    * configure.in (shutdown, sched_yield, pthread_attr_setinheritsched):
      check for Haiku.
    
    * eval_intern.h, io.c, thread_pthread.c: use autoconfisticated results.

  Modified files:
    trunk/configure.in
    trunk/eval_intern.h
    trunk/io.c
    trunk/thread_pthread.c

Index: eval_intern.h
===================================================================
--- eval_intern.h	(revision 18438)
+++ eval_intern.h	(revision 18439)
@@ -75,7 +75,7 @@
 #include <unistd.h>
 #endif
 
-#if defined(__BEOS__) && !defined(__HAIKU__)
+#ifdef HAVE_NET_SOCKET_H
 #include <net/socket.h>
 #endif
 
Index: configure.in
===================================================================
--- configure.in	(revision 18438)
+++ configure.in	(revision 18439)
@@ -512,12 +512,15 @@
 human*)		ac_cv_func_getpgrp_void=yes
 		ac_cv_func_setitimer=no
 		;;
-beos*)	ac_cv_func_link=no
-		LIBS="$LIBS" # m lib is include in root under BeOS
+beos*|haiku*)	ac_cv_func_link=no
+		ac_cv_func_sched_yield=no
+		ac_cv_func_pthread_attr_setinheritsched=no
+		case "$target_os" in
+		beos*) ac_cv_header_net_socket_h=yes;;
+		haiku*) ac_cv_func_shutdown=no;;
+		esac
+		LIBS="$LIBS" # m lib is include in root under BeOS/Haiku
 		;;
-haiku*)	ac_cv_func_link=no
-		LIBS="$LIBS" # m lib is include in root under Haiku
-		;;
 cygwin*)	;;
 mingw*)		LIBS="-lshell32 -lws2_32 $LIBS"
 		ac_cv_header_a_out_h=no
@@ -529,6 +532,7 @@
 		ac_cv_header_sys_select_h=no
 		ac_cv_header_sys_time_h=no
 		ac_cv_header_sys_times_h=no
+		ac_cv_header_sys_socket_h=no
 		ac_cv_func_times=yes
 		ac_cv_func_waitpid=yes
 		ac_cv_func_fsync=yes
@@ -560,6 +564,7 @@
 		ac_cv_sizeof_rlim_t=4
 		ac_cv_func_fork=no
 		ac_cv_func_setrlimit=no
+		ac_cv_header_sys_socket_h=no
 		;;
 bsdi*)          LIBS="-lm $LIBS"
 		AC_DEFINE(BROKEN_SETREUID, 1)
@@ -603,6 +608,13 @@
 		esac ;;
 esac
 
+ac_cv_header_net_socket_h=${ac_cv_header_net_socket_h=no}
+if test "$ac_cv_header_net_socket_h" = yes; then
+    ac_cv_header_sys_socket_h=${ac_cv_header_sys_socket_h=no}
+else
+    ac_cv_header_sys_socket_h=${ac_cv_header_sys_socket_h=yes}
+fi
+
 dnl Checks for header files.
 AC_HEADER_DIRENT
 AC_HEADER_STDC
@@ -611,7 +623,8 @@
 		 fcntl.h sys/fcntl.h sys/select.h sys/time.h sys/times.h sys/param.h\
 		 syscall.h pwd.h grp.h a.out.h utime.h memory.h direct.h sys/resource.h \
 		 sys/mkdev.h sys/utime.h xti.h netinet/in_systm.h float.h ieeefp.h pthread.h \
-		 ucontext.h intrinsics.h langinfo.h locale.h sys/sendfile.h time.h)
+		 ucontext.h intrinsics.h langinfo.h locale.h sys/sendfile.h time.h \
+		 net/socket.h sys/socket.h)
 
 dnl Check additional types.
 AC_CHECK_SIZEOF(rlim_t, 0, [
@@ -751,7 +764,7 @@
 	      setsid telldir seekdir fchmod cosh sinh tanh log2 round signbit\
 	      setuid setgid daemon select_large_fdset setenv unsetenv\
               mktime timegm clock_gettime gettimeofday\
-              pread sendfile)
+              pread sendfile shutdown)
 
 AC_CACHE_CHECK(for __builtin_setjmp, ac_cv_func___builtin_setjmp,
 [AC_TRY_LINK([@%:@include <setjmp.h>
@@ -1127,7 +1140,7 @@
     else
 	AC_MSG_WARN("Don't know how to find pthread library on your system -- thread support disabled")
     fi
-    AC_CHECK_FUNCS(nanosleep)
+    AC_CHECK_FUNCS(nanosleep sched_yield pthread_attr_setinheritsched)
     if test x"$ac_cv_func_nanosleep" = xno; then
        AC_CHECK_LIB(rt, nanosleep)
        if test x"$ac_cv_lib_rt_nanosleep" = xyes; then
Index: thread_pthread.c
===================================================================
--- thread_pthread.c	(revision 18438)
+++ thread_pthread.c	(revision 18439)
@@ -119,10 +119,10 @@
 
 #define native_cleanup_push pthread_cleanup_push
 #define native_cleanup_pop  pthread_cleanup_pop
-#ifdef __HAIKU__
-#define native_thread_yield() /* not available under Haiku */
+#ifdef HAVE_SCHED_YIELD
+#define native_thread_yield() (void)sched_yield()
 #else
-#define native_thread_yield() sched_yield()
+#define native_thread_yield() ((void)0)
 #endif
 
 #ifndef __CYGWIN__
@@ -413,7 +413,7 @@
 	CHECK_ERR(pthread_attr_setstacksize(&attr, stack_size));
 #endif
 
-#ifndef __HAIKU__  /* not yet available under Haiku */
+#ifdef HAVE_PTHREAD_ATTR_SETINHERITSCHED
 	CHECK_ERR(pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED));
 #endif
 	CHECK_ERR(pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED));
Index: io.c
===================================================================
--- io.c	(revision 18438)
+++ io.c	(revision 18439)
@@ -25,12 +25,10 @@
 #endif
 
 #include <sys/types.h>
-#if !defined(_WIN32) && !defined(__DJGPP__)
-#if defined(__BEOS__) && !defined(__HAIKU__)
-#  include <net/socket.h>
-# else
-#  include <sys/socket.h>
-# endif
+#if defined HAVE_NET_SOCKET_H
+# include <net/socket.h>
+#elif defined HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
 #endif
 
 #if defined(MSDOS) || defined(__BOW__) || defined(__CYGWIN__) || defined(_WIN32) || defined(__human68k__) || defined(__EMX__) || defined(__BEOS__)
@@ -201,7 +199,7 @@
 #  endif
 #endif
 
-#if defined(__HAIKU__)
+#ifndef HAVE_SHUTDOWN
 #define shutdown(a,b)	0
 #endif
 
@@ -209,7 +207,6 @@
 #define is_socket(fd, path)	rb_w32_is_socket(fd)
 #elif !defined(S_ISSOCK)
 #define is_socket(fd, path)	0
-#define shutdown(a,b)	0
 #else
 static int
 is_socket(int fd, const char *path)

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

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