From 4d42b019057dc6674402b50f189b5796457e5f33 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 13 May 2021 15:48:38 +0200 Subject: [PATCH] posix_spawn, posix_spawnp: Fix build error on Minix 3.3. * m4/posix_spawn.m4 (gl_POSIX_SPAWN_BODY): If posix_spawn does not exist but is declared, set REPLACE_POSIX_SPAWN. * doc/posix-functions/posix_spawn.texi: Update platforms list. * doc/posix-functions/posix_spawnp.texi: Likewise. --- ChangeLog | 8 ++++++++ doc/posix-functions/posix_spawn.texi | 2 +- doc/posix-functions/posix_spawnp.texi | 2 +- m4/posix_spawn.m4 | 14 +++++++++++++- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0bcb9e6485..798bbac423 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2021-05-13 Bruno Haible + + posix_spawn, posix_spawnp: Fix build error on Minix 3.3. + * m4/posix_spawn.m4 (gl_POSIX_SPAWN_BODY): If posix_spawn does not exist + but is declared, set REPLACE_POSIX_SPAWN. + * doc/posix-functions/posix_spawn.texi: Update platforms list. + * doc/posix-functions/posix_spawnp.texi: Likewise. + 2021-05-13 Bruno Haible reallocarray tests: Avoid test failure on NetBSD. diff --git a/doc/posix-functions/posix_spawn.texi b/doc/posix-functions/posix_spawn.texi index d0cf1b919c..5e709d4edf 100644 --- a/doc/posix-functions/posix_spawn.texi +++ b/doc/posix-functions/posix_spawn.texi @@ -10,7 +10,7 @@ Portability problems fixed by Gnulib: @itemize @item This function is missing on some platforms: -FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 14, Android 8.1. +FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.3, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 14, Android 8.1. @item When this function fails, it causes the stdio buffer contents to be output twice on some platforms: diff --git a/doc/posix-functions/posix_spawnp.texi b/doc/posix-functions/posix_spawnp.texi index 88b6e40274..dd27fe8518 100644 --- a/doc/posix-functions/posix_spawnp.texi +++ b/doc/posix-functions/posix_spawnp.texi @@ -10,7 +10,7 @@ Portability problems fixed by Gnulib: @itemize @item This function is missing on some platforms: -FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 14, Android 8.1. +FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.3, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin 1.7.x, mingw, MSVC 14, Android 8.1. @item When this function fails, it causes the stdio buffer contents to be output twice on some platforms: diff --git a/m4/posix_spawn.m4 b/m4/posix_spawn.m4 index 84b7a13f2a..b358da6fe8 100644 --- a/m4/posix_spawn.m4 +++ b/m4/posix_spawn.m4 @@ -1,4 +1,4 @@ -# posix_spawn.m4 serial 21 +# posix_spawn.m4 serial 22 dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -32,6 +32,7 @@ AC_DEFUN([gl_POSIX_SPAWN_BODY], dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_getsigmask]) dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_setsigmask]) dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_destroy]) + AC_CHECK_DECLS([posix_spawn], , , [[#include ]]) 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. @@ -101,6 +102,17 @@ AC_DEFUN([gl_POSIX_SPAWN_BODY], [gl_cv_func_spawnattr_setschedparam=no]) ]) fi + else + dnl The system does not have the main function. Therefore we have to + dnl provide our own implementation. This implies to define our own + dnl posix_spawn_file_actions_t and posix_spawnattr_t types. + if test $ac_cv_have_decl_posix_spawn = yes; then + dnl The system declares posix_spawn() already. This declaration uses + dnl the original posix_spawn_file_actions_t and posix_spawnattr_t types. + dnl But we need a declaration with our own posix_spawn_file_actions_t and + dnl posix_spawnattr_t types. + REPLACE_POSIX_SPAWN=1 + fi fi if test $ac_cv_func_posix_spawn != yes || test $REPLACE_POSIX_SPAWN = 1; then AC_DEFINE([REPLACE_POSIX_SPAWN], [1], -- 2.39.5