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 <sys/time.h>


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@39838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2013-03-20 13:34:16 +00:00
parent 55f14b4551
commit ccb9fb0b26
9 changed files with 51 additions and 4 deletions

View file

@ -1,3 +1,19 @@
Wed Mar 20 22:33:26 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
* include/ruby/missing.h (struct timespec): include <sys/time.h>
Wed Mar 20 22:33:26 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
* 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 <drbrain@segment7.net> Mon Mar 18 00:12:28 2013 Eric Hodel <drbrain@segment7.net>
* lib/rubygems/commands/setup_command.rb: Don't delete non-rubygems * lib/rubygems/commands/setup_command.rb: Don't delete non-rubygems

View file

@ -1371,6 +1371,13 @@ AC_CHECK_MEMBERS([struct stat.st_ctim])
AC_CHECK_MEMBERS([struct stat.st_ctimespec]) AC_CHECK_MEMBERS([struct stat.st_ctimespec])
AC_CHECK_MEMBERS([struct stat.st_ctimensec]) AC_CHECK_MEMBERS([struct stat.st_ctimensec])
AC_CHECK_TYPES([struct timeval], [], [], [@%:@ifdef HAVE_TIME_H
@%:@include <time.h>
@%:@endif
@%:@ifdef HAVE_SYS_TIME_H
@%:@include <sys/time.h>
@%:@endif])
AC_CHECK_TYPES([struct timespec], [], [], [@%:@ifdef HAVE_TIME_H AC_CHECK_TYPES([struct timespec], [], [], [@%:@ifdef HAVE_TIME_H
@%:@include <time.h> @%:@include <time.h>
@%:@endif @%:@endif

View file

@ -12,6 +12,10 @@
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#if defined(HAVE_SYS_TIME_H)
#include <sys/time.h>
#endif
#undef strchr /* avoid AIX weirdness */ #undef strchr /* avoid AIX weirdness */
#define range(low, item, hi) (item) #define range(low, item, hi) (item)

4
file.c
View file

@ -75,6 +75,10 @@ int flock(int, int);
#include <fcntl.h> #include <fcntl.h>
#endif #endif
#if defined(HAVE_SYS_TIME_H)
#include <sys/time.h>
#endif
#if !defined HAVE_LSTAT && !defined lstat #if !defined HAVE_LSTAT && !defined lstat
#define lstat stat #define lstat stat
#endif #endif

View file

@ -25,20 +25,26 @@ extern "C" {
#include RUBY_EXTCONF_H #include RUBY_EXTCONF_H
#endif #endif
#if defined(HAVE_SYS_TIME_H) #if !defined(HAVE_STRUCT_TIMEVAL)
# if defined(HAVE_SYS_TIME_H)
# include <sys/time.h> # include <sys/time.h>
#elif !defined(_WIN32) # elif !defined(_WIN32)
# define time_t long # define time_t long
struct timeval { struct timeval {
time_t tv_sec; /* seconds */ time_t tv_sec; /* seconds */
long tv_usec; /* microseconds */ long tv_usec; /* microseconds */
}; };
#endif # endif
#endif /* HAVE_STRUCT_TIMEVAL */
#if defined(HAVE_SYS_TYPES_H) #if defined(HAVE_SYS_TYPES_H)
# include <sys/types.h> # include <sys/types.h>
#endif #endif
#if !defined(HAVE_STRUCT_TIMESPEC) #if !defined(HAVE_STRUCT_TIMESPEC)
# if defined(HAVE_SYS_TIME_H)
# include <sys/time.h>
# endif
struct timespec { struct timespec {
time_t tv_sec; /* seconds */ time_t tv_sec; /* seconds */
long tv_nsec; /* nanoseconds */ long tv_nsec; /* nanoseconds */

View file

@ -73,6 +73,9 @@ The original copyright notice follows.
#endif #endif
#include <math.h> #include <math.h>
#include <errno.h> #include <errno.h>
#if defined(HAVE_SYS_TIME_H)
#include <sys/time.h>
#endif
#ifdef _WIN32 #ifdef _WIN32
# if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0400 # if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0400

View file

@ -33,6 +33,9 @@
#if HAVE_POLL #if HAVE_POLL
#include <poll.h> #include <poll.h>
#endif #endif
#if defined(HAVE_SYS_TIME_H)
#include <sys/time.h>
#endif
static void native_mutex_lock(pthread_mutex_t *lock); static void native_mutex_lock(pthread_mutex_t *lock);
static void native_mutex_unlock(pthread_mutex_t *lock); static void native_mutex_unlock(pthread_mutex_t *lock);

4
time.c
View file

@ -27,6 +27,10 @@
#include <strings.h> #include <strings.h>
#endif #endif
#if defined(HAVE_SYS_TIME_H)
#include <sys/time.h>
#endif
#include "timev.h" #include "timev.h"
static ID id_divmod, id_mul, id_submicro, id_nano_num, id_nano_den, id_offset, id_zone; static ID id_divmod, id_mul, id_submicro, id_nano_num, id_nano_den, id_offset, id_zone;

View file

@ -1,6 +1,6 @@
#define RUBY_VERSION "2.0.0" #define RUBY_VERSION "2.0.0"
#define RUBY_RELEASE_DATE "2013-03-20" #define RUBY_RELEASE_DATE "2013-03-20"
#define RUBY_PATCHLEVEL 73 #define RUBY_PATCHLEVEL 74
#define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_YEAR 2013
#define RUBY_RELEASE_MONTH 3 #define RUBY_RELEASE_MONTH 3