]> code.delx.au - gnu-emacs/commitdiff
Check more robustly for timer_settime.
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 27 Sep 2012 01:06:23 +0000 (18:06 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 27 Sep 2012 01:06:23 +0000 (18:06 -0700)
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.

ChangeLog
admin/ChangeLog
admin/merge-gnulib
configure.ac
lib/gnulib.mk
m4/gnulib-comp.m4
m4/timer_time.m4 [new file with mode: 0644]
src/ChangeLog
src/atimer.c

index c0f40b92c90a9274096ef7d9c46a18d384e1dfb2..40c8f1550e688070df1820ccced8e0dcf52a24c0 100644 (file)
--- 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,
index 3f1c8e6a1979fae07821326ff0b736f8092cc2c2..b8394036afbec1391f185745fcced38a87c6e337 100644 (file)
@@ -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:
index 775d43e68d393c0d039ae22dbbd6f1b87101c2aa..7fc0b5f4844317710f6680d9ae8252f0466fcd9f 100755 (executable)
@@ -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
 '
 
index a6462f7959a84a9ba07ef667bc7c9c363add511e..5a3aea763c00c2a0118bc48ed07e61b01b789544 100644 (file)
@@ -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
 
index d49eb4fdf7ab1096a51ecc473c188153c173b167..e79fe35622c9040901cb38c2f939737dada6a753 100644 (file)
@@ -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
index 0d73faee8d143cc76cb447f5dbe3f32133849f78..de2355d87c32becbbd9f257431d4e4d279df41ce 100644 (file)
@@ -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 (file)
index 0000000..bc84554
--- /dev/null
@@ -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
+])
index 445090fb2a1eee81d98f91eaebe46666d6f65f18..c920f09106344e2d0bda108a648c89366b8a68f2 100644 (file)
@@ -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.
index 8bb80445bde22848094a80de6c83ff5f14263e02..048c62798ef671f2fd638f2d2a82762ea807da41 100644 (file)
@@ -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;