From ccb9fb0b26fa8fed9320a0b2e0ca86202dd4b3de Mon Sep 17 00:00:00 2001 From: nagachika Date: Wed, 20 Mar 2013 13:34:16 +0000 Subject: [PATCH] merge revision(s) 39772,39773: [Backport #8080] * configure.in: check struct timeval exist or not. * include/ruby/missing.h (struct timeval): check HAVE_STRUCT_TIMEVAL properly. and don't include sys/time.h if struct timeval exist. * file.c: include sys/time.h explicitly. * random.c: ditto. * thread_pthread.c: ditto. * time.c: ditto. * ext/date/date_strftime.c: ditto. * include/ruby/missing.h (struct timespec): include git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@39838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 16 ++++++++++++++++ configure.in | 7 +++++++ ext/date/date_strftime.c | 4 ++++ file.c | 4 ++++ include/ruby/missing.h | 12 +++++++++--- random.c | 3 +++ thread_pthread.c | 3 +++ time.c | 4 ++++ version.h | 2 +- 9 files changed, 51 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0a426927ff..34197047d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +Wed Mar 20 22:33:26 2013 KOSAKI Motohiro + + * include/ruby/missing.h (struct timespec): include + +Wed Mar 20 22:33:26 2013 KOSAKI Motohiro + + * configure.in: check struct timeval exist or not. + * include/ruby/missing.h (struct timeval): check HAVE_STRUCT_TIMEVAL + properly. and don't include sys/time.h if struct timeval exist. + + * file.c: include sys/time.h explicitly. + * random.c: ditto. + * thread_pthread.c: ditto. + * time.c: ditto. + * ext/date/date_strftime.c: ditto. + Mon Mar 18 00:12:28 2013 Eric Hodel * lib/rubygems/commands/setup_command.rb: Don't delete non-rubygems diff --git a/configure.in b/configure.in index 93a13e80ce..cf53e019c1 100644 --- a/configure.in +++ b/configure.in @@ -1371,6 +1371,13 @@ AC_CHECK_MEMBERS([struct stat.st_ctim]) AC_CHECK_MEMBERS([struct stat.st_ctimespec]) AC_CHECK_MEMBERS([struct stat.st_ctimensec]) +AC_CHECK_TYPES([struct timeval], [], [], [@%:@ifdef HAVE_TIME_H +@%:@include +@%:@endif +@%:@ifdef HAVE_SYS_TIME_H +@%:@include +@%:@endif]) + AC_CHECK_TYPES([struct timespec], [], [], [@%:@ifdef HAVE_TIME_H @%:@include @%:@endif diff --git a/ext/date/date_strftime.c b/ext/date/date_strftime.c index 54324dad09..20931a3124 100644 --- a/ext/date/date_strftime.c +++ b/ext/date/date_strftime.c @@ -12,6 +12,10 @@ #include #include +#if defined(HAVE_SYS_TIME_H) +#include +#endif + #undef strchr /* avoid AIX weirdness */ #define range(low, item, hi) (item) diff --git a/file.c b/file.c index 539410fb5e..71fa853829 100644 --- a/file.c +++ b/file.c @@ -75,6 +75,10 @@ int flock(int, int); #include #endif +#if defined(HAVE_SYS_TIME_H) +#include +#endif + #if !defined HAVE_LSTAT && !defined lstat #define lstat stat #endif diff --git a/include/ruby/missing.h b/include/ruby/missing.h index 1297c43a7a..616e699ad5 100644 --- a/include/ruby/missing.h +++ b/include/ruby/missing.h @@ -25,20 +25,26 @@ extern "C" { #include RUBY_EXTCONF_H #endif -#if defined(HAVE_SYS_TIME_H) +#if !defined(HAVE_STRUCT_TIMEVAL) +# if defined(HAVE_SYS_TIME_H) # include -#elif !defined(_WIN32) +# elif !defined(_WIN32) # define time_t long struct timeval { time_t tv_sec; /* seconds */ long tv_usec; /* microseconds */ }; -#endif +# endif +#endif /* HAVE_STRUCT_TIMEVAL */ + #if defined(HAVE_SYS_TYPES_H) # include #endif #if !defined(HAVE_STRUCT_TIMESPEC) +# if defined(HAVE_SYS_TIME_H) +# include +# endif struct timespec { time_t tv_sec; /* seconds */ long tv_nsec; /* nanoseconds */ diff --git a/random.c b/random.c index 2ef8959c26..da83c2c867 100644 --- a/random.c +++ b/random.c @@ -73,6 +73,9 @@ The original copyright notice follows. #endif #include #include +#if defined(HAVE_SYS_TIME_H) +#include +#endif #ifdef _WIN32 # if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0400 diff --git a/thread_pthread.c b/thread_pthread.c index 37a1e4740e..e2945d8662 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -33,6 +33,9 @@ #if HAVE_POLL #include #endif +#if defined(HAVE_SYS_TIME_H) +#include +#endif static void native_mutex_lock(pthread_mutex_t *lock); static void native_mutex_unlock(pthread_mutex_t *lock); diff --git a/time.c b/time.c index 77cac95621..606cbdf17b 100644 --- a/time.c +++ b/time.c @@ -27,6 +27,10 @@ #include #endif +#if defined(HAVE_SYS_TIME_H) +#include +#endif + #include "timev.h" static ID id_divmod, id_mul, id_submicro, id_nano_num, id_nano_den, id_offset, id_zone; diff --git a/version.h b/version.h index ab11c21abd..65c4347e25 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.0.0" #define RUBY_RELEASE_DATE "2013-03-20" -#define RUBY_PATCHLEVEL 73 +#define RUBY_PATCHLEVEL 74 #define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_MONTH 3