summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2013-02-18 19:06:34 +0100
committerAndy Wingo <wingo@pobox.com>2013-02-18 19:06:34 +0100
commit84ebfef4e69130288d68d68c9e872402aa91363d (patch)
tree10e62c841ade19431f22b15468acf3b3b2bc59ed /m4
parent3dac6181c18508a194f240d633c8c3f7304adb3f (diff)
add gnulib `times' module
* lib: Add `times' module. Should fix socket.c on MinGW. Thanks to Eli Zaretskii for the report.
Diffstat (limited to 'm4')
-rw-r--r--m4/gnulib-cache.m43
-rw-r--r--m4/gnulib-comp.m413
-rw-r--r--m4/sys_times_h.m451
-rw-r--r--m4/times.m414
4 files changed, 80 insertions, 1 deletions
diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4
index 9fb3a9096..f8a973759 100644
--- a/m4/gnulib-cache.m4
+++ b/m4/gnulib-cache.m4
@@ -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 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 select 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 select send sendto setenv setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat times trunc verify vsnprintf warnings wchar
# Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_LOCAL_DIR([gnulib-local])
@@ -103,6 +103,7 @@ gl_MODULES([
striconveh
string
sys_stat
+ times
trunc
verify
vsnprintf
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index ef150cb3c..8dc269161 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -197,10 +197,12 @@ AC_DEFUN([gl_EARLY],
# Code from module sys_socket:
# Code from module sys_stat:
# Code from module sys_time:
+ # Code from module sys_times:
# Code from module sys_types:
# Code from module sys_uio:
# Code from module time:
# Code from module time_r:
+ # Code from module times:
# Code from module trunc:
# Code from module unistd:
# Code from module unistr/base:
@@ -685,6 +687,8 @@ AC_SUBST([LTALLOCA])
AC_PROG_MKDIR_P
gl_HEADER_SYS_TIME_H
AC_PROG_MKDIR_P
+ gl_SYS_TIMES_H
+ AC_PROG_MKDIR_P
gl_SYS_TYPES_H
AC_PROG_MKDIR_P
gl_HEADER_SYS_UIO
@@ -696,6 +700,11 @@ AC_SUBST([LTALLOCA])
gl_PREREQ_TIME_R
fi
gl_TIME_MODULE_INDICATOR([time_r])
+ gl_FUNC_TIMES
+ if test $HAVE_TIMES = 0; then
+ AC_LIBOBJ([times])
+ fi
+ gl_SYS_TIMES_MODULE_INDICATOR([times])
gl_FUNC_TRUNC
if test $HAVE_DECL_TRUNC = 0 || test $REPLACE_TRUNC = 1; then
AC_LIBOBJ([trunc])
@@ -1046,10 +1055,12 @@ AC_DEFUN([gl_FILE_LIST], [
lib/sys_socket.in.h
lib/sys_stat.in.h
lib/sys_time.in.h
+ lib/sys_times.in.h
lib/sys_types.in.h
lib/sys_uio.in.h
lib/time.in.h
lib/time_r.c
+ lib/times.c
lib/trunc.c
lib/unistd.c
lib/unistd.in.h
@@ -1211,10 +1222,12 @@ AC_DEFUN([gl_FILE_LIST], [
m4/sys_socket_h.m4
m4/sys_stat_h.m4
m4/sys_time_h.m4
+ m4/sys_times_h.m4
m4/sys_types_h.m4
m4/sys_uio_h.m4
m4/time_h.m4
m4/time_r.m4
+ m4/times.m4
m4/tm_gmtoff.m4
m4/trunc.m4
m4/unistd_h.m4
diff --git a/m4/sys_times_h.m4 b/m4/sys_times_h.m4
new file mode 100644
index 000000000..60069850d
--- /dev/null
+++ b/m4/sys_times_h.m4
@@ -0,0 +1,51 @@
+# Configure a replacement for <sys/times.h>.
+# serial 8
+
+# Copyright (C) 2008-2013 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# Written by Simon Josefsson.
+
+AC_DEFUN([gl_SYS_TIMES_H],
+[
+ AC_REQUIRE([gl_SYS_TIMES_H_DEFAULTS])
+
+ dnl <sys/times.h> is always overridden, because of GNULIB_POSIXCHECK.
+ gl_CHECK_NEXT_HEADERS([sys/times.h])
+ if test $ac_cv_header_sys_times_h = yes; then
+ HAVE_SYS_TIMES_H=1
+ AC_CHECK_TYPES([struct tms], [], [HAVE_STRUCT_TMS=0], [[
+#include <sys/times.h>
+ ]])
+ else
+ HAVE_SYS_TIMES_H=0
+ HAVE_STRUCT_TMS=0
+ fi
+ AC_SUBST([HAVE_SYS_TIMES_H])
+
+ dnl Check for declarations of anything we want to poison if the
+ dnl corresponding gnulib module is not in use.
+ gl_WARN_ON_USE_PREPARE([[
+/* Some systems have incomplete headers. */
+#if !(defined __GLIBC__ && !defined __UCLIBC__)
+# include <time.h>
+#endif
+#include <sys/times.h>
+ ]], [times])
+])
+
+AC_DEFUN([gl_SYS_TIMES_MODULE_INDICATOR],
+[
+ dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+ AC_REQUIRE([gl_SYS_TIMES_H_DEFAULTS])
+ gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+])
+
+AC_DEFUN([gl_SYS_TIMES_H_DEFAULTS],
+[
+ GNULIB_TIMES=0; AC_SUBST([GNULIB_TIMES])
+ HAVE_STRUCT_TMS=1; AC_SUBST([HAVE_STRUCT_TMS])
+ HAVE_TIMES=1; AC_SUBST([HAVE_TIMES])
+])
diff --git a/m4/times.m4 b/m4/times.m4
new file mode 100644
index 000000000..a0c86677a
--- /dev/null
+++ b/m4/times.m4
@@ -0,0 +1,14 @@
+# times.m4 serial 2
+dnl Copyright (C) 2009-2013 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.
+
+AC_DEFUN([gl_FUNC_TIMES],
+[
+ AC_REQUIRE([gl_SYS_TIMES_H_DEFAULTS])
+ AC_CHECK_FUNCS_ONCE([times])
+ if test $ac_cv_func_times = no; then
+ HAVE_TIMES=0
+ fi
+])