New module 'sys_types'.
authorBruno Haible <bruno@clisp.org>
Sun, 11 Sep 2011 16:14:00 +0000 (18:14 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 11 Sep 2011 16:14:00 +0000 (18:14 +0200)
* lib/sys_types.in.h: New file.
* m4/sys_types_h.m4: New file.
* modules/sys_types: New file.
* doc/posix-headers/sys_types.texi: Mention the new module and the
size_t problem on MSVC 9.

ChangeLog
doc/posix-headers/sys_types.texi
lib/sys_types.in.h [new file with mode: 0644]
m4/sys_types_h.m4 [new file with mode: 0644]
modules/sys_types [new file with mode: 0644]

index a44ba2e..f8b7dad 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2011-09-11  Bruno Haible  <bruno@clisp.org>
 
+       New module 'sys_types'.
+       * lib/sys_types.in.h: New file.
+       * m4/sys_types_h.m4: New file.
+       * modules/sys_types: New file.
+       * doc/posix-headers/sys_types.texi: Mention the new module and the
+       size_t problem on MSVC 9.
+
+2011-09-11  Bruno Haible  <bruno@clisp.org>
+
        Support for MSVC compiler: Avoid division by a literal 0.
        * lib/math.in.h (NAN): Define through a function call also on MSVC.
        * m4/frexp.m4 (gl_FUNC_FREXP_WORKS): Divide by 'zero' instead of 0.0.
index 1141a2b..a7d6cbc 100644 (file)
@@ -3,16 +3,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html}
 
-Gnulib module: ---
+Gnulib module: sys_types
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+The type @code{pid_t} is not defined on some platforms:
+MSVC 9.
+@item
+The type @code{size_t} is not defined in this file on some platforms:
+MSVC 9.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-The type @code{pid_t} is not defined on some platforms:
-MSVC 9.
-You can use the macro @code{AC_TYPE_PID_T} to fix this.
 @end itemize
diff --git a/lib/sys_types.in.h b/lib/sys_types.in.h
new file mode 100644 (file)
index 0000000..56e331d
--- /dev/null
@@ -0,0 +1,40 @@
+/* Provide a more complete sys/time.h.
+
+   Copyright (C) 2011 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 2, 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, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
+
+/* The include_next requires a split double-inclusion guard.  */
+#@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@
+
+#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
+#define _@GUARD_PREFIX@_SYS_TYPES_H
+
+/* MSVC 9 defines size_t in <stddef.h>, not in <sys/types.h>.  */
+/* But avoid namespace pollution on glibc systems.  */
+#if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \
+    && ! defined __GLIBC__
+# include <stddef.h>
+#endif
+
+#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */
+#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */
diff --git a/m4/sys_types_h.m4 b/m4/sys_types_h.m4
new file mode 100644 (file)
index 0000000..89dda82
--- /dev/null
@@ -0,0 +1,18 @@
+# sys_types_h.m4 serial 1
+dnl Copyright (C) 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.
+
+AC_DEFUN([gl_SYS_TYPES_H],
+[
+  AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS])
+  gl_NEXT_HEADERS([sys/types.h])
+
+  dnl Ensure the type pid_t gets defined.
+  AC_REQUIRE([AC_TYPE_PID_T])
+])
+
+AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS],
+[
+])
diff --git a/modules/sys_types b/modules/sys_types
new file mode 100644 (file)
index 0000000..2798676
--- /dev/null
@@ -0,0 +1,41 @@
+Description:
+A <sys/types.h> that conforms better to POSIX.
+
+Files:
+lib/sys_types.in.h
+m4/sys_types_h.m4
+
+Depends-on:
+include_next
+
+configure.ac:
+gl_SYS_TYPES_H
+AC_PROG_MKDIR_P
+
+Makefile.am:
+BUILT_SOURCES += sys/types.h
+
+# We need the following in order to create <sys/types.h> when the system
+# doesn't have one that works with the given compiler.
+sys/types.h: sys_types.in.h $(top_builddir)/config.status
+       $(AM_V_at)$(MKDIR_P) sys
+       $(AM_V_GEN)rm -f $@-t $@ && \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's|@''GUARD_PREFIX''@|${gl_include_guard_prefix}|g' \
+             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+             -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+             -e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \
+             < $(srcdir)/sys_types.in.h; \
+       } > $@-t && \
+       mv $@-t $@
+MOSTLYCLEANFILES += sys/types.h sys/types.h-t
+
+Include:
+<sys/types.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all