From 3f68e9f64ffb09416fc76db2a30bb132f04e4569 Mon Sep 17 00:00:00 2001 From: neumann Date: Fri, 30 Jun 2023 09:12:02 +0000 Subject: Added auto-configuration of posix_spawnp() Removed the manual setting of USE_POSIX_SPAWN and replaced it by HAVE_POSIX_SPAWNP. --- unix/tcl.m4 | 2 ++ unix/tclUnixPipe.c | 10 ++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 0ef9f3d..f07d55b 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -2105,6 +2105,7 @@ dnl # preprocessing tests use only CPPFLAGS. AC_SUBST(DLL_INSTALL_DIR) AC_SUBST(INSTALL_STUB_LIB) AC_SUBST(RANLIB) + AC_CHECK_FUNCS([posix_spawnp]) ]) #-------------------------------------------------------------------- @@ -3085,6 +3086,7 @@ if test "x$NEED_FAKE_RFC2553" = "x1"; then AC_CHECK_FUNC(strlcpy) fi ]) + # Local Variables: # mode: autoconf # End: diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c index f481f66..48a0e6a 100644 --- a/unix/tclUnixPipe.c +++ b/unix/tclUnixPipe.c @@ -13,9 +13,7 @@ #include "tclInt.h" -#define USE_POSIX_SPAWN 1 - -#ifdef USE_POSIX_SPAWN +#ifdef HAVE_POSIX_SPAWNP # include #endif @@ -445,7 +443,7 @@ TclpCreateProcess( newArgv[i] = Tcl_UtfToExternalDString(NULL, argv[i], -1, &dsArray[i]); } -#if defined(USE_VFORK) || defined(USE_POSIX_SPAWN) +#if defined(USE_VFORK) || defined(HAVE_POSIX_SPAWNP) /* * After vfork(), do not call code in the child that changes global state, * because it is using the parent's memory space at that point and writes @@ -465,7 +463,7 @@ TclpCreateProcess( } #endif -#ifdef USE_POSIX_SPAWN +#ifdef HAVE_POSIX_SPAWNP { posix_spawn_file_actions_t actions; posix_spawnattr_t attr; @@ -553,7 +551,7 @@ TclpCreateProcess( TclStackFree(interp, dsArray); if (pid == -1) { -#ifdef USE_POSIX_SPAWN +#ifdef HAVE_POSIX_SPAWNP Tcl_SetObjResult(interp, Tcl_ObjPrintf( "couldn't execute \"%s\": %s", argv[0], Tcl_PosixError(interp))); #else -- cgit v0.12