+2020-12-24 Bruno Haible <bruno@clisp.org>
+
+ execute: Use posix_spawn by default on native Windows.
+ * lib/execute.c (EXECUTE_IMPL_AVOID_POSIX_SPAWN): New macro.
+ (execute): Use it to decide among the two possible implementations.
+
2020-12-24 Paul Eggert <eggert@cs.ucla.edu>
canonicalize-lgpl: merge proposed libc changes
#define _(str) gettext (str)
-#if defined _WIN32 && ! defined __CYGWIN__
+
+/* Choice of implementation for native Windows.
+ - Define to 0 to use the posix_spawn facility (modules 'posix_spawn' and
+ 'posix_spawnp'), that is based on the module 'windows-spawn'.
+ - Define to 1 to use the older code, that uses the module 'windows-spawn'
+ directly.
+ You can set this macro from a Makefile or at configure time, from the
+ CPPFLAGS. */
+#ifndef EXECUTE_IMPL_AVOID_POSIX_SPAWN
+# define EXECUTE_IMPL_AVOID_POSIX_SPAWN 0
+#endif
+
+
+#if (defined _WIN32 && !defined __CYGWIN__) && EXECUTE_IMPL_AVOID_POSIX_SPAWN
/* Native Windows API. */
# if GNULIB_MSVC_NOTHROW
#endif
-#if defined EINTR && (defined _WIN32 && ! defined __CYGWIN__)
+#if defined EINTR && (defined _WIN32 && !defined __CYGWIN__) && EXECUTE_IMPL_AVOID_POSIX_SPAWN
/* EINTR handling for close(), open().
These functions can return -1/EINTR even though we don't have any
}
}
-#if defined _WIN32 && ! defined __CYGWIN__
+#if (defined _WIN32 && !defined __CYGWIN__) && EXECUTE_IMPL_AVOID_POSIX_SPAWN
/* Native Windows API. */
|| (directory != NULL
&& (err = posix_spawn_file_actions_addchdir (&actions,
directory)))
+# if !(defined _WIN32 && !defined __CYGWIN__)
|| (slave_process
&& ((err = posix_spawnattr_init (&attrs)) != 0
|| (attrs_allocated = true,
|| (err = posix_spawnattr_setflags (&attrs,
POSIX_SPAWN_SETSIGMASK))
!= 0)))
+# endif
|| (err = (directory != NULL
? posix_spawn (&child, prog_path, &actions,
attrs_allocated ? &attrs : NULL,