diff options
author | Philipp Stephani <phst@google.com> | 2020-12-30 14:42:01 +0100 |
---|---|---|
committer | Philipp Stephani <phst@google.com> | 2021-11-13 16:45:19 +0100 |
commit | cc4edea872ca653f3e0631ce50e47b5260c6773a (patch) | |
tree | 1687f6dc24ee03aade146c749504d3b8d7b9e73f /configure.ac | |
parent | a56dd60d2fba9d873748ca3831ba61711628f698 (diff) | |
download | emacs-cc4edea872ca653f3e0631ce50e47b5260c6773a.tar.gz emacs-cc4edea872ca653f3e0631ce50e47b5260c6773a.tar.bz2 emacs-cc4edea872ca653f3e0631ce50e47b5260c6773a.zip |
Use posix_spawn if possible.
posix_spawn is less error-prone than vfork + execve, and can make
better use of system-specific enhancements like 'clone' on Linux. Use
it if we don't need to configure a pseudoterminal.
Backported from commit a60053f8368e058229721f1bf1567c2b1676b239.
Unlike that commit, only define USABLE_POSIX_SPAWN on macOS, because
there posix_spawn is much faster than vfork.
Don't merge to master.
* configure.ac (HAVE_SPAWN_H, HAVE_POSIX_SPAWN)
(HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR)
(HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR_NP)
(HAVE_POSIX_SPAWNATTR_SETFLAGS, HAVE_DECL_POSIX_SPAWN_SETSID): New
configuration variables.
* src/callproc.c (USABLE_POSIX_SPAWN): New configuration macro.
(emacs_posix_spawn_init_actions)
(emacs_posix_spawn_init_attributes, emacs_posix_spawn_init): New
helper functions.
(emacs_spawn): Use posix_spawn if possible.
(cherry picked from commit a60053f8368e058229721f1bf1567c2b1676b239)
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 6bc194d792f..253f5bfcd67 100644 --- a/configure.ac +++ b/configure.ac @@ -4746,6 +4746,23 @@ dnl AC_CHECK_FUNCS_ONCE wouldn’t be right for snprintf, which needs dnl the current CFLAGS etc. AC_CHECK_FUNCS(snprintf) +dnl posix_spawn. The chdir and setsid functionality is relatively +dnl recent, so we check for it specifically. +AC_CHECK_HEADERS([spawn.h]) +AC_SUBST([HAVE_SPAWN_H]) +AC_CHECK_FUNCS([posix_spawn \ + posix_spawn_file_actions_addchdir \ + posix_spawn_file_actions_addchdir_np \ + posix_spawnattr_setflags]) +AC_SUBST([HAVE_POSIX_SPAWN]) +AC_SUBST([HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR]) +AC_SUBST([HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR_NP]) +AC_SUBST([HAVE_POSIX_SPAWNATTR_SETFLAGS]) +AC_CHECK_DECLS([POSIX_SPAWN_SETSID], [], [], [[ + #include <spawn.h> + ]]) +AC_SUBST([HAVE_DECL_POSIX_SPAWN_SETSID]) + dnl Check for glib. This differs from other library checks in that dnl Emacs need not link to glib unless some other library is already dnl linking to glib. Although glib provides no facilities that Emacs |