Avoid type conflicts if overriding system header.
* m4/spawn_h.m4 (gl_SPAWN_H): Check for type existence.
(gl_SPAWN_H_DEFAULTS): New defaults.
* modules/spawn (Makefile.am): Substitute them.
* lib/spawn.in.h: (posix_spawnattr_t, posix_spawn_file_actions_t):
Only declare if missing or broken.
Signed-off-by: Eric Blake <ebb9@byu.net>
2009-12-31 Eric Blake <ebb9@byu.net>
+ spawn: improve wrapper support
+ * m4/spawn_h.m4 (gl_SPAWN_H): Check for type existence.
+ (gl_SPAWN_H_DEFAULTS): New defaults.
+ * modules/spawn (Makefile.am): Substitute them.
+ * lib/spawn.in.h: (posix_spawnattr_t, posix_spawn_file_actions_t):
+ Only declare if missing or broken.
+
sys_times, sys_utsname: use include_next
* m4/sys_times_h.m4 (gl_SYS_TIMES_H): Support wrapping an existing
header.
#if @REPLACE_POSIX_SPAWN@
# define posix_spawnattr_t rpl_posix_spawnattr_t
#endif
+#if @REPLACE_POSIX_SPAWN@ || !@HAVE_POSIX_SPAWNATTR_T@
typedef struct
{
short int _flags;
int _policy;
int __pad[16];
} posix_spawnattr_t;
+#endif
/* Data structure to contain information about the actions to be
#if @REPLACE_POSIX_SPAWN@
# define posix_spawn_file_actions_t rpl_posix_spawn_file_actions_t
#endif
+#if @REPLACE_POSIX_SPAWN@ || !@HAVE_POSIX_SPAWN_FILE_ACTIONS_T@
typedef struct
{
int _allocated;
struct __spawn_action *_actions;
int __pad[16];
} posix_spawn_file_actions_t;
+#endif
/* Flags to be set in the `posix_spawnattr_t'. */
-# spawn_h.m4 serial 3
+# spawn_h.m4 serial 4
dnl Copyright (C) 2008-2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_CHECK_HEADERS_ONCE([spawn.h])
if test $ac_cv_header_spawn_h = yes; then
HAVE_SPAWN_H=1
+ AC_CHECK_TYPES([posix_spawnattr_t], [], [HAVE_POSIX_SPAWNATTR_T=0], [[
+#include <spawn.h>
+ ]])
+ AC_CHECK_TYPES([posix_spawn_file_actions_t], [],
+ [HAVE_POSIX_SPAWN_FILE_ACTIONS_T=0], [[
+#include <spawn.h>
+ ]])
else
HAVE_SPAWN_H=0
+ HAVE_POSIX_SPAWNATTR_T=0
+ HAVE_POSIX_SPAWN_FILE_ACTIONS_T=0
gl_REPLACE_SPAWN_H
fi
AC_SUBST([HAVE_SPAWN_H])
GNULIB_POSIX_SPAWNATTR_SETSIGMASK=0; AC_SUBST([GNULIB_POSIX_SPAWNATTR_SETSIGMASK])
GNULIB_POSIX_SPAWNATTR_DESTROY=0; AC_SUBST([GNULIB_POSIX_SPAWNATTR_DESTROY])
dnl Assume proper GNU behavior unless another module says otherwise.
- HAVE_POSIX_SPAWN=1; AC_SUBST([HAVE_POSIX_SPAWN])
- REPLACE_POSIX_SPAWN=0; AC_SUBST([REPLACE_POSIX_SPAWN])
- SPAWN_H=''; AC_SUBST([SPAWN_H])
+ HAVE_POSIX_SPAWN=1; AC_SUBST([HAVE_POSIX_SPAWN])
+ HAVE_POSIX_SPAWNATTR_T=1; AC_SUBST([HAVE_POSIX_SPAWNATTR_T])
+ HAVE_POSIX_SPAWN_FILE_ACTIONS_T=1;
+ AC_SUBST([HAVE_POSIX_SPAWN_FILE_ACTIONS_T])
+ REPLACE_POSIX_SPAWN=0; AC_SUBST([REPLACE_POSIX_SPAWN])
+ SPAWN_H=''; AC_SUBST([SPAWN_H])
])
-e 's|@''GNULIB_POSIX_SPAWNATTR_SETSIGMASK''@|$(GNULIB_POSIX_SPAWNATTR_SETSIGMASK)|g' \
-e 's|@''GNULIB_POSIX_SPAWNATTR_DESTROY''@|$(GNULIB_POSIX_SPAWNATTR_DESTROY)|g' \
-e 's|@''HAVE_POSIX_SPAWN''@|$(HAVE_POSIX_SPAWN)|g' \
+ -e 's|@''HAVE_POSIX_SPAWNATTR_T''@|$(HAVE_POSIX_SPAWNATTR_T)|g' \
+ -e 's|@''HAVE_POSIX_SPAWN_FILE_ACTIONS_T''@|$(HAVE_POSIX_SPAWN_FILE_ACTIONS_T)|g' \
-e 's|@''REPLACE_POSIX_SPAWN''@|$(REPLACE_POSIX_SPAWN)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \