diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2012-09-26 18:06:23 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2012-09-26 18:06:23 -0700 |
commit | a615a3aeef0fb1469dcf89e2217a027a6dce82c1 (patch) | |
tree | 6a9d26ac4b2a5ac287af1485234637c992474e12 | |
parent | 3670daf7f9a480d8e87b292ff7051d5be331c6b4 (diff) | |
download | emacs-a615a3aeef0fb1469dcf89e2217a027a6dce82c1.tar.gz |
Check more robustly for timer_settime.
This should fix an OS X build problem reported by Ivan Andrus in
<http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00671.html>.
* admin/merge-gnulib (GNULIB_MODULES): Add timer-time.
* configure.ac (gl_THREADLIB): Define to empty, since Emacs
does threads its own way.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* m4/timer_time.m4: New file, from gnulib.
* src/atimer.c (alarm_timer, alarm_timer_ok, set_alarm, init_atimer):
Use HAVE_TIMER_SETTIME, not SIGEV_SIGNAL, to decide whether to
call timer_settime.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | admin/ChangeLog | 5 | ||||
-rwxr-xr-x | admin/merge-gnulib | 2 | ||||
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | lib/gnulib.mk | 2 | ||||
-rw-r--r-- | m4/gnulib-comp.m4 | 3 | ||||
-rw-r--r-- | m4/timer_time.m4 | 39 | ||||
-rw-r--r-- | src/ChangeLog | 7 | ||||
-rw-r--r-- | src/atimer.c | 6 |
9 files changed, 70 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog index c0f40b92c90..40c8f1550e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2012-09-27 Paul Eggert <eggert@cs.ucla.edu> + + Check more robustly for timer_settime. + This should fix an OS X build problem reported by Ivan Andrus in + <http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00671.html>. + * configure.ac (gl_THREADLIB): Define to empty, since Emacs + does threads its own way. + 2012-09-23 Paul Eggert <eggert@cs.ucla.edu> * Makefile.in (bootstrap): Set MAKEFILE_NAME when building Makefile, diff --git a/admin/ChangeLog b/admin/ChangeLog index 3f1c8e6a197..b8394036afb 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog @@ -1,3 +1,8 @@ +2012-09-27 Paul Eggert <eggert@cs.ucla.edu> + + Check more robustly for timer_settime. + * merge-gnulib (GNULIB_MODULES): Add timer-time. + 2012-09-26 Juanma Barranquero <lekktu@gmail.com> * unidata/BidiMirroring.txt: diff --git a/admin/merge-gnulib b/admin/merge-gnulib index 775d43e68d3..7fc0b5f4844 100755 --- a/admin/merge-gnulib +++ b/admin/merge-gnulib @@ -34,7 +34,7 @@ GNULIB_MODULES=' manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat - sys_time time timespec-add timespec-sub utimens + sys_time time timer-time timespec-add timespec-sub utimens warnings ' diff --git a/configure.ac b/configure.ac index a6462f7959a..5a3aea763c0 100644 --- a/configure.ac +++ b/configure.ac @@ -571,6 +571,9 @@ else test "x$NON_GCC_TEST_OPTIONS" != x && CC="$CC $NON_GCC_TEST_OPTIONS" fi +# Avoid gnulib's threadlib module, as we do threads our own way. +AC_DEFUN([gl_THREADLIB]) + # Initialize gnulib right after choosing the compiler. gl_EARLY diff --git a/lib/gnulib.mk b/lib/gnulib.mk index d49eb4fdf7a..e79fe35622c 100644 --- a/lib/gnulib.mk +++ b/lib/gnulib.mk @@ -21,7 +21,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timespec-add timespec-sub utimens warnings +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub utimens warnings MOSTLYCLEANFILES += core *.stackdump diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 0d73faee8d1..de2355d87c3 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -111,6 +111,7 @@ AC_DEFUN([gl_EARLY], # Code from module sys_time: # Code from module time: # Code from module time_r: + # Code from module timer-time: # Code from module timespec: # Code from module timespec-add: # Code from module timespec-sub: @@ -263,6 +264,7 @@ AC_DEFUN([gl_INIT], gl_PREREQ_TIME_R fi gl_TIME_MODULE_INDICATOR([time_r]) + gl_TIMER_TIME gl_TIMESPEC gl_UNISTD_H gl_UTIMENS @@ -661,6 +663,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/sys_time_h.m4 m4/time_h.m4 m4/time_r.m4 + m4/timer_time.m4 m4/timespec.m4 m4/tm_gmtoff.m4 m4/unistd_h.m4 diff --git a/m4/timer_time.m4 b/m4/timer_time.m4 new file mode 100644 index 00000000000..bc84554b789 --- /dev/null +++ b/m4/timer_time.m4 @@ -0,0 +1,39 @@ +# timer_time.m4 serial 2 +dnl Copyright (C) 2011-2012 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# Check for timer_settime, and set LIB_TIMER_TIME. + +AC_DEFUN([gl_TIMER_TIME], +[ + dnl Based on clock_time.m4. See details there. + + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + AC_REQUIRE([gl_THREADLIB]) + + LIB_TIMER_TIME= + AC_SUBST([LIB_TIMER_TIME]) + gl_saved_libs=$LIBS + AC_SEARCH_LIBS([timer_settime], [rt posix4], + [test "$ac_cv_search_timer_settime" = "none required" || + LIB_TIMER_TIME=$ac_cv_search_timer_settime]) + dnl GLIBC uses threads to emulate posix timers when kernel support + dnl is not available (like Linux < 2.6 or when used with kFreeBSD) + dnl Now the pthread lib is linked automatically in the normal case, + dnl but when linking statically, it needs to be explicitly specified. + AC_EGREP_CPP([Thread], + [ +#include <features.h> +#ifdef __GNU_LIBRARY__ + #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || (__GLIBC__ > 2)) \ + && !defined __UCLIBC__ + Thread emulation available + #endif +#endif + ], + [LIB_TIMER_TIME="$LIB_TIMER_TIME $LIBMULTITHREAD"]) + AC_CHECK_FUNCS([timer_settime]) + LIBS=$gl_saved_libs +]) diff --git a/src/ChangeLog b/src/ChangeLog index 445090fb2a1..c920f091063 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2012-09-27 Paul Eggert <eggert@cs.ucla.edu> + + Check more robustly for timer_settime. + * atimer.c (alarm_timer, alarm_timer_ok, set_alarm, init_atimer): + Use HAVE_TIMER_SETTIME, not SIGEV_SIGNAL, to decide whether to + call timer_settime. + 2012-09-26 Tomohiro Matsuyama <tomo@cx4a.org> * profiler.c (Fprofiler_cpu_start): Remove unnecessary flag SA_SIGINFO. diff --git a/src/atimer.c b/src/atimer.c index 8bb80445bde..048c62798ef 100644 --- a/src/atimer.c +++ b/src/atimer.c @@ -42,7 +42,7 @@ static struct atimer *atimers; /* The alarm timer and whether it was properly initialized, if POSIX timers are available. */ -#ifdef SIGEV_SIGNAL +#ifdef HAVE_TIMER_SETTIME static timer_t alarm_timer; static bool alarm_timer_ok; #endif @@ -296,7 +296,7 @@ set_alarm (void) #endif EMACS_TIME now, interval; -#ifdef SIGEV_SIGNAL +#ifdef HAVE_TIMER_SETTIME if (alarm_timer_ok) { struct itimerspec ispec; @@ -416,7 +416,7 @@ void init_atimer (void) { struct sigaction action; -#ifdef SIGEV_SIGNAL +#ifdef HAVE_TIMER_SETTIME struct sigevent sigev; sigev.sigev_notify = SIGEV_SIGNAL; sigev.sigev_signo = SIGALRM; |