summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2020-12-25 14:51:20 +0200
committerEli Zaretskii <eliz@gnu.org>2020-12-25 14:51:20 +0200
commitecf84a22ee002112c265b028263f1db81e3271e1 (patch)
tree87543f2f0992a6b57a34dbd6ee04f48c3f6e7486 /m4
parente387371497d313f05b94e3bf42fe6685184605d1 (diff)
downloademacs-ecf84a22ee002112c265b028263f1db81e3271e1.tar.gz
Revert "Import posix_spawn from Gnulib."
This reverts commit 3ba34141da77a24c251ee6530f3f72a366fe556e. It breaks the MinGW build and should be first tested on a branch.
Diffstat (limited to 'm4')
-rw-r--r--m4/gnulib-comp.m4144
-rw-r--r--m4/posix_spawn.m4678
-rw-r--r--m4/posix_spawn_faction_addchdir.m420
-rw-r--r--m4/sched_h.m491
-rw-r--r--m4/sh-filename.m422
-rw-r--r--m4/spawn_h.m4136
-rw-r--r--m4/strchrnul.m450
7 files changed, 0 insertions, 1141 deletions
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index e2a44efe621..0971636c33d 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -139,18 +139,6 @@ AC_DEFUN([gl_EARLY],
# Code from module openat-h:
# Code from module pathmax:
# Code from module pipe2:
- # Code from module posix_spawn:
- # Code from module posix_spawn-internal:
- # Code from module posix_spawn_file_actions_addchdir:
- # Code from module posix_spawn_file_actions_adddup2:
- # Code from module posix_spawn_file_actions_destroy:
- # Code from module posix_spawn_file_actions_init:
- # Code from module posix_spawnattr_destroy:
- # Code from module posix_spawnattr_init:
- # Code from module posix_spawnattr_setflags:
- # Code from module posix_spawnattr_setpgroup:
- # Code from module posix_spawnattr_setsigdefault:
- # Code from module posix_spawnattr_setsigmask:
# Code from module pselect:
# Code from module pthread_sigmask:
# Code from module qcopy-acl:
@@ -159,9 +147,7 @@ AC_DEFUN([gl_EARLY],
# Code from module readlinkat:
# Code from module regex:
# Code from module root-uid:
- # Code from module sched:
# Code from module scratch_buffer:
- # Code from module sh-filename:
# Code from module sig2str:
# Code from module sigdescr_np:
# Code from module signal-h:
@@ -170,7 +156,6 @@ AC_DEFUN([gl_EARLY],
# Code from module snippet/c++defs:
# Code from module snippet/warn-on-use:
# Code from module socklen:
- # Code from module spawn:
# Code from module ssize_t:
# Code from module stat-time:
# Code from module std-gnu11:
@@ -180,7 +165,6 @@ AC_DEFUN([gl_EARLY],
# Code from module stdio:
# Code from module stdlib:
# Code from module stpcpy:
- # Code from module strchrnul:
# Code from module string:
# Code from module strnlen:
# Code from module strtoimax:
@@ -419,61 +403,6 @@ AC_DEFUN([gl_INIT],
gl_PATHMAX
gl_FUNC_PIPE2
gl_UNISTD_MODULE_INDICATOR([pipe2])
- gl_POSIX_SPAWN
- if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
- AC_LIBOBJ([spawn])
- fi
- gl_SPAWN_MODULE_INDICATOR([posix_spawn])
- gl_FUNC_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR
- if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1 || test $HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR = 0 || test $REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR = 1; then
- AC_LIBOBJ([spawn_faction_addchdir])
- fi
- gl_SPAWN_MODULE_INDICATOR([posix_spawn_file_actions_addchdir])
- gl_FUNC_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2
- if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1 || test $REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2 = 1; then
- AC_LIBOBJ([spawn_faction_adddup2])
- fi
- gl_SPAWN_MODULE_INDICATOR([posix_spawn_file_actions_adddup2])
- gl_POSIX_SPAWN
- if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
- AC_LIBOBJ([spawn_faction_destroy])
- fi
- gl_SPAWN_MODULE_INDICATOR([posix_spawn_file_actions_destroy])
- gl_POSIX_SPAWN
- if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
- AC_LIBOBJ([spawn_faction_init])
- fi
- gl_SPAWN_MODULE_INDICATOR([posix_spawn_file_actions_init])
- gl_POSIX_SPAWN
- if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
- AC_LIBOBJ([spawnattr_destroy])
- fi
- gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_destroy])
- gl_POSIX_SPAWN
- if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
- AC_LIBOBJ([spawnattr_init])
- fi
- gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_init])
- gl_POSIX_SPAWN
- if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
- AC_LIBOBJ([spawnattr_setflags])
- fi
- gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_setflags])
- gl_POSIX_SPAWN
- if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
- AC_LIBOBJ([spawnattr_setpgroup])
- fi
- gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_setpgroup])
- gl_POSIX_SPAWN
- if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
- AC_LIBOBJ([spawnattr_setdefault])
- fi
- gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_setsigdefault])
- gl_POSIX_SPAWN
- if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
- AC_LIBOBJ([spawnattr_setsigmask])
- fi
- gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_setsigmask])
gl_FUNC_PSELECT
if test $HAVE_PSELECT = 0 || test $REPLACE_PSELECT = 1; then
AC_LIBOBJ([pselect])
@@ -501,7 +430,6 @@ AC_DEFUN([gl_INIT],
AC_LIBOBJ([regex])
gl_PREREQ_REGEX
fi
- gl_SCHED_H
gl_FUNC_SIG2STR
if test $ac_cv_func_sig2str = no; then
AC_LIBOBJ([sig2str])
@@ -514,7 +442,6 @@ AC_DEFUN([gl_INIT],
gl_STRING_MODULE_INDICATOR([sigdescr_np])
gl_SIGNAL_H
gl_TYPE_SOCKLEN_T
- gl_SPAWN_H
gt_TYPE_SSIZE_T
gl_STAT_TIME
gl_STAT_BIRTHTIME
@@ -601,12 +528,9 @@ AC_DEFUN([gl_INIT],
gl_gnulib_enabled_5264294aa0a5557541b53c8c741f7f31=false
gl_gnulib_enabled_open=false
gl_gnulib_enabled_03e0aaad4cb89ca757653bd367a6ccb7=false
- gl_gnulib_enabled_332607f759618fb73dfc3076748afea7=false
gl_gnulib_enabled_rawmemchr=false
gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c=false
gl_gnulib_enabled_scratch_buffer=false
- gl_gnulib_enabled_cdeb0f2aaf9d280baa6526bfa1b07f70=false
- gl_gnulib_enabled_strchrnul=false
gl_gnulib_enabled_strtoll=false
gl_gnulib_enabled_utimens=false
gl_gnulib_enabled_682e609604ccaac6be382e4ee3a4eaec=false
@@ -761,20 +685,6 @@ AC_DEFUN([gl_INIT],
gl_gnulib_enabled_03e0aaad4cb89ca757653bd367a6ccb7=true
fi
}
- func_gl_gnulib_m4code_332607f759618fb73dfc3076748afea7 ()
- {
- if ! $gl_gnulib_enabled_332607f759618fb73dfc3076748afea7; then
- gl_POSIX_SPAWN
- if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
- AC_LIBOBJ([spawni])
- gl_PREREQ_POSIX_SPAWN_INTERNAL
- fi
- gl_gnulib_enabled_332607f759618fb73dfc3076748afea7=true
- func_gl_gnulib_m4code_open
- func_gl_gnulib_m4code_cdeb0f2aaf9d280baa6526bfa1b07f70
- func_gl_gnulib_m4code_strchrnul
- fi
- }
func_gl_gnulib_m4code_rawmemchr ()
{
if ! $gl_gnulib_enabled_rawmemchr; then
@@ -799,28 +709,6 @@ AC_DEFUN([gl_INIT],
gl_gnulib_enabled_scratch_buffer=true
fi
}
- func_gl_gnulib_m4code_cdeb0f2aaf9d280baa6526bfa1b07f70 ()
- {
- if ! $gl_gnulib_enabled_cdeb0f2aaf9d280baa6526bfa1b07f70; then
- gl_SH_FILENAME
- gl_gnulib_enabled_cdeb0f2aaf9d280baa6526bfa1b07f70=true
- fi
- }
- func_gl_gnulib_m4code_strchrnul ()
- {
- if ! $gl_gnulib_enabled_strchrnul; then
- gl_FUNC_STRCHRNUL
- if test $HAVE_STRCHRNUL = 0 || test $REPLACE_STRCHRNUL = 1; then
- AC_LIBOBJ([strchrnul])
- gl_PREREQ_STRCHRNUL
- fi
- gl_STRING_MODULE_INDICATOR([strchrnul])
- gl_gnulib_enabled_strchrnul=true
- if test $HAVE_STRCHRNUL = 0 || test $REPLACE_STRCHRNUL = 1; then
- func_gl_gnulib_m4code_rawmemchr
- fi
- fi
- }
func_gl_gnulib_m4code_strtoll ()
{
if ! $gl_gnulib_enabled_strtoll; then
@@ -903,12 +791,6 @@ AC_DEFUN([gl_INIT],
if case $host_os in mingw*) false;; *) test $HAVE_GETRANDOM = 0 || test $REPLACE_GETRANDOM = 1;; esac; then
func_gl_gnulib_m4code_open
fi
- if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
- func_gl_gnulib_m4code_332607f759618fb73dfc3076748afea7
- fi
- if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1 || test $REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2 = 1; then
- func_gl_gnulib_m4code_getdtablesize
- fi
if test $HAVE_READLINKAT = 0 || test $REPLACE_READLINKAT = 1; then
func_gl_gnulib_m4code_260941c0e5dc67ec9e87d1fb321c300b
fi
@@ -948,12 +830,9 @@ AC_DEFUN([gl_INIT],
AM_CONDITIONAL([gl_GNULIB_ENABLED_5264294aa0a5557541b53c8c741f7f31], [$gl_gnulib_enabled_5264294aa0a5557541b53c8c741f7f31])
AM_CONDITIONAL([gl_GNULIB_ENABLED_open], [$gl_gnulib_enabled_open])
AM_CONDITIONAL([gl_GNULIB_ENABLED_03e0aaad4cb89ca757653bd367a6ccb7], [$gl_gnulib_enabled_03e0aaad4cb89ca757653bd367a6ccb7])
- AM_CONDITIONAL([gl_GNULIB_ENABLED_332607f759618fb73dfc3076748afea7], [$gl_gnulib_enabled_332607f759618fb73dfc3076748afea7])
AM_CONDITIONAL([gl_GNULIB_ENABLED_rawmemchr], [$gl_gnulib_enabled_rawmemchr])
AM_CONDITIONAL([gl_GNULIB_ENABLED_6099e9737f757db36c47fa9d9f02e88c], [$gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c])
AM_CONDITIONAL([gl_GNULIB_ENABLED_scratch_buffer], [$gl_gnulib_enabled_scratch_buffer])
- AM_CONDITIONAL([gl_GNULIB_ENABLED_cdeb0f2aaf9d280baa6526bfa1b07f70], [$gl_gnulib_enabled_cdeb0f2aaf9d280baa6526bfa1b07f70])
- AM_CONDITIONAL([gl_GNULIB_ENABLED_strchrnul], [$gl_gnulib_enabled_strchrnul])
AM_CONDITIONAL([gl_GNULIB_ENABLED_strtoll], [$gl_gnulib_enabled_strtoll])
AM_CONDITIONAL([gl_GNULIB_ENABLED_utimens], [$gl_gnulib_enabled_utimens])
AM_CONDITIONAL([gl_GNULIB_ENABLED_682e609604ccaac6be382e4ee3a4eaec], [$gl_gnulib_enabled_682e609604ccaac6be382e4ee3a4eaec])
@@ -1234,7 +1113,6 @@ AC_DEFUN([gl_FILE_LIST], [
lib/regex_internal.h
lib/regexec.c
lib/root-uid.h
- lib/sched.in.h
lib/scratch_buffer.h
lib/set-permissions.c
lib/sha1.c
@@ -1247,20 +1125,6 @@ AC_DEFUN([gl_FILE_LIST], [
lib/sig2str.h
lib/sigdescr_np.c
lib/signal.in.h
- lib/spawn.c
- lib/spawn.in.h
- lib/spawn_faction_addchdir.c
- lib/spawn_faction_adddup2.c
- lib/spawn_faction_destroy.c
- lib/spawn_faction_init.c
- lib/spawn_int.h
- lib/spawnattr_destroy.c
- lib/spawnattr_init.c
- lib/spawnattr_setdefault.c
- lib/spawnattr_setflags.c
- lib/spawnattr_setpgroup.c
- lib/spawnattr_setsigmask.c
- lib/spawni.c
lib/stat-time.c
lib/stat-time.h
lib/stdalign.in.h
@@ -1271,8 +1135,6 @@ AC_DEFUN([gl_FILE_LIST], [
lib/stdlib.in.h
lib/stpcpy.c
lib/str-two-way.h
- lib/strchrnul.c
- lib/strchrnul.valgrind
lib/strftime.h
lib/string.in.h
lib/strnlen.c
@@ -1386,16 +1248,12 @@ AC_DEFUN([gl_FILE_LIST], [
m4/pathmax.m4
m4/pid_t.m4
m4/pipe2.m4
- m4/posix_spawn.m4
- m4/posix_spawn_faction_addchdir.m4
m4/pselect.m4
m4/pthread_sigmask.m4
m4/rawmemchr.m4
m4/readlink.m4
m4/readlinkat.m4
m4/regex.m4
- m4/sched_h.m4
- m4/sh-filename.m4
m4/sha1.m4
m4/sha256.m4
m4/sha512.m4
@@ -1403,7 +1261,6 @@ AC_DEFUN([gl_FILE_LIST], [
m4/sigdescr_np.m4
m4/signal_h.m4
m4/socklen.m4
- m4/spawn_h.m4
m4/ssize_t.m4
m4/stat-time.m4
m4/std-gnu11.m4
@@ -1413,7 +1270,6 @@ AC_DEFUN([gl_FILE_LIST], [
m4/stdio_h.m4
m4/stdlib_h.m4
m4/stpcpy.m4
- m4/strchrnul.m4
m4/string_h.m4
m4/strnlen.m4
m4/strtoimax.m4
diff --git a/m4/posix_spawn.m4 b/m4/posix_spawn.m4
deleted file mode 100644
index 59e56fcb5f2..00000000000
--- a/m4/posix_spawn.m4
+++ /dev/null
@@ -1,678 +0,0 @@
-# posix_spawn.m4 serial 19
-dnl Copyright (C) 2008-2020 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl Tests whether the entire posix_spawn facility is available.
-AC_DEFUN([gl_POSIX_SPAWN],
-[
- AC_REQUIRE([gl_POSIX_SPAWN_BODY])
-])
-
-AC_DEFUN([gl_POSIX_SPAWN_BODY],
-[
- AC_REQUIRE([gl_SPAWN_H_DEFAULTS])
- AC_REQUIRE([gl_HAVE_POSIX_SPAWN])
- dnl Assume that when the main function exists, all the others,
- dnl except posix_spawnattr_{get,set}sched*, are available as well.
- dnl AC_CHECK_FUNCS_ONCE([posix_spawnp])
- dnl AC_CHECK_FUNCS_ONCE([posix_spawn_file_actions_init])
- dnl AC_CHECK_FUNCS_ONCE([posix_spawn_file_actions_addclose])
- dnl AC_CHECK_FUNCS_ONCE([posix_spawn_file_actions_adddup2])
- dnl AC_CHECK_FUNCS_ONCE([posix_spawn_file_actions_addopen])
- dnl AC_CHECK_FUNCS_ONCE([posix_spawn_file_actions_destroy])
- dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_init])
- dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_getflags])
- dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_setflags])
- dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_getpgroup])
- dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_setpgroup])
- dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_getsigdefault])
- dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_setsigdefault])
- dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_getsigmask])
- dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_setsigmask])
- dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_destroy])
- if test $ac_cv_func_posix_spawn = yes; then
- m4_ifdef([gl_FUNC_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR],
- [dnl Module 'posix_spawn_file_actions_addchdir' is present.
- AC_CHECK_FUNCS_ONCE([posix_spawn_file_actions_addchdir_np])
- if test $ac_cv_func_posix_spawn_file_actions_addchdir_np = no; then
- dnl In order to implement the posix_spawn_file_actions_addchdir
- dnl function, we need to replace the entire posix_spawn facility.
- REPLACE_POSIX_SPAWN=1
- fi
- ])
- m4_ifdef([gl_FUNC_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR],
- [dnl Module 'posix_spawn_file_actions_addfchdir' is present.
- AC_CHECK_FUNCS_ONCE([posix_spawn_file_actions_addfchdir_np])
- if test $ac_cv_func_posix_spawn_file_actions_addfchdir_np = no; then
- dnl In order to implement the posix_spawn_file_actions_addfchdir
- dnl function, we need to replace the entire posix_spawn facility.
- REPLACE_POSIX_SPAWN=1
- fi
- ])
- if test $REPLACE_POSIX_SPAWN = 0; then
- gl_POSIX_SPAWN_WORKS
- case "$gl_cv_func_posix_spawn_works" in
- *yes) ;;
- *) REPLACE_POSIX_SPAWN=1 ;;
- esac
- fi
- if test $REPLACE_POSIX_SPAWN = 0; then
- gl_POSIX_SPAWN_SECURE
- case "$gl_cv_func_posix_spawn_secure_exec" in
- *yes) ;;
- *) REPLACE_POSIX_SPAWN=1 ;;
- esac
- case "$gl_cv_func_posix_spawnp_secure_exec" in
- *yes) ;;
- *) REPLACE_POSIX_SPAWN=1 ;;
- esac
- fi
- if test $REPLACE_POSIX_SPAWN = 0; then
- dnl Assume that these functions are available if POSIX_SPAWN_SETSCHEDULER
- dnl evaluates to nonzero.
- dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_getschedpolicy])
- dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_setschedpolicy])
- AC_CACHE_CHECK([whether posix_spawnattr_setschedpolicy is supported],
- [gl_cv_func_spawnattr_setschedpolicy],
- [AC_EGREP_CPP([POSIX scheduling supported], [
-#include <spawn.h>
-#if POSIX_SPAWN_SETSCHEDULER
- POSIX scheduling supported
-#endif
-],
- [gl_cv_func_spawnattr_setschedpolicy=yes],
- [gl_cv_func_spawnattr_setschedpolicy=no])
- ])
- dnl Assume that these functions are available if POSIX_SPAWN_SETSCHEDPARAM
- dnl evaluates to nonzero.
- dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_getschedparam])
- dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_setschedparam])
- AC_CACHE_CHECK([whether posix_spawnattr_setschedparam is supported],
- [gl_cv_func_spawnattr_setschedparam],
- [AC_EGREP_CPP([POSIX scheduling supported], [
-#include <spawn.h>
-#if POSIX_SPAWN_SETSCHEDPARAM
- POSIX scheduling supported
-#endif
-],
- [gl_cv_func_spawnattr_setschedparam=yes],
- [gl_cv_func_spawnattr_setschedparam=no])
- ])
- fi
- fi
- if test $ac_cv_func_posix_spawn != yes || test $REPLACE_POSIX_SPAWN = 1; then
- AC_DEFINE([REPLACE_POSIX_SPAWN], [1],
- [Define if gnulib uses its own posix_spawn and posix_spawnp functions.])
- fi
-])
-
-dnl Test whether posix_spawn actually works.
-dnl posix_spawn on AIX 5.3..6.1 has two bugs:
-dnl 1) When it fails to execute the program, the child process exits with
-dnl exit() rather than _exit(), which causes the stdio buffers to be
-dnl flushed. Reported by Rainer Tammer.
-dnl 2) The posix_spawn_file_actions_addopen function does not support file
-dnl names that contain a '*'.
-dnl posix_spawn on AIX 5.3..6.1 has also a third bug: It does not work
-dnl when POSIX threads are used. But we don't test against this bug here.
-AC_DEFUN([gl_POSIX_SPAWN_WORKS],
-[
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_CACHE_CHECK([whether posix_spawn works], [gl_cv_func_posix_spawn_works],
- [if test $cross_compiling = no; then
- AC_LINK_IFELSE([AC_LANG_SOURCE([[
-#include <errno.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <spawn.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-]GL_MDA_DEFINES[
-
-extern char **environ;
-
-#ifndef STDIN_FILENO
-# define STDIN_FILENO 0
-#endif
-#ifndef STDOUT_FILENO
-# define STDOUT_FILENO 1
-#endif
-#ifndef STDERR_FILENO
-# define STDERR_FILENO 2
-#endif
-
-#ifndef WTERMSIG
-# define WTERMSIG(x) ((x) & 0x7f)
-#endif
-#ifndef WIFEXITED
-# define WIFEXITED(x) (WTERMSIG (x) == 0)
-#endif
-#ifndef WEXITSTATUS
-# define WEXITSTATUS(x) (((x) >> 8) & 0xff)
-#endif
-
-#define CHILD_PROGRAM_FILENAME "/non/exist/ent"
-
-static int
-fd_safer (int fd)
-{
- if (0 <= fd && fd <= 2)
- {
- int f = fd_safer (dup (fd));
- int e = errno;
- close (fd);
- errno = e;
- fd = f;
- }
-
- return fd;
-}
-
-int
-main ()
-{
- char *argv[2] = { CHILD_PROGRAM_FILENAME, NULL };
- int ofd[2];
- sigset_t blocked_signals;
- sigset_t fatal_signal_set;
- posix_spawn_file_actions_t actions;
- bool actions_allocated;
- posix_spawnattr_t attrs;
- bool attrs_allocated;
- int err;
- pid_t child;
- int status;
- int exitstatus;
-
- setvbuf (stdout, NULL, _IOFBF, 0);
- puts ("This should be seen only once.");
- if (pipe (ofd) < 0 || (ofd[1] = fd_safer (ofd[1])) < 0)
- {
- perror ("cannot create pipe");
- exit (1);
- }
- sigprocmask (SIG_SETMASK, NULL, &blocked_signals);
- sigemptyset (&fatal_signal_set);
- sigaddset (&fatal_signal_set, SIGINT);
- sigaddset (&fatal_signal_set, SIGTERM);
- sigaddset (&fatal_signal_set, SIGHUP);
- sigaddset (&fatal_signal_set, SIGPIPE);
- sigprocmask (SIG_BLOCK, &fatal_signal_set, NULL);
- actions_allocated = false;
- attrs_allocated = false;
- if ((err = posix_spawn_file_actions_init (&actions)) != 0
- || (actions_allocated = true,
- (err = posix_spawn_file_actions_adddup2 (&actions, ofd[0], STDIN_FILENO)) != 0
- || (err = posix_spawn_file_actions_addclose (&actions, ofd[0])) != 0
- || (err = posix_spawn_file_actions_addclose (&actions, ofd[1])) != 0
- || (err = posix_spawnattr_init (&attrs)) != 0
- || (attrs_allocated = true,
- (err = posix_spawnattr_setsigmask (&attrs, &blocked_signals)) != 0
- || (err = posix_spawnattr_setflags (&attrs, POSIX_SPAWN_SETSIGMASK)) != 0)
- || (err = posix_spawnp (&child, CHILD_PROGRAM_FILENAME, &actions, &attrs, argv, environ)) != 0))
- {
- if (actions_allocated)
- posix_spawn_file_actions_destroy (&actions);
- if (attrs_allocated)
- posix_spawnattr_destroy (&attrs);
- sigprocmask (SIG_UNBLOCK, &fatal_signal_set, NULL);
- if (err == ENOENT)
- return 0;
- else
- {
- errno = err;
- perror ("subprocess failed");
- exit (1);
- }
- }
- posix_spawn_file_actions_destroy (&actions);
- posix_spawnattr_destroy (&attrs);
- sigprocmask (SIG_UNBLOCK, &fatal_signal_set, NULL);
- close (ofd[0]);
- close (ofd[1]);
- status = 0;
- while (waitpid (child, &status, 0) != child)
- ;
- if (!WIFEXITED (status))
- {
- fprintf (stderr, "subprocess terminated with unexpected wait status %d\n", status);
- exit (1);
- }
- exitstatus = WEXITSTATUS (status);
- if (exitstatus != 127)
- {
- fprintf (stderr, "subprocess terminated with unexpected exit status %d\n", exitstatus);
- exit (1);
- }
- return 0;
-}
-]])],
- [if test -s conftest$ac_exeext \
- && ./conftest$ac_exeext > conftest.out \
- && echo 'This should be seen only once.' > conftest.ok \
- && cmp conftest.out conftest.ok >/dev/null 2>&1; then
- gl_cv_func_posix_spawn_works=yes
- else
- gl_cv_func_posix_spawn_works=no
- fi],
- [gl_cv_func_posix_spawn_works=no])
- if test $gl_cv_func_posix_spawn_works = yes; then
- AC_RUN_IFELSE([AC_LANG_SOURCE([[
-/* Test whether posix_spawn_file_actions_addopen supports filename arguments
- that contain special characters such as '*'. */
-
-#include <errno.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <spawn.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-]GL_MDA_DEFINES[
-
-extern char **environ;
-
-#ifndef STDIN_FILENO
-# define STDIN_FILENO 0
-#endif
-#ifndef STDOUT_FILENO
-# define STDOUT_FILENO 1
-#endif
-#ifndef STDERR_FILENO
-# define STDERR_FILENO 2
-#endif
-
-#ifndef WTERMSIG
-# define WTERMSIG(x) ((x) & 0x7f)
-#endif
-#ifndef WIFEXITED
-# define WIFEXITED(x) (WTERMSIG (x) == 0)
-#endif
-#ifndef WEXITSTATUS
-# define WEXITSTATUS(x) (((x) >> 8) & 0xff)
-#endif
-
-#define CHILD_PROGRAM_FILENAME "conftest"
-#define DATA_FILENAME "conftest%=*#?"
-
-static int
-parent_main (void)
-{
- FILE *fp;
- char *argv[3] = { CHILD_PROGRAM_FILENAME, "-child", NULL };
- posix_spawn_file_actions_t actions;
- bool actions_allocated;
- int err;
- pid_t child;
- int status;
- int exitstatus;
-
- /* Create a data file with specific contents. */
- fp = fopen (DATA_FILENAME, "wb");
- if (fp == NULL)
- {
- perror ("cannot create data file");
- return 1;
- }
- fwrite ("Halle Potta", 1, 11, fp);
- if (fflush (fp) || fclose (fp))
- {
- perror ("cannot prepare data file");
- return 2;
- }
-
- /* Avoid reading from our stdin, as it could block. */
- freopen ("/dev/null", "rb", stdin);
-
- /* Test whether posix_spawn_file_actions_addopen with this file name
- actually works, but spawning a child that reads from this file. */
- actions_allocated = false;
- if ((err = posix_spawn_file_actions_init (&actions)) != 0
- || (actions_allocated = true,
- (err = posix_spawn_file_actions_addopen (&actions, STDIN_FILENO, DATA_FILENAME, O_RDONLY, 0600)) != 0
- || (err = posix_spawn (&child, CHILD_PROGRAM_FILENAME, &actions, NULL, argv, environ)) != 0))
- {
- if (actions_allocated)
- posix_spawn_file_actions_destroy (&actions);
- errno = err;
- perror ("subprocess failed");
- return 3;
- }
- posix_spawn_file_actions_destroy (&actions);
- status = 0;
- while (waitpid (child, &status, 0) != child)
- ;
- if (!WIFEXITED (status))
- {
- fprintf (stderr, "subprocess terminated with unexpected wait status %d\n", status);
- return 4;
- }
- exitstatus = WEXITSTATUS (status);
- if (exitstatus != 0)
- {
- fprintf (stderr, "subprocess terminated with unexpected exit status %d\n", exitstatus);
- return 5;
- }
- return 0;
-}
-
-static int
-child_main (void)
-{
- char buf[1024];
-
- /* See if reading from STDIN_FILENO yields the expected contents. */
- if (fread (buf, 1, sizeof (buf), stdin) == 11
- && memcmp (buf, "Halle Potta", 11) == 0)
- return 0;
- else
- return 8;
-}
-
-static void
-cleanup_then_die (int sig)
-{
- /* Clean up data file. */
- unlink (DATA_FILENAME);
-
- /* Re-raise the signal and die from it. */
- signal (sig, SIG_DFL);
- raise (sig);
-}
-
-int
-main (int argc, char *argv[])
-{
- int exitstatus;
-
- if (!(argc > 1 && strcmp (argv[1], "-child") == 0))
- {
- /* This is the parent process. */
- signal (SIGINT, cleanup_then_die);
- signal (SIGTERM, cleanup_then_die);
- #ifdef SIGHUP
- signal (SIGHUP, cleanup_then_die);
- #endif
-
- exitstatus = parent_main ();
- }
- else
- {
- /* This is the child process. */
-
- exitstatus = child_main ();
- }
- unlink (DATA_FILENAME);
- return exitstatus;
-}
-]])],
- [],
- [gl_cv_func_posix_spawn_works=no])
- fi
- else
- case "$host_os" in
- aix*) gl_cv_func_posix_spawn_works="guessing no";;
- *) gl_cv_func_posix_spawn_works="guessing yes";;
- esac
- fi
- ])
-])
-
-dnl Test whether posix_spawn and posix_spawnp are secure.
-AC_DEFUN([gl_POSIX_SPAWN_SECURE],
-[
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- dnl On many platforms, posix_spawn or posix_spawnp allow executing a
- dnl script without a '#!' marker as a shell script. This is unsecure.
- AC_CACHE_CHECK([whether posix_spawn rejects scripts without shebang],
- [gl_cv_func_posix_spawn_secure_exec],
- [echo ':' > conftest.scr
- chmod a+x conftest.scr
- AC_RUN_IFELSE([AC_LANG_SOURCE([[
- #include <errno.h>
- #include <spawn.h>
- #include <stddef.h>
- #include <sys/types.h>
- #include <sys/wait.h>
- int
- main ()
- {
- const char *prog_path = "./conftest.scr";
- const char *prog_argv[2] = { prog_path, NULL };
- const char *environment[2] = { "PATH=.", NULL };
- pid_t child;
- int status;
- int err = posix_spawn (&child, prog_path, NULL, NULL,
- (char **) prog_argv, (char **) environment);
- if (err == ENOEXEC)
- return 0;
- if (err != 0)
- return 1;
- status = 0;
- while (waitpid (child, &status, 0) != child)
- ;
- if (!WIFEXITED (status))
- return 2;
- if (WEXITSTATUS (status) != 127)
- return 3;
- return 0;
- }
- ]])],
- [gl_cv_func_posix_spawn_secure_exec=yes],
- [gl_cv_func_posix_spawn_secure_exec=no],
- [case "$host_os" in
- # Guess no on GNU/Hurd.
- gnu*)
- gl_cv_func_posix_spawn_secure_exec="guessing no" ;;
- # Guess yes on all other platforms.
- *)
- gl_cv_func_posix_spawn_secure_exec="guessing yes" ;;
- esac
- ])
- rm -f conftest.scr
- ])
- AC_CACHE_CHECK([whether posix_spawnp rejects scripts without shebang],
- [gl_cv_func_posix_spawnp_secure_exec],
- [echo ':' > conftest.scr
- chmod a+x conftest.scr
- AC_RUN_IFELSE([AC_LANG_SOURCE([[
- #include <errno.h>
- #include <spawn.h>
- #include <stddef.h>
- #include <sys/types.h>
- #include <sys/wait.h>
- int
- main ()
- {
- const char *prog_path = "./conftest.scr";
- const char *prog_argv[2] = { prog_path, NULL };
- const char *environment[2] = { "PATH=.", NULL };
- pid_t child;
- int status;
- int err = posix_spawnp (&child, prog_path, NULL, NULL,
- (char **) prog_argv, (char **) environment);
- if (err == ENOEXEC)
- return 0;
- if (err != 0)
- return 1;
- status = 0;
- while (waitpid (child, &status, 0) != child)
- ;
- if (!WIFEXITED (status))
- return 2;
- if (WEXITSTATUS (status) != 127)
- return 3;
- return 0;
- }
- ]])],
- [gl_cv_func_posix_spawnp_secure_exec=yes],
- [gl_cv_func_posix_spawnp_secure_exec=no],
- [case "$host_os" in
- # Guess yes on glibc systems (glibc >= 2.15 actually) except GNU/Hurd,
- # musl libc, NetBSD.
- *-gnu* | *-musl* | netbsd*)
- gl_cv_func_posix_spawnp_secure_exec="guessing yes" ;;
- # Guess no on GNU/Hurd, macOS, FreeBSD, OpenBSD, AIX, Solaris, Cygwin.
- gnu* | darwin* | freebsd* | dragonfly* | openbsd* | aix* | solaris* | cygwin*)
- gl_cv_func_posix_spawnp_secure_exec="guessing no" ;;
- # If we don't know, obey --enable-cross-guesses.
- *)
- gl_cv_func_posix_spawnp_secure_exec="$gl_cross_guess_normal" ;;
- esac
- ])
- rm -f conftest.scr
- ])
-])
-
-# Prerequisites of lib/spawni.c.
-AC_DEFUN([gl_PREREQ_POSIX_SPAWN_INTERNAL],
-[
- AC_CHECK_HEADERS([paths.h])
- AC_CHECK_FUNCS([confstr sched_setparam sched_setscheduler setegid seteuid vfork])
-])
-
-AC_DEFUN([gl_FUNC_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE],
-[
- AC_REQUIRE([gl_SPAWN_H_DEFAULTS])
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- gl_POSIX_SPAWN
- if test $REPLACE_POSIX_SPAWN = 1; then
- REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE=1
- else
- dnl On musl libc and Solaris 11.0, posix_spawn_file_actions_addclose
- dnl succeeds even if the fd argument is out of range.
- AC_CACHE_CHECK([whether posix_spawn_file_actions_addclose works],
- [gl_cv_func_posix_spawn_file_actions_addclose_works],
- [AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[
-#include <spawn.h>
-int main ()
-{
- posix_spawn_file_actions_t actions;
- if (posix_spawn_file_actions_init (&actions) != 0)
- return 1;
- if (posix_spawn_file_actions_addclose (&actions, 10000000) == 0)
- return 2;
- return 0;
-}]])],
- [gl_cv_func_posix_spawn_file_actions_addclose_works=yes],
- [gl_cv_func_posix_spawn_file_actions_addclose_works=no],
- [# Guess no on musl libc and Solaris, yes otherwise.
- case "$host_os" in
- *-musl*) gl_cv_func_posix_spawn_file_actions_addclose_works="guessing no" ;;
- solaris*) gl_cv_func_posix_spawn_file_actions_addclose_works="guessing no" ;;
- # Guess no on native Windows.
- mingw*) gl_cv_func_posix_spawn_file_actions_addclose_works="guessing no" ;;
- *) gl_cv_func_posix_spawn_file_actions_addclose_works="guessing yes" ;;
- esac
- ])
- ])
- case "$gl_cv_func_posix_spawn_file_actions_addclose_works" in
- *yes) ;;
- *) REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE=1 ;;
- esac
- fi
-])
-
-AC_DEFUN([gl_FUNC_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2],
-[
- AC_REQUIRE([gl_SPAWN_H_DEFAULTS])
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- gl_POSIX_SPAWN
- if test $REPLACE_POSIX_SPAWN = 1; then
- REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2=1
- else
- dnl On musl libc and Solaris 11.0, posix_spawn_file_actions_adddup2
- dnl succeeds even if the fd argument is out of range.
- AC_CACHE_CHECK([whether posix_spawn_file_actions_adddup2 works],
- [gl_cv_func_posix_spawn_file_actions_adddup2_works],
- [AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[
-#include <spawn.h>
-int main ()
-{
- posix_spawn_file_actions_t actions;
- if (posix_spawn_file_actions_init (&actions) != 0)
- return 1;
- if (posix_spawn_file_actions_adddup2 (&actions, 10000000, 2) == 0)
- return 2;
- return 0;
-}]])],
- [gl_cv_func_posix_spawn_file_actions_adddup2_works=yes],
- [gl_cv_func_posix_spawn_file_actions_adddup2_works=no],
- [# Guess no on musl libc and Solaris, yes otherwise.
- case "$host_os" in
- *-musl*) gl_cv_func_posix_spawn_file_actions_adddup2_works="guessing no";;
- solaris*) gl_cv_func_posix_spawn_file_actions_adddup2_works="guessing no";;
- # Guess no on native Windows.
- mingw*) gl_cv_func_posix_spawn_file_actions_adddup2_works="guessing no" ;;
- *) gl_cv_func_posix_spawn_file_actions_adddup2_works="guessing yes";;
- esac
- ])
- ])
- case "$gl_cv_func_posix_spawn_file_actions_adddup2_works" in
- *yes) ;;
- *) REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2=1 ;;
- esac
- fi
-])
-
-AC_DEFUN([gl_FUNC_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN],
-[
- AC_REQUIRE([gl_SPAWN_H_DEFAULTS])
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- gl_POSIX_SPAWN
- if test $REPLACE_POSIX_SPAWN = 1; then
- REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN=1
- else
- dnl On musl libc and Solaris 11.0, posix_spawn_file_actions_addopen
- dnl succeeds even if the fd argument is out of range.
- AC_CACHE_CHECK([whether posix_spawn_file_actions_addopen works],
- [gl_cv_func_posix_spawn_file_actions_addopen_works],
- [AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[
-#include <spawn.h>
-#include <fcntl.h>
-int main ()
-{
- posix_spawn_file_actions_t actions;
- if (posix_spawn_file_actions_init (&actions) != 0)
- return 1;
- if (posix_spawn_file_actions_addopen (&actions, 10000000, "foo", 0, O_RDONLY)
- == 0)
- return 2;
- return 0;
-}]])],
- [gl_cv_func_posix_spawn_file_actions_addopen_works=yes],
- [gl_cv_func_posix_spawn_file_actions_addopen_works=no],
- [# Guess no on musl libc and Solaris, yes otherwise.
- case "$host_os" in
- *-musl*) gl_cv_func_posix_spawn_file_actions_addopen_works="guessing no";;
- solaris*) gl_cv_func_posix_spawn_file_actions_addopen_works="guessing no";;
- # Guess no on native Windows.
- mingw*) gl_cv_func_posix_spawn_file_actions_addopen_works="guessing no" ;;
- *) gl_cv_func_posix_spawn_file_actions_addopen_works="guessing yes";;
- esac
- ])
- ])
- case "$gl_cv_func_posix_spawn_file_actions_addopen_works" in
- *yes) ;;
- *) REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN=1 ;;
- esac
- fi
-])
diff --git a/m4/posix_spawn_faction_addchdir.m4 b/m4/posix_spawn_faction_addchdir.m4
deleted file mode 100644
index 1ce7153d1d1..00000000000
--- a/m4/posix_spawn_faction_addchdir.m4
+++ /dev/null
@@ -1,20 +0,0 @@
-# posix_spawn_faction_addchdir.m4 serial 1
-dnl Copyright (C) 2018-2020 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_FUNC_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR],
-[
- AC_REQUIRE([gl_SPAWN_H_DEFAULTS])
- AC_REQUIRE([AC_PROG_CC])
- gl_POSIX_SPAWN
- AC_CHECK_FUNCS_ONCE([posix_spawn_file_actions_addchdir posix_spawn_file_actions_addchdir_np])
- if test $ac_cv_func_posix_spawn_file_actions_addchdir = yes; then
- dnl This function is not yet standardized. Therefore override the
- dnl system's implementation always.
- REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR=1
- else
- HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR=0
- fi
-])
diff --git a/m4/sched_h.m4 b/m4/sched_h.m4
deleted file mode 100644
index af0c43de079..00000000000
--- a/m4/sched_h.m4
+++ /dev/null
@@ -1,91 +0,0 @@
-# sched_h.m4 serial 12
-dnl Copyright (C) 2008-2020 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl Written by Bruno Haible.
-
-AC_DEFUN([gl_SCHED_H],
-[
- dnl Use AC_REQUIRE here, so that the default behavior below is expanded
- dnl once only, before all statements that occur in other macros.
- AC_REQUIRE([gl_SCHED_H_DEFAULTS])
-
- AC_REQUIRE([AC_CANONICAL_HOST])
-
- AC_CHECK_HEADERS_ONCE([sys/cdefs.h])
- AC_CHECK_HEADERS([sched.h], [], [],
- [[#if HAVE_SYS_CDEFS_H
- #include <sys/cdefs.h>
- #endif
- ]])
- gl_NEXT_HEADERS([sched.h])
-
- if test "$ac_cv_header_sched_h" = yes; then
- HAVE_SCHED_H=1
- else
- HAVE_SCHED_H=0
- fi
- AC_SUBST([HAVE_SCHED_H])
-
- if test "$HAVE_SCHED_H" = 1; then
- AC_CHECK_TYPE([struct sched_param],
- [HAVE_STRUCT_SCHED_PARAM=1], [HAVE_STRUCT_SCHED_PARAM=0],
- [[#if HAVE_SYS_CDEFS_H
- #include <sys/cdefs.h>
- #endif
- #include <sched.h>
- ]])
- else
- HAVE_STRUCT_SCHED_PARAM=0
- case "$host_os" in
- os2*)
- dnl On OS/2 kLIBC, struct sched_param is in spawn.h.
- AC_CHECK_TYPE([struct sched_param],
- [HAVE_STRUCT_SCHED_PARAM=1], [],
- [#include <spawn.h>])
- ;;
- vms)
- dnl On OpenVMS 7.2 or newer, struct sched_param is in pthread.h.
- AC_CHECK_TYPE([struct sched_param],
- [HAVE_STRUCT_SCHED_PARAM=1], [],
- [#include <pthread.h>])
- ;;
- esac
- fi
- AC_SUBST([HAVE_STRUCT_SCHED_PARAM])
-
- if test "$ac_cv_header_sys_cdefs_h" = yes; then
- HAVE_SYS_CDEFS_H=1
- else
- HAVE_SYS_CDEFS_H=0
- fi
- AC_SUBST([HAVE_SYS_CDEFS_H])
-
- dnl Ensure the type pid_t gets defined.
- AC_REQUIRE([AC_TYPE_PID_T])
-
- dnl Check for declarations of anything we want to poison if the
- dnl corresponding gnulib module is not in use, if it is not common
- dnl enough to be declared everywhere.
- gl_WARN_ON_USE_PREPARE([[#include <sched.h>
- ]], [sched_yield])
-])
-
-AC_DEFUN([gl_SCHED_MODULE_INDICATOR],
-[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_SCHED_H_DEFAULTS])
- gl_MODULE_INDICATOR_SET_VARIABLE([$1])
- dnl Define it also as a C macro, for the benefit of the unit tests.
- gl_MODULE_INDICATOR_FOR_TESTS([$1])
-])
-
-AC_DEFUN([gl_SCHED_H_DEFAULTS],
-[
- GNULIB_SCHED_YIELD=0; AC_SUBST([GNULIB_SCHED_YIELD])
- dnl Assume proper GNU behavior unless another module says otherwise.
- HAVE_SCHED_YIELD=1; AC_SUBST([HAVE_SCHED_YIELD])
- REPLACE_SCHED_YIELD=0; AC_SUBST([REPLACE_SCHED_YIELD])
-])
diff --git a/m4/sh-filename.m4 b/m4/sh-filename.m4
deleted file mode 100644
index f7b31548e0d..00000000000
--- a/m4/sh-filename.m4
+++ /dev/null
@@ -1,22 +0,0 @@
-# sh-filename.m4 serial 2
-dnl Copyright (C) 2018-2020 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Bruno Haible.
-
-AC_DEFUN([gl_SH_FILENAME],
-[
- AH_VERBATIM([SH_FILENAME],
-[/* File name of the Bourne shell. */
-#if defined __CYGWIN__ || defined __ANDROID__
-/* Omit the directory part because
- - For 32-bit Cygwin programs in a 64-bit Cygwin environment, the Cygwin
- mounts are not visible.
- - On Android, /bin/sh does not exist. It's /system/bin/sh instead. */
-# define BOURNE_SHELL "sh"
-#else
-# define BOURNE_SHELL "/bin/sh"
-#endif])
-])
diff --git a/m4/spawn_h.m4 b/m4/spawn_h.m4
deleted file mode 100644
index 781f9f49652..00000000000
--- a/m4/spawn_h.m4
+++ /dev/null
@@ -1,136 +0,0 @@
-# spawn_h.m4 serial 18
-dnl Copyright (C) 2008-2020 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl Written by Bruno Haible.
-
-AC_DEFUN([gl_SPAWN_H],
-[
- dnl Use AC_REQUIRE here, so that the default behavior below is expanded
- dnl once only, before all statements that occur in other macros.
- AC_REQUIRE([gl_SPAWN_H_DEFAULTS])
-
- dnl <spawn.h> is always overridden, because of GNULIB_POSIXCHECK.
- gl_CHECK_NEXT_HEADERS([spawn.h])
-
- if test $ac_cv_header_spawn_h = yes; then
- HAVE_SPAWN_H=1
- AC_CHECK_TYPES([posix_spawnattr_t], [], [HAVE_POSIX_SPAWNATTR_T=0], [[
-#include <spawn.h>
- ]])
- AC_CHECK_TYPES([posix_spawn_file_actions_t], [],
- [HAVE_POSIX_SPAWN_FILE_ACTIONS_T=0], [[
-#include <spawn.h>
- ]])
- else
- HAVE_SPAWN_H=0
- HAVE_POSIX_SPAWNATTR_T=0
- HAVE_POSIX_SPAWN_FILE_ACTIONS_T=0
- fi
- AC_SUBST([HAVE_SPAWN_H])
-
- dnl Ensure the type pid_t gets defined.
- AC_REQUIRE([AC_TYPE_PID_T])
-
- dnl Ensure the type mode_t gets defined.
- AC_REQUIRE([AC_TYPE_MODE_T])
-
- AC_REQUIRE([gl_HAVE_POSIX_SPAWN])
-
- AC_REQUIRE([AC_C_RESTRICT])
-
- dnl Check for declarations of anything we want to poison if the
- dnl corresponding gnulib module is not in use.
- gl_WARN_ON_USE_PREPARE([[#include <spawn.h>
- ]], [posix_spawn posix_spawnp posix_spawnattr_init posix_spawnattr_destroy
- posix_spawnattr_getsigdefault posix_spawnattr_setsigdefault
- posix_spawnattr_getsigmask posix_spawnattr_setsigmask
- posix_spawnattr_getflags posix_spawnattr_setflags
- posix_spawnattr_getpgroup posix_spawnattr_setpgroup
- posix_spawnattr_getschedpolicy posix_spawnattr_setschedpolicy
- posix_spawnattr_getschedparam posix_spawnattr_setschedparam
- posix_spawn_file_actions_init posix_spawn_file_actions_destroy
- posix_spawn_file_actions_addopen posix_spawn_file_actions_addclose
- posix_spawn_file_actions_adddup2 posix_spawn_file_actions_addchdir
- posix_spawn_file_actions_addfchdir])
-])
-
-dnl Checks whether the system has the functions posix_spawn.
-dnl Sets ac_cv_func_posix_spawn and HAVE_POSIX_SPAWN.
-AC_DEFUN([gl_HAVE_POSIX_SPAWN],
-[
- dnl Use AC_REQUIRE here, so that the default behavior below is expanded
- dnl once only, before all statements that occur in other macros.
- AC_REQUIRE([gl_SPAWN_H_DEFAULTS])
-
- LIB_POSIX_SPAWN=
- AC_SUBST([LIB_POSIX_SPAWN])
- gl_saved_libs=$LIBS
- AC_SEARCH_LIBS([posix_spawn], [rt],
- [test "$ac_cv_search_posix_spawn" = "none required" ||
- LIB_POSIX_SPAWN=$ac_cv_search_posix_spawn])
- AC_CHECK_FUNCS([posix_spawn])
- LIBS=$gl_saved_libs
-
- if test $ac_cv_func_posix_spawn != yes; then
- HAVE_POSIX_SPAWN=0
- fi
-])
-
-AC_DEFUN([gl_SPAWN_MODULE_INDICATOR],
-[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_SPAWN_H_DEFAULTS])
- gl_MODULE_INDICATOR_SET_VARIABLE([$1])
- dnl Define it also as a C macro, for the benefit of the unit tests.
- gl_MODULE_INDICATOR_FOR_TESTS([$1])
-])
-
-AC_DEFUN([gl_SPAWN_H_DEFAULTS],
-[
- GNULIB_POSIX_SPAWN=0; AC_SUBST([GNULIB_POSIX_SPAWN])
- GNULIB_POSIX_SPAWNP=0; AC_SUBST([GNULIB_POSIX_SPAWNP])
- GNULIB_POSIX_SPAWN_FILE_ACTIONS_INIT=0; AC_SUBST([GNULIB_POSIX_SPAWN_FILE_ACTIONS_INIT])
- GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR=0; AC_SUBST([GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR])
- GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE=0; AC_SUBST([GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE])
- GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2=0; AC_SUBST([GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2])
- GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR=0; AC_SUBST([GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR])
- GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN=0; AC_SUBST([GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN])
- GNULIB_POSIX_SPAWN_FILE_ACTIONS_DESTROY=0; AC_SUBST([GNULIB_POSIX_SPAWN_FILE_ACTIONS_DESTROY])
- GNULIB_POSIX_SPAWNATTR_INIT=0; AC_SUBST([GNULIB_POSIX_SPAWNATTR_INIT])
- GNULIB_POSIX_SPAWNATTR_GETFLAGS=0; AC_SUBST([GNULIB_POSIX_SPAWNATTR_GETFLAGS])
- GNULIB_POSIX_SPAWNATTR_SETFLAGS=0; AC_SUBST([GNULIB_POSIX_SPAWNATTR_SETFLAGS])
- GNULIB_POSIX_SPAWNATTR_GETPGROUP=0; AC_SUBST([GNULIB_POSIX_SPAWNATTR_GETPGROUP])
- GNULIB_POSIX_SPAWNATTR_SETPGROUP=0; AC_SUBST([GNULIB_POSIX_SPAWNATTR_SETPGROUP])
- GNULIB_POSIX_SPAWNATTR_GETSCHEDPARAM=0; AC_SUBST([GNULIB_POSIX_SPAWNATTR_GETSCHEDPARAM])
- GNULIB_POSIX_SPAWNATTR_SETSCHEDPARAM=0; AC_SUBST([GNULIB_POSIX_SPAWNATTR_SETSCHEDPARAM])
- GNULIB_POSIX_SPAWNATTR_GETSCHEDPOLICY=0; AC_SUBST([GNULIB_POSIX_SPAWNATTR_GETSCHEDPOLICY])
- GNULIB_POSIX_SPAWNATTR_SETSCHEDPOLICY=0; AC_SUBST([GNULIB_POSIX_SPAWNATTR_SETSCHEDPOLICY])
- GNULIB_POSIX_SPAWNATTR_GETSIGDEFAULT=0; AC_SUBST([GNULIB_POSIX_SPAWNATTR_GETSIGDEFAULT])
- GNULIB_POSIX_SPAWNATTR_SETSIGDEFAULT=0; AC_SUBST([GNULIB_POSIX_SPAWNATTR_SETSIGDEFAULT])
- GNULIB_POSIX_SPAWNATTR_GETSIGMASK=0; AC_SUBST([GNULIB_POSIX_SPAWNATTR_GETSIGMASK])
- GNULIB_POSIX_SPAWNATTR_SETSIGMASK=0; AC_SUBST([GNULIB_POSIX_SPAWNATTR_SETSIGMASK])
- GNULIB_POSIX_SPAWNATTR_DESTROY=0; AC_SUBST([GNULIB_POSIX_SPAWNATTR_DESTROY])
- dnl Assume proper GNU behavior unless another module says otherwise.
- HAVE_POSIX_SPAWN=1; AC_SUBST([HAVE_POSIX_SPAWN])
- HAVE_POSIX_SPAWNATTR_T=1; AC_SUBST([HAVE_POSIX_SPAWNATTR_T])
- HAVE_POSIX_SPAWN_FILE_ACTIONS_T=1;
- AC_SUBST([HAVE_POSIX_SPAWN_FILE_ACTIONS_T])
- HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR=1;
- AC_SUBST([HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR])
- HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR=1;
- AC_SUBST([HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR])
- REPLACE_POSIX_SPAWN=0; AC_SUBST([REPLACE_POSIX_SPAWN])
- REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR=0;
- AC_SUBST([REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR])
- REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE=0;
- AC_SUBST([REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE])
- REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2=0;
- AC_SUBST([REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2])
- REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR=0;
- AC_SUBST([REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR])
- REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN=0;
- AC_SUBST([REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN])
-])
diff --git a/m4/strchrnul.m4 b/m4/strchrnul.m4
deleted file mode 100644
index a18f0935a51..00000000000
--- a/m4/strchrnul.m4
+++ /dev/null
@@ -1,50 +0,0 @@
-# strchrnul.m4 serial 9
-dnl Copyright (C) 2003, 2007, 2009-2020 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_FUNC_STRCHRNUL],
-[
- dnl Persuade glibc <string.h> to declare strchrnul().
- AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
-
- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
- AC_CHECK_FUNCS([strchrnul])
- if test $ac_cv_func_strchrnul = no; then
- HAVE_STRCHRNUL=0
- else
- AC_CACHE_CHECK([whether strchrnul works],
- [gl_cv_func_strchrnul_works],
- [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-#include <string.h> /* for strchrnul */
-]], [[const char *buf = "a";
- return strchrnul (buf, 'b') != buf + 1;
- ]])],
- [gl_cv_func_strchrnul_works=yes],
- [gl_cv_func_strchrnul_works=no],
- [dnl Cygwin 1.7.9 introduced strchrnul, but it was broken until 1.7.10
- AC_EGREP_CPP([Lucky user],
- [
-#if defined __CYGWIN__
- #include <cygwin/version.h>
- #if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 9)
- Lucky user
- #endif
-#else
- Lucky user
-#endif
- ],
- [gl_cv_func_strchrnul_works="guessing yes"],
- [gl_cv_func_strchrnul_works="guessing no"])
- ])
- ])
- case "$gl_cv_func_strchrnul_works" in
- *yes) ;;
- *) REPLACE_STRCHRNUL=1 ;;
- esac
- fi
-])
-
-# Prerequisites of lib/strchrnul.c.
-AC_DEFUN([gl_PREREQ_STRCHRNUL], [:])