Eric Blake wrote: > Even though execute, pipe, and wait-process work just fine on mingw, the fact > that they pull in a dependency on posix_spawn on all other platforms means > that > the build attempts to compile files, like lib/spawni.c or test-posix_spawn.c > that cause failures on mingw.
Oops, thanks for reporting this. > My idea was to use an AM_CONDITIONAL to skip the attempts to compile anything > related to posix_spawn on mingw, for the benefit of programs (like m4) that > directly use execute but not posix_spawn. I would agree to this approach if posix_spawn could never be ported. But the goal is actually to make posix_spawn available on all platforms. Therefore I prefer smaller changes that are just until posix_spawn is fully ported. I'm applying this to lib/spawni.c, that gets rid of the link failure of shared libraries on mingw. Regarding the tests, Bruno 2009-03-06 Eric Blake <e...@byu.net> Bruno Haible <br...@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. --- lib/spawni.c.orig 2009-03-06 15:39:09.000000000 +0100 +++ lib/spawni.c 2009-03-06 15:12:30.000000000 +0100 @@ -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 @@ -89,6 +89,22 @@ #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 @@ /* Return with an error. */ _exit (SPAWN_ERROR); } + +#endif --- modules/posix_spawn-tests.orig 2009-03-06 15:39:09.000000000 +0100 +++ modules/posix_spawn-tests 2009-03-06 15:35:05.000000000 +0100 @@ -10,7 +10,17 @@ 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 --- modules/posix_spawnp-tests.orig 2009-03-06 15:39:09.000000000 +0100 +++ modules/posix_spawnp-tests 2009-03-06 15:35:07.000000000 +0100 @@ -20,8 +20,17 @@ 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 @@ cp $(srcdir)/test-posix_spawn2.in.sh $...@-t mv $...@-t $@ MOSTLYCLEANFILES += test-posix_spawn2.sh test-posix_spawn2.sh-t +endif