Avoid errors from posix_spawn on platforms where it is not yet ported to.
authorBruno Haible <bruno@clisp.org>
Fri, 6 Mar 2009 14:39:33 +0000 (15:39 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 6 Mar 2009 14:39:33 +0000 (15:39 +0100)
ChangeLog
lib/spawni.c
modules/posix_spawn-tests
modules/posix_spawnp-tests

index 78ca71b..0ce35d0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,15 @@
 2009-03-06  Eric Blake  <ebb9@byu.net>
+            Bruno Haible  <bruno@clisp.org>
+
+       * lib/spawni.c (__spawni) [WIN32_NATIVE]: Define as a stub.
+       * modules/posix_spawn-tests (configure.ac): Define POSIX_SPAWN_PORTED
+       condition.
+       (Makefile.am): Do nothing if POSIX_SPAWN_PORTED is false.
+       * modules/posix_spawnp-tests (configure.ac): Define POSIX_SPAWN_PORTED
+       condition.
+       (Makefile.am): Do nothing if POSIX_SPAWN_PORTED is false.
+
+2009-03-06  Eric Blake  <ebb9@byu.net>
 
        * lib/execute.c (execute) [WIN32_NATIVE]: Cast arguments of spawnvpe,
        to avoid compiler warnings.
index ea65553..484a50b 100644 (file)
@@ -1,5 +1,5 @@
 /* Guts of POSIX spawn interface.  Generic POSIX.1 version.
-   Copyright (C) 2000-2005, 2006, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2000-2006, 2008-2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    This program is free software: you can redistribute it and/or modify
 #define SPAWN_ERROR    127
 
 
+#if defined _MSC_VER || defined __MINGW32__
+
+/* Native Woe32 API.  */
+int
+__spawni (pid_t *pid, const char *file,
+         const posix_spawn_file_actions_t *file_actions,
+         const posix_spawnattr_t *attrp, char *const argv[],
+         char *const envp[], int use_path)
+{
+  /* Not yet implemented.  */
+  return ENOSYS;
+}
+
+#else
+
+
 /* The file is accessible but it is not an executable file.  Invoke
    the shell to interpret it as a script.  */
 static void
@@ -354,3 +370,5 @@ __spawni (pid_t *pid, const char *file,
   /* Return with an error.  */
   _exit (SPAWN_ERROR);
 }
+
+#endif
index b34ea1d..fc62cea 100644 (file)
@@ -10,7 +10,17 @@ unistd
 sys_wait
 
 configure.ac:
+AC_EGREP_CPP([notposix], [[
+#if defined _MSC_VER || defined __MINGW32__
+  notposix
+#endif
+  ]],
+  [posix_spawn_ported=no],
+  [posix_spawn_ported=yes])
+AM_CONDITIONAL([POSIX_SPAWN_PORTED], [test $posix_spawn_ported = yes])
 
 Makefile.am:
+if POSIX_SPAWN_PORTED
 TESTS += test-posix_spawn3
 check_PROGRAMS += test-posix_spawn3
+endif
index 7c04580..f8c7233 100644 (file)
@@ -20,8 +20,17 @@ unistd
 sys_wait
 
 configure.ac:
+AC_EGREP_CPP([notposix], [[
+#if defined _MSC_VER || defined __MINGW32__
+  notposix
+#endif
+  ]],
+  [posix_spawn_ported=no],
+  [posix_spawn_ported=yes])
+AM_CONDITIONAL([POSIX_SPAWN_PORTED], [test $posix_spawn_ported = yes])
 
 Makefile.am:
+if POSIX_SPAWN_PORTED
 TESTS += test-posix_spawn1 test-posix_spawn2
 check_PROGRAMS += test-posix_spawn1 test-posix_spawn2
 
@@ -36,3 +45,4 @@ test-posix_spawn2.sh: test-posix_spawn2.in.sh
        cp $(srcdir)/test-posix_spawn2.in.sh $@-t
        mv $@-t $@
 MOSTLYCLEANFILES += test-posix_spawn2.sh test-posix_spawn2.sh-t
+endif