* configure.in (shutdown, sched_yield, pthread_attr_setinheritsched):

check for Haiku.

* eval_intern.h, io.c, thread_pthread.c: use autoconfisticated results.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-08-08 08:03:19 +00:00
parent b68b9ec698
commit 1c22ef1705
4 changed files with 31 additions and 21 deletions

View File

@ -512,11 +512,14 @@ hpux*) LIBS="-lm $LIBS"
human*) ac_cv_func_getpgrp_void=yes human*) ac_cv_func_getpgrp_void=yes
ac_cv_func_setitimer=no ac_cv_func_setitimer=no
;; ;;
beos*) ac_cv_func_link=no beos*|haiku*) ac_cv_func_link=no
LIBS="$LIBS" # m lib is include in root under BeOS ac_cv_func_sched_yield=no
;; ac_cv_func_pthread_attr_setinheritsched=no
haiku*) ac_cv_func_link=no case "$target_os" in
LIBS="$LIBS" # m lib is include in root under Haiku 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
;; ;;
cygwin*) ;; cygwin*) ;;
mingw*) LIBS="-lshell32 -lws2_32 $LIBS" mingw*) LIBS="-lshell32 -lws2_32 $LIBS"
@ -529,6 +532,7 @@ mingw*) LIBS="-lshell32 -lws2_32 $LIBS"
ac_cv_header_sys_select_h=no ac_cv_header_sys_select_h=no
ac_cv_header_sys_time_h=no ac_cv_header_sys_time_h=no
ac_cv_header_sys_times_h=no ac_cv_header_sys_times_h=no
ac_cv_header_sys_socket_h=no
ac_cv_func_times=yes ac_cv_func_times=yes
ac_cv_func_waitpid=yes ac_cv_func_waitpid=yes
ac_cv_func_fsync=yes ac_cv_func_fsync=yes
@ -560,6 +564,7 @@ msdosdjgpp*) LIBS="-lm $LIBS"
ac_cv_sizeof_rlim_t=4 ac_cv_sizeof_rlim_t=4
ac_cv_func_fork=no ac_cv_func_fork=no
ac_cv_func_setrlimit=no ac_cv_func_setrlimit=no
ac_cv_header_sys_socket_h=no
;; ;;
bsdi*) LIBS="-lm $LIBS" bsdi*) LIBS="-lm $LIBS"
AC_DEFINE(BROKEN_SETREUID, 1) AC_DEFINE(BROKEN_SETREUID, 1)
@ -603,6 +608,13 @@ alpha*) case "$target_os"::"$GCC" in
esac ;; esac ;;
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. dnl Checks for header files.
AC_HEADER_DIRENT AC_HEADER_DIRENT
AC_HEADER_STDC AC_HEADER_STDC
@ -611,7 +623,8 @@ AC_CHECK_HEADERS(stdlib.h string.h unistd.h limits.h sys/file.h sys/ioctl.h sys/
fcntl.h sys/fcntl.h sys/select.h sys/time.h sys/times.h sys/param.h\ 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 \ 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 \ 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. dnl Check additional types.
AC_CHECK_SIZEOF(rlim_t, 0, [ AC_CHECK_SIZEOF(rlim_t, 0, [
@ -751,7 +764,7 @@ AC_CHECK_FUNCS(fmod killpg wait4 waitpid fork spawnv syscall chroot fsync getcwd
setsid telldir seekdir fchmod cosh sinh tanh log2 round signbit\ setsid telldir seekdir fchmod cosh sinh tanh log2 round signbit\
setuid setgid daemon select_large_fdset setenv unsetenv\ setuid setgid daemon select_large_fdset setenv unsetenv\
mktime timegm clock_gettime gettimeofday\ mktime timegm clock_gettime gettimeofday\
pread sendfile) pread sendfile shutdown)
AC_CACHE_CHECK(for __builtin_setjmp, ac_cv_func___builtin_setjmp, AC_CACHE_CHECK(for __builtin_setjmp, ac_cv_func___builtin_setjmp,
[AC_TRY_LINK([@%:@include <setjmp.h> [AC_TRY_LINK([@%:@include <setjmp.h>
@ -1127,7 +1140,7 @@ if test x"$enable_pthread" = xyes; then
else else
AC_MSG_WARN("Don't know how to find pthread library on your system -- thread support disabled") AC_MSG_WARN("Don't know how to find pthread library on your system -- thread support disabled")
fi fi
AC_CHECK_FUNCS(nanosleep) AC_CHECK_FUNCS(nanosleep sched_yield pthread_attr_setinheritsched)
if test x"$ac_cv_func_nanosleep" = xno; then if test x"$ac_cv_func_nanosleep" = xno; then
AC_CHECK_LIB(rt, nanosleep) AC_CHECK_LIB(rt, nanosleep)
if test x"$ac_cv_lib_rt_nanosleep" = xyes; then if test x"$ac_cv_lib_rt_nanosleep" = xyes; then

View File

@ -75,7 +75,7 @@ char *strrchr(const char *, const char);
#include <unistd.h> #include <unistd.h>
#endif #endif
#if defined(__BEOS__) && !defined(__HAIKU__) #ifdef HAVE_NET_SOCKET_H
#include <net/socket.h> #include <net/socket.h>
#endif #endif

9
io.c
View File

@ -25,12 +25,10 @@
#endif #endif
#include <sys/types.h> #include <sys/types.h>
#if !defined(_WIN32) && !defined(__DJGPP__) #if defined HAVE_NET_SOCKET_H
#if defined(__BEOS__) && !defined(__HAIKU__)
# include <net/socket.h> # include <net/socket.h>
# else #elif defined HAVE_SYS_SOCKET_H
# include <sys/socket.h> # include <sys/socket.h>
# endif
#endif #endif
#if defined(MSDOS) || defined(__BOW__) || defined(__CYGWIN__) || defined(_WIN32) || defined(__human68k__) || defined(__EMX__) || defined(__BEOS__) #if defined(MSDOS) || defined(__BOW__) || defined(__CYGWIN__) || defined(_WIN32) || defined(__human68k__) || defined(__EMX__) || defined(__BEOS__)
@ -201,7 +199,7 @@ static int max_file_descriptor = NOFILE;
# endif # endif
#endif #endif
#if defined(__HAIKU__) #ifndef HAVE_SHUTDOWN
#define shutdown(a,b) 0 #define shutdown(a,b) 0
#endif #endif
@ -209,7 +207,6 @@ static int max_file_descriptor = NOFILE;
#define is_socket(fd, path) rb_w32_is_socket(fd) #define is_socket(fd, path) rb_w32_is_socket(fd)
#elif !defined(S_ISSOCK) #elif !defined(S_ISSOCK)
#define is_socket(fd, path) 0 #define is_socket(fd, path) 0
#define shutdown(a,b) 0
#else #else
static int static int
is_socket(int fd, const char *path) is_socket(int fd, const char *path)

View File

@ -119,10 +119,10 @@ native_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
#define native_cleanup_push pthread_cleanup_push #define native_cleanup_push pthread_cleanup_push
#define native_cleanup_pop pthread_cleanup_pop #define native_cleanup_pop pthread_cleanup_pop
#ifdef __HAIKU__ #ifdef HAVE_SCHED_YIELD
#define native_thread_yield() /* not available under Haiku */ #define native_thread_yield() (void)sched_yield()
#else #else
#define native_thread_yield() sched_yield() #define native_thread_yield() ((void)0)
#endif #endif
#ifndef __CYGWIN__ #ifndef __CYGWIN__
@ -413,7 +413,7 @@ native_thread_create(rb_thread_t *th)
CHECK_ERR(pthread_attr_setstacksize(&attr, stack_size)); CHECK_ERR(pthread_attr_setstacksize(&attr, stack_size));
#endif #endif
#ifndef __HAIKU__ /* not yet available under Haiku */ #ifdef HAVE_PTHREAD_ATTR_SETINHERITSCHED
CHECK_ERR(pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED)); CHECK_ERR(pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED));
#endif #endif
CHECK_ERR(pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED)); CHECK_ERR(pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED));