[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
new module 'utime-h'
From: |
Bruno Haible |
Subject: |
new module 'utime-h' |
Date: |
Sun, 30 Apr 2017 19:29:59 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-75-generic; KDE/5.18.0; x86_64; ; ) |
Before implementing an override for the utime() function, we need the
<utime.h> header file. This patch provides it.
2017-04-29 Bruno Haible <address@hidden>
utime-h: New module.
* m4/utime_h.m4: New file.
* lib/utime.in.h: New file.
* modules/utime-h: New file.
* doc/posix-headers/utime.texi: Mention the new module.
* tests/test-utime-h.c: New file.
* modules/utime-h-tests: New file.
diff --git a/doc/posix-headers/utime.texi b/doc/posix-headers/utime.texi
index cdeb019..8db231d 100644
--- a/doc/posix-headers/utime.texi
+++ b/doc/posix-headers/utime.texi
@@ -3,15 +3,14 @@
POSIX specification:@*
@url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/utime.h.html}
-Gnulib module: ---
+Gnulib module: utime-h
Portability problems fixed by Gnulib:
@itemize
address@hidden
+This header file is missing on some platforms: MSVC 14.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
address@hidden
-This header file is missing on some platforms: MSVC 9. Use
@code{<sys/utime.h>}
-if @code{<utime.h>} is missing.
@end itemize
diff --git a/lib/utime.in.h b/lib/utime.in.h
new file mode 100644
index 0000000..0e3926a
--- /dev/null
+++ b/lib/utime.in.h
@@ -0,0 +1,22 @@
+/* Substitute for <utime.h>
+ Copyright (C) 2017 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef address@hidden@_UTIME_H
+#define address@hidden@_UTIME_H
+
+#include <sys/utime.h>
+
+#endif /* address@hidden@_UTIME_H */
diff --git a/m4/utime_h.m4 b/m4/utime_h.m4
new file mode 100644
index 0000000..c29ae42
--- /dev/null
+++ b/m4/utime_h.m4
@@ -0,0 +1,19 @@
+# utime_h.m4 serial 1
+dnl Copyright (C) 2017 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.
+
+dnl From Bruno Haible.
+
+AC_DEFUN([gl_UTIME_H],
+[
+ UTIME_H=''
+ AC_CHECK_HEADERS_ONCE([utime.h])
+ if test $ac_cv_header_utime_h != yes; then
+ dnl Provide a substitute <utime.h> file.
+ UTIME_H=utime.h
+ fi
+ AC_SUBST([UTIME_H])
+ AM_CONDITIONAL([GL_GENERATE_UTIME_H], [test -n "$UTIME_H"])
+])
diff --git a/modules/utime-h b/modules/utime-h
new file mode 100644
index 0000000..6e32c50
--- /dev/null
+++ b/modules/utime-h
@@ -0,0 +1,39 @@
+Description:
+A <utime.h> that conforms to POSIX.
+
+Files:
+lib/utime.in.h
+m4/utime_h.m4
+
+Depends-on:
+
+configure.ac:
+gl_UTIME_H
+
+Makefile.am:
+BUILT_SOURCES += $(UTIME_H)
+
+# We need the following in order to create <utime.h> when the system
+# doesn't have one that works with the given compiler.
+if GL_GENERATE_UTIME_H
+utime.h: utime.in.h $(top_builddir)/config.status
+ $(AM_V_GEN)rm -f address@hidden $@ && \
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+ sed -e 's|@''GUARD_PREFIX''@|${gl_include_guard_prefix}|g' \
+ < $(srcdir)/utime.in.h; \
+ } > address@hidden && \
+ mv address@hidden $@
+else
+utime.h: $(top_builddir)/config.status
+ rm -f $@
+endif
+MOSTLYCLEANFILES += utime.h utime.h-t
+
+Include:
+<utime.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
diff --git a/modules/utime-h-tests b/modules/utime-h-tests
new file mode 100644
index 0000000..804fd60
--- /dev/null
+++ b/modules/utime-h-tests
@@ -0,0 +1,10 @@
+Files:
+tests/test-utime-h.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-utime-h
+check_PROGRAMS += test-utime-h
diff --git a/tests/test-utime-h.c b/tests/test-utime-h.c
new file mode 100644
index 0000000..a694024
--- /dev/null
+++ b/tests/test-utime-h.c
@@ -0,0 +1,32 @@
+/* Test of <utime.h> substitute.
+ Copyright (C) 2017 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Bruno Haible <address@hidden>, 2017. */
+
+#include <config.h>
+
+#include <utime.h>
+
+/* Check that 'struct utimbuf' is defined. */
+struct utimbuf b;
+
+int
+main (void)
+{
+ b.actime = b.modtime = 1493490248; /* 2017-04-29 18:24:08 GMT */
+
+ return 0;
+}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- new module 'utime-h',
Bruno Haible <=