mirror of
https://github.com/mirror/make.git
synced 2024-12-28 22:00:33 +08:00
* configure.ac: Add --disable-posix-spawn option
* maintMakefile: Add a test for the option * src/job.c: Change HAVE_* preprocessor checks to USE_POSIX_SPAWN
This commit is contained in:
parent
1129df27b8
commit
a370268739
22
configure.ac
22
configure.ac
@ -357,6 +357,22 @@ AS_IF([test "$ac_cv_func_lstat" = yes && test "$ac_cv_func_readlink" = yes],
|
|||||||
[Define to 1 to enable symbolic link timestamp checking.])
|
[Define to 1 to enable symbolic link timestamp checking.])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
# Use posix_spawn if we have support and the user didn't disable it
|
||||||
|
|
||||||
|
AC_ARG_ENABLE([posix-spawn],
|
||||||
|
AC_HELP_STRING([--disable-posix-spawn],
|
||||||
|
[disable support for posix_spawn()]),
|
||||||
|
[make_cv_posix_spawn="$enableval" user_posix_spawn="$enableval"],
|
||||||
|
[make_cv_posix_spawn="yes"])
|
||||||
|
|
||||||
|
AS_CASE([/$ac_cv_header_spawn/$ac_cv_func_posix_spawn/],
|
||||||
|
[*/no/*], [make_cv_posix_spawn=no])
|
||||||
|
|
||||||
|
AS_CASE([/$make_cv_posix_spawn/$user_posix_spawn/],
|
||||||
|
[*/no/*], [make_cv_posix_spawn=no],
|
||||||
|
[AC_DEFINE(USE_POSIX_SPAWN, 1, [Define to 1 to use posix_spawn().])
|
||||||
|
])
|
||||||
|
|
||||||
# Find the SCCS commands, so we can include them in our default rules.
|
# Find the SCCS commands, so we can include them in our default rules.
|
||||||
|
|
||||||
AC_CACHE_CHECK([for location of SCCS get command], [make_cv_path_sccs_get], [
|
AC_CACHE_CHECK([for location of SCCS get command], [make_cv_path_sccs_get], [
|
||||||
@ -498,6 +514,12 @@ AS_IF([test "x$make_cv_load" = xno && test "x$user_load" = xyes],
|
|||||||
echo
|
echo
|
||||||
])
|
])
|
||||||
|
|
||||||
|
AS_IF([test "x$make_cv_posix_spawn" = xno && test "x$user_posix_spawn" = xyes],
|
||||||
|
[ echo
|
||||||
|
echo "WARNING: posix_spawn() is not supported on this system."
|
||||||
|
echo
|
||||||
|
])
|
||||||
|
|
||||||
# Specify what files are to be created.
|
# Specify what files are to be created.
|
||||||
AC_CONFIG_FILES([Makefile lib/Makefile po/Makefile.in doc/Makefile \
|
AC_CONFIG_FILES([Makefile lib/Makefile po/Makefile.in doc/Makefile \
|
||||||
tests/config-flags.pm])
|
tests/config-flags.pm])
|
||||||
|
@ -240,6 +240,7 @@ CONFIG_CHECKS := \
|
|||||||
checkcfg.--disable-job-server \
|
checkcfg.--disable-job-server \
|
||||||
checkcfg.--disable-load \
|
checkcfg.--disable-load \
|
||||||
checkcfg.--without-guile \
|
checkcfg.--without-guile \
|
||||||
|
checkcfg.--disable-posix-spawn \
|
||||||
checkcfg.make_cv_sys_gnu_glob^no \
|
checkcfg.make_cv_sys_gnu_glob^no \
|
||||||
checkcfg.ac_cv_func_getloadavg^no+ac_cv_have_decl_getloadavg^no+gl_cv_have_raw_decl_getloadavg^no+ac_cv_lib_util_getloadavg^no+ac_cv_lib_getloadavg_getloadavg^no \
|
checkcfg.ac_cv_func_getloadavg^no+ac_cv_have_decl_getloadavg^no+gl_cv_have_raw_decl_getloadavg^no+ac_cv_lib_util_getloadavg^no+ac_cv_lib_getloadavg_getloadavg^no \
|
||||||
checkcfg.CPPFLAGS^-DNO_OUTPUT_SYNC \
|
checkcfg.CPPFLAGS^-DNO_OUTPUT_SYNC \
|
||||||
|
13
src/job.c
13
src/job.c
@ -137,9 +137,9 @@ extern int wait3 ();
|
|||||||
# endif /* Have wait3. */
|
# endif /* Have wait3. */
|
||||||
#endif /* Have waitpid. */
|
#endif /* Have waitpid. */
|
||||||
|
|
||||||
#ifdef HAVE_SPAWN_H
|
#ifdef USE_POSIX_SPAWN
|
||||||
# include <spawn.h>
|
# include <spawn.h>
|
||||||
#endif /* have spawn.h */
|
#endif
|
||||||
|
|
||||||
#if !defined (wait) && !defined (POSIX)
|
#if !defined (wait) && !defined (POSIX)
|
||||||
int wait ();
|
int wait ();
|
||||||
@ -2234,13 +2234,13 @@ child_execute_job (struct output *out, int good_stdin, char **argv, char **envp)
|
|||||||
const int fdin = good_stdin ? FD_STDIN : get_bad_stdin ();
|
const int fdin = good_stdin ? FD_STDIN : get_bad_stdin ();
|
||||||
int fdout = FD_STDOUT;
|
int fdout = FD_STDOUT;
|
||||||
int fderr = FD_STDERR;
|
int fderr = FD_STDERR;
|
||||||
int r;
|
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
#if HAVE_POSIX_SPAWN
|
int r;
|
||||||
|
#if USE_POSIX_SPAWN
|
||||||
short flags = 0;
|
short flags = 0;
|
||||||
posix_spawnattr_t attr;
|
posix_spawnattr_t attr;
|
||||||
posix_spawn_file_actions_t fa;
|
posix_spawn_file_actions_t fa;
|
||||||
#endif /* have posix_spawn() */
|
#endif
|
||||||
|
|
||||||
/* Divert child output if we want to capture it. */
|
/* Divert child output if we want to capture it. */
|
||||||
if (out && out->syncout)
|
if (out && out->syncout)
|
||||||
@ -2251,8 +2251,7 @@ child_execute_job (struct output *out, int good_stdin, char **argv, char **envp)
|
|||||||
fderr = out->err;
|
fderr = out->err;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ! HAVE_POSIX_SPAWN
|
#if !defined(USE_POSIX_SPAWN)
|
||||||
/* does not have posix_spawn() */
|
|
||||||
|
|
||||||
pid = vfork();
|
pid = vfork();
|
||||||
if (pid != 0)
|
if (pid != 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user