Use `clock-time' directly from Gnulib, but with a local patch.
authorLudovic Courtès <ludo@gnu.org>
Fri, 6 Jul 2012 21:56:05 +0000 (23:56 +0200)
committerLudovic Courtès <ludo@gnu.org>
Fri, 6 Jul 2012 21:56:05 +0000 (23:56 +0200)
This is equivalent to the previous situation, but more easily
maintainable.

* acinclude.m4 (gl_CLOCK_TIME): Remove.

* configure.ac: Remove explicit use of `gl_CLOCK_TIME'.

* m4/gnulib-cache.m4 (gl_MODULES): Add `clock-time'.

* gnulib-local/m4/clock_time.m4.diff: New file.
* Makefile.am (EXTRA_DIST): Add it.

Makefile.am
acinclude.m4
configure.ac
gnulib-local/m4/clock_time.m4.diff [new file with mode: 0644]
lib/Makefile.am
libguile/Makefile.am
m4/gnulib-cache.m4
m4/gnulib-comp.m4

index 7eecd73..a8e30c6 100644 (file)
@@ -48,7 +48,8 @@ EXTRA_DIST = LICENSE HACKING GUILE-VERSION            \
             ChangeLog-2008                             \
             .version                                   \
             gnulib-local/lib/localcharset.h.diff       \
-            gnulib-local/lib/localcharset.c.diff
+            gnulib-local/lib/localcharset.c.diff       \
+            gnulib-local/m4/clock_time.m4.diff
 
 TESTS = check-guile
 TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@
index 0edd4b8..8ef6e99 100644 (file)
@@ -583,42 +583,3 @@ AC_DEFUN([GUILE_CHECK_GUILE_FOR_BUILD], [
 dnl Declare file $1 to be a script that needs configuring,
 dnl and arrange to make it executable in the process.
 AC_DEFUN([GUILE_CONFIG_SCRIPT],[AC_CONFIG_FILES([$1],[chmod +x $1])])
-
-\f
-dnl Copyright (C) 2002-2006, 2009-2011 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 clock_gettime and clock_settime, and set LIB_CLOCK_GETTIME.
-# For a program named, say foo, you should add a line like the following
-# in the corresponding Makefile.am file:
-# foo_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
-
-AC_DEFUN([gl_CLOCK_TIME],
-[
-  dnl Persuade glibc and Solaris <time.h> to declare these functions.
-  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-
-  # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
-  # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
-
-  # Save and restore LIBS so e.g., -lrt, isn't added to it.  Otherwise, *all*
-  # programs in the package would end up linked with that potentially-shared
-  # library, inducing unnecessary run-time overhead.
-  LIB_CLOCK_GETTIME=
-  AC_SUBST([LIB_CLOCK_GETTIME])
-  gl_saved_libs=$LIBS
-    AC_SEARCH_LIBS([clock_gettime], [rt posix4],
-                   [if test "$ac_cv_search_clock_gettime" = "none required"; then
-                      AC_SEARCH_LIBS([clock_getcpuclockid], [rt posix4],
-                                     [test "$ac_cv_search_clock_getcpuclockid" = "none required" \
-                                      || LIB_CLOCK_GETTIME=$ac_cv_search_clock_getcpuclockid],
-                                     [test "$ac_cv_search_clock_gettime" = "none required" \
-                                      || LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
-                    else
-                      LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime
-                    fi])
-    AC_CHECK_FUNCS([clock_gettime clock_settime clock_getcpuclockid])
-  LIBS=$gl_saved_libs
-])
index 0eb937c..af7c3a8 100644 (file)
@@ -67,12 +67,6 @@ AC_PROG_LN_S
 
 dnl Gnulib.
 gl_INIT
-dnl FIXME: remove me and the acinclude.m4 code when clock-gettime is
-dnl fixed for clock_getcpuclockid and can be imported normally from
-dnl gnulib.  See
-dnl <http://lists.gnu.org/archive/html/bug-gnulib/2011-06/msg00227.html>
-dnl for details.
-gl_CLOCK_TIME
 
 AC_PROG_CC_C89
 
diff --git a/gnulib-local/m4/clock_time.m4.diff b/gnulib-local/m4/clock_time.m4.diff
new file mode 100644 (file)
index 0000000..57d34e1
--- /dev/null
@@ -0,0 +1,28 @@
+Remove when clock-gettime is fixed for clock_getcpuclockid.
+
+See <http://lists.gnu.org/archive/html/bug-gnulib/2011-06/msg00227.html>
+for details.
+
+diff --git a/m4/clock_time.m4 b/m4/clock_time.m4
+index 0bec0ef..fb3a17a 100644
+--- a/m4/clock_time.m4
++++ b/m4/clock_time.m4
+@@ -24,8 +24,15 @@ AC_DEFUN([gl_CLOCK_TIME],
+   AC_SUBST([LIB_CLOCK_GETTIME])
+   gl_saved_libs=$LIBS
+     AC_SEARCH_LIBS([clock_gettime], [rt posix4],
+-                   [test "$ac_cv_search_clock_gettime" = "none required" ||
+-                    LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
+-    AC_CHECK_FUNCS([clock_gettime clock_settime])
++                   [if test "$ac_cv_search_clock_gettime" = "none required"; then
++                      AC_SEARCH_LIBS([clock_getcpuclockid], [rt posix4],
++                                     [test "$ac_cv_search_clock_getcpuclockid" = "none required" \
++                                      || LIB_CLOCK_GETTIME=$ac_cv_search_clock_getcpuclockid],
++                                     [test "$ac_cv_search_clock_gettime" = "none required" \
++                                      || LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
++                    else
++                      LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime
++                    fi])
++    AC_CHECK_FUNCS([clock_gettime clock_settime clock_getcpuclockid])
+   LIBS=$gl_saved_libs
+ ])
index f6680d6..8602e13 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=. --local-dir=gnulib-local --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl ceil close connect dirfd duplocale environ extensions flock floor fpieee frexp full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen localcharset locale log1p maintainer-makefile malloc-gnu malloca nl_langinfo nproc open pipe2 putenv recv recvfrom regex rename send sendto setenv setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat trunc verify vsnprintf warnings wchar
+# Reproduce by: gnulib-tool --import --dir=. --local-dir=gnulib-local --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl ceil clock-time close connect dirfd duplocale environ extensions flock floor fpieee frexp full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen localcharset locale log1p maintainer-makefile malloc-gnu malloca nl_langinfo nproc open pipe2 putenv recv recvfrom regex rename send sendto setenv setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat trunc verify vsnprintf warnings wchar
 
 AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects
 
@@ -61,6 +61,7 @@ libgnu_la_LDFLAGS += $(ISNANF_LIBM)
 libgnu_la_LDFLAGS += $(ISNANL_LIBM)
 libgnu_la_LDFLAGS += $(LDEXP_LIBM)
 libgnu_la_LDFLAGS += $(LIBSOCKET)
+libgnu_la_LDFLAGS += $(LIB_CLOCK_GETTIME)
 libgnu_la_LDFLAGS += $(LOG1P_LIBM)
 libgnu_la_LDFLAGS += $(LOG_LIBM)
 libgnu_la_LDFLAGS += $(LTLIBICONV)
index a7644d1..e216435 100644 (file)
@@ -477,8 +477,8 @@ libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS =     \
   $(ISNANF_LIBM)                               \
   $(ISNANL_LIBM)                               \
   $(LDEXP_LIBM)                                        \
-  $(LIB_CLOCK_GETTIME)                                 \
   $(LIBSOCKET)                                 \
+  $(LIB_CLOCK_GETTIME)                         \
   $(LOG1P_LIBM)                                        \
   $(LOG_LIBM)                                  \
   $(LTLIBICONV)                                        \
index 7b6644a..654224f 100644 (file)
@@ -27,7 +27,7 @@
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --local-dir=gnulib-local --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl ceil close connect dirfd duplocale environ extensions flock floor fpieee frexp full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen localcharset locale log1p maintainer-makefile malloc-gnu malloca nl_langinfo nproc open pipe2 putenv recv recvfrom regex rename send sendto setenv setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat trunc verify vsnprintf warnings wchar
+#   gnulib-tool --import --dir=. --local-dir=gnulib-local --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl ceil clock-time close connect dirfd duplocale environ extensions flock floor fpieee frexp full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen localcharset locale log1p maintainer-makefile malloc-gnu malloca nl_langinfo nproc open pipe2 putenv recv recvfrom regex rename send sendto setenv setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat trunc verify vsnprintf warnings wchar
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([gnulib-local])
@@ -41,6 +41,7 @@ gl_MODULES([
   byteswap
   canonicalize-lgpl
   ceil
+  clock-time
   close
   connect
   dirfd
index e59aa51..13bf4e8 100644 (file)
@@ -56,6 +56,7 @@ AC_DEFUN([gl_EARLY],
   # Code from module canonicalize-lgpl:
   # Code from module ceil:
   # Code from module chdir:
+  # Code from module clock-time:
   # Code from module close:
   # Code from module configmake:
   # Code from module connect:
@@ -265,6 +266,7 @@ if test $REPLACE_CEIL = 1; then
 fi
 gl_MATH_MODULE_INDICATOR([ceil])
 gl_UNISTD_MODULE_INDICATOR([chdir])
+gl_CLOCK_TIME
 gl_FUNC_CLOSE
 if test $REPLACE_CLOSE = 1; then
   AC_LIBOBJ([close])
@@ -1049,6 +1051,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/canonicalize.m4
   m4/ceil.m4
   m4/check-math-lib.m4
+  m4/clock_time.m4
   m4/close.m4
   m4/codeset.m4
   m4/configmake.m4