Index: configure.in =================================================================== --- configure.in (revision 77444) +++ configure.in (working copy) @@ -1297,7 +1297,7 @@ sys/termio.h sys/time.h \ sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ -bluetooth/bluetooth.h linux/tipc.h) +bluetooth/bluetooth.h linux/tipc.h spawn.h) AC_HEADER_DIRENT AC_HEADER_MAJOR Index: Mac/Tools/pythonw.c =================================================================== --- Mac/Tools/pythonw.c (revision 77444) +++ Mac/Tools/pythonw.c (working copy) @@ -6,16 +6,26 @@ * * This program uses posix_spawn rather than plain execv because we need * slightly more control over how the "real" interpreter is executed. + * + * On OSX 10.4 (and earlier) this falls back to using exec because the + * posix_spawnv functions aren't available there. */ +#pragma weak_import posix_spawnattr_init +#pragma weak_import posix_spawnattr_setbinpref_np +#pragma weak_import posix_spawnattr_setflags +#pragma weak_import posix_spawn + +#include #include +#ifdef HAVE_SPAWN_H #include +#endif #include #include #include #include #include #include -#include extern char** environ; @@ -74,6 +84,7 @@ return g_path; } +#ifdef HAVE_SPAWN_H static void setup_spawnattr(posix_spawnattr_t* spawnattr) { @@ -132,16 +143,28 @@ /* NOTREACHTED */ } } +#endif int main(int argc, char **argv) { - posix_spawnattr_t spawnattr = NULL; char* exec_path = get_python_path(); +#ifdef HAVE_SPAWN_H - setup_spawnattr(&spawnattr); - posix_spawn(NULL, exec_path, NULL, - &spawnattr, argv, environ); - err(1, "posix_spawn: %s", argv[0]); + /* We're weak-linking to posix-spawnv to ensure that + * an executable build on 10.5 can work on 10.4. + */ + if (posix_spawn != NULL) { + posix_spawnattr_t spawnattr = NULL; + + + setup_spawnattr(&spawnattr); + posix_spawn(NULL, exec_path, NULL, + &spawnattr, argv, environ); + err(1, "posix_spawn: %s", argv[0]); + } +#endif + execve(exec_path, argv, environ); + err(1, "execve: %s", argv[0]); /* NOTREACHED */ }