ruby-changes:27720
From: kosaki <ko1@a...>
Date: Sat, 16 Mar 2013 14:07:15 +0900 (JST)
Subject: [ruby-changes:27720] kosaki:r39772 (trunk): * configure.in: check struct timeval exist or not.
kosaki 2013-03-16 14:06:47 +0900 (Sat, 16 Mar 2013) New Revision: 39772 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39772 Log: * 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. Modified files: trunk/ChangeLog trunk/configure.in trunk/ext/date/date_strftime.c trunk/file.c trunk/include/ruby/missing.h trunk/random.c trunk/thread_pthread.c trunk/time.c Index: time.c =================================================================== --- time.c (revision 39771) +++ time.c (revision 39772) @@ -27,6 +27,10 @@ https://github.com/ruby/ruby/blob/trunk/time.c#L27 #include <strings.h> #endif +#if defined(HAVE_SYS_TIME_H) +#include <sys/time.h> +#endif + #include "timev.h" static ID id_divmod, id_mul, id_submicro, id_nano_num, id_nano_den, id_offset, id_zone; Index: include/ruby/missing.h =================================================================== --- include/ruby/missing.h (revision 39771) +++ include/ruby/missing.h (revision 39772) @@ -25,15 +25,18 @@ extern "C" { https://github.com/ruby/ruby/blob/trunk/include/ruby/missing.h#L25 #include RUBY_EXTCONF_H #endif -#if defined(HAVE_SYS_TIME_H) +#if !defined(HAVE_STRUCT_TIMEVAL) +# if defined(HAVE_SYS_TIME_H) # include <sys/time.h> -#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 <sys/types.h> #endif Index: configure.in =================================================================== --- configure.in (revision 39771) +++ configure.in (revision 39772) @@ -1443,6 +1443,13 @@ AC_CHECK_MEMBERS([struct stat.st_ctim]) https://github.com/ruby/ruby/blob/trunk/configure.in#L1443 AC_CHECK_MEMBERS([struct stat.st_ctimespec]) 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 @%:@include <time.h> @%:@endif Index: ChangeLog =================================================================== --- ChangeLog (revision 39771) +++ ChangeLog (revision 39772) @@ -1,3 +1,15 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Mar 13 13:54:45 2013 KOSAKI Motohiro <kosaki.motohiro@g...> + + * 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. + Fri Mar 15 14:45:02 2013 KOSAKI Motohiro <kosaki.motohiro@g...> * configure.in (_FORTIFY_SOURCE): added a few comments. Index: thread_pthread.c =================================================================== --- thread_pthread.c (revision 39771) +++ thread_pthread.c (revision 39772) @@ -33,6 +33,9 @@ https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L33 #if HAVE_POLL #include <poll.h> #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_unlock(pthread_mutex_t *lock); Index: ext/date/date_strftime.c =================================================================== --- ext/date/date_strftime.c (revision 39771) +++ ext/date/date_strftime.c (revision 39772) @@ -12,6 +12,10 @@ https://github.com/ruby/ruby/blob/trunk/ext/date/date_strftime.c#L12 #include <ctype.h> #include <errno.h> +#if defined(HAVE_SYS_TIME_H) +#include <sys/time.h> +#endif + #undef strchr /* avoid AIX weirdness */ #define range(low, item, hi) (item) Index: file.c =================================================================== --- file.c (revision 39771) +++ file.c (revision 39772) @@ -75,6 +75,10 @@ int flock(int, int); https://github.com/ruby/ruby/blob/trunk/file.c#L75 #include <fcntl.h> #endif +#if defined(HAVE_SYS_TIME_H) +#include <sys/time.h> +#endif + #if !defined HAVE_LSTAT && !defined lstat #define lstat stat #endif Index: random.c =================================================================== --- random.c (revision 39771) +++ random.c (revision 39772) @@ -73,6 +73,9 @@ The original copyright notice follows. https://github.com/ruby/ruby/blob/trunk/random.c#L73 #endif #include <math.h> #include <errno.h> +#if defined(HAVE_SYS_TIME_H) +#include <sys/time.h> +#endif #ifdef _WIN32 # if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0400 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/