diff options
author | Steve Bennett <steveb@workware.net.au> | 2022-08-20 08:52:33 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2022-08-20 15:35:49 +1000 |
commit | 8b1a9e78d4322b637f72fef83b026f1e2c2d56fa (patch) | |
tree | dd6f541136c1c4939b86f04a66b44b1cfb2d40fa | |
parent | 36ba3f6cb611469b2de469d4f934a057962a64df (diff) | |
download | jimtcl-8b1a9e78d4322b637f72fef83b026f1e2c2d56fa.zip jimtcl-8b1a9e78d4322b637f72fef83b026f1e2c2d56fa.tar.gz jimtcl-8b1a9e78d4322b637f72fef83b026f1e2c2d56fa.tar.bz2 |
build: macos has deprecated vfork()
On platforms where using vfork emits a warning, use fork instead
Signed-off-by: Steve Bennett <steveb@workware.net.au>
-rw-r--r-- | auto.def | 11 | ||||
-rw-r--r-- | jim-exec.c | 6 |
2 files changed, 14 insertions, 3 deletions
@@ -157,7 +157,7 @@ if {[opt-bool extinfo]} { # The optional args are pkg-config specifications (e.g. name1 >= 1.3.4) dict set extdb info { binary { dep pack } - exec { check {([have-feature vfork] && [have-feature waitpid]) || [have-feature system]} } + exec { check {(([have-feature vfork] || [have-feature fork]) && [have-feature waitpid]) || [have-feature system]} } glob { dep readdir } load { check {[have-feature dlopen-compat] || [cc-check-function-in-lib dlopen dl]} libdep lib_dlopen } mk { check {[check-metakit]} libdep lib_mk } @@ -242,13 +242,20 @@ if {[cc-check-function-in-lib socket socket]} { define-append LDLIBS [get-define lib_socket] } -cc-check-functions ualarm lstat fork vfork system select execvpe +cc-check-functions ualarm lstat fork system select execvpe cc-check-functions geteuid mkstemp realpath isatty cc-check-functions regcomp waitpid sigaction sys_signame sys_siglist isascii cc-check-functions syslog opendir readlink sleep usleep pipe getaddrinfo utimes cc-check-functions shutdown socketpair isinf isnan link symlink fsync dup umask cc-check-functions localtime gmtime strptime clock_gettime +if {[have-feature fork]} { + # Only use vfork if not deprecated + cc-with {-nooutput 1} { + cc-check-functions vfork + } +} + if {[cc-check-function-in-lib backtrace execinfo]} { define-append LDLIBS [get-define lib_backtrace] } @@ -29,7 +29,7 @@ #include "jimautoconf.h" #include <jim.h> -#if (!defined(HAVE_VFORK) || !defined(HAVE_WAITPID)) && !defined(__MINGW32__) +#if (!(defined(HAVE_VFORK) || defined(HAVE_FORK)) || !defined(HAVE_WAITPID)) && !defined(__MINGW32__) /* Poor man's implementation of exec with system() * The system() call *may* do command line redirection, etc. * The standard output is not available. @@ -1047,7 +1047,11 @@ badargs: * Make a new process and enter it into the table if the vfork * is successful. */ +#ifdef HAVE_VFORK phandle = vfork(); +#else + phandle = fork(); +#endif if (phandle < 0) { Jim_SetResultErrno(interp, "couldn't fork child process"); goto error; |