changeset 13751:0bf7f277a1af

New module 'system-posix'. * modules/system-posix: New file. * lib/stdlib.in.h: Include <sys/wait.h> only when the 'system-posix' module is present. * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize GNULIB_SYSTEM_POSIX. * modules/stdlib (Depends-on): Remove sys_wait. (Makefile.am): Substitute GNULIB_SYSTEM_POSIX. * doc/posix-functions/system.texi: Mention the new module. * doc/posix-headers/stdlib.texi: Likewise. * tests/test-stdlib.c: If GNULIB_TEST_SYSTEM_POSIX is not defined, define test_sys_wait_macros to a no-op. Reported by Sam Steingold <sds@gnu.org>.
author Bruno Haible <bruno@clisp.org>
date Sat, 02 Oct 2010 11:44:20 +0200
parents c67c281ae7ff
children 68e7104b03e2
files ChangeLog doc/posix-functions/system.texi doc/posix-headers/stdlib.texi lib/stdlib.in.h m4/stdlib_h.m4 modules/stdlib modules/system-posix tests/test-stdlib.c
diffstat 8 files changed, 59 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2010-10-02  Bruno Haible  <bruno@clisp.org>
+
+	New module 'system-posix'.
+	* modules/system-posix: New file.
+	* lib/stdlib.in.h: Include <sys/wait.h> only when the 'system-posix'
+	module is present.
+	* m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize
+	GNULIB_SYSTEM_POSIX.
+	* modules/stdlib (Depends-on): Remove sys_wait.
+	(Makefile.am): Substitute GNULIB_SYSTEM_POSIX.
+	* doc/posix-functions/system.texi: Mention the new module.
+	* doc/posix-headers/stdlib.texi: Likewise.
+	* tests/test-stdlib.c: If GNULIB_TEST_SYSTEM_POSIX is not defined,
+	define test_sys_wait_macros to a no-op.
+	Reported by Sam Steingold <sds@gnu.org>.
+
 2010-09-30  Bruno Haible  <bruno@clisp.org>
 
 	More renaming from 'getdate' to 'get_date'.
--- a/doc/posix-functions/system.texi
+++ b/doc/posix-functions/system.texi
@@ -4,10 +4,16 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/system.html}
 
-Gnulib module: ---
+Gnulib module: system-posix
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+The macros @code{WIFSIGNALED}, @code{WIFEXITED}, @code{WIFSTOPPED},
+@code{WTERMSIG}, @code{WEXITSTATUS}, @code{WNOHANG}, @code{WUNTRACED},
+@code{WSTOPSIG} are not defined in @code{<stdlib.h>} (only in
+@code{<sys/wait.h>}) on some platforms:
+MirBSD 10.
 @end itemize
 
 Portability problems not fixed by Gnulib:
--- a/doc/posix-headers/stdlib.texi
+++ b/doc/posix-headers/stdlib.texi
@@ -3,9 +3,9 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/stdlib.h.html}
 
-Gnulib module: stdlib
+Gnulib module: stdlib, system-posix
 
-Portability problems fixed by Gnulib:
+Portability problems fixed by the Gnulib module @code{stdlib}:
 @itemize
 @item
 The macros @code{EXIT_SUCCESS} and @code{EXIT_FAILURE} are not defined on
@@ -17,7 +17,10 @@
 Some platforms provide a @code{NULL} macro that cannot be used in arbitrary
 expressions:
 NetBSD 5.0
+@end itemize
 
+Portability problems fixed by the Gnulib module @code{system-posix}:
+@itemize
 @item
 The macros @code{WIFSIGNALED}, @code{WIFEXITED}, @code{WIFSTOPPED},
 @code{WTERMSIG}, @code{WEXITSTATUS}, @code{WNOHANG}, @code{WUNTRACED},
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -39,7 +39,7 @@
 #include <stddef.h>
 
 /* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>.  */
-#ifndef WEXITSTATUS
+#if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS
 # include <sys/wait.h>
 #endif
 
--- a/m4/stdlib_h.m4
+++ b/m4/stdlib_h.m4
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 30
+# stdlib_h.m4 serial 31
 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -73,6 +73,7 @@
   GNULIB_STRTOD=0;        AC_SUBST([GNULIB_STRTOD])
   GNULIB_STRTOLL=0;       AC_SUBST([GNULIB_STRTOLL])
   GNULIB_STRTOULL=0;      AC_SUBST([GNULIB_STRTOULL])
+  GNULIB_SYSTEM_POSIX=0;  AC_SUBST([GNULIB_SYSTEM_POSIX])
   GNULIB_UNLOCKPT=0;      AC_SUBST([GNULIB_UNLOCKPT])
   GNULIB_UNSETENV=0;      AC_SUBST([GNULIB_UNSETENV])
   dnl Assume proper GNU behavior unless another module says otherwise.
--- a/modules/stdlib
+++ b/modules/stdlib
@@ -11,7 +11,6 @@
 include_next
 stddef
 stdint
-sys_wait
 unistd
 warn-on-use
 
@@ -52,6 +51,7 @@
 	      -e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \
 	      -e 's|@''GNULIB_STRTOLL''@|$(GNULIB_STRTOLL)|g' \
 	      -e 's|@''GNULIB_STRTOULL''@|$(GNULIB_STRTOULL)|g' \
+	      -e 's|@''GNULIB_SYSTEM_POSIX''@|$(GNULIB_SYSTEM_POSIX)|g' \
 	      -e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \
 	      -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \
 	      -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \
new file mode 100644
--- /dev/null
+++ b/modules/system-posix
@@ -0,0 +1,22 @@
+Description:
+system() function: execute a shell command
+
+Files:
+
+Depends-on:
+stdlib
+sys_wait
+
+configure.ac:
+gl_STDLIB_MODULE_INDICATOR([system-posix])
+
+Makefile.am:
+
+Include:
+<stdlib.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
--- a/tests/test-stdlib.c
+++ b/tests/test-stdlib.c
@@ -38,7 +38,11 @@
    per POSIX 2008.  */
 verify (sizeof NULL == sizeof (void *));
 
-#include "test-sys_wait.h"
+#if GNULIB_TEST_SYSTEM_POSIX
+# include "test-sys_wait.h"
+#else
+# define test_sys_wait_macros() 0
+#endif
 
 int
 main (void)