bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: bug-m4@gnu.org, bug-gnulib@gnu.org
Subject: posix_spawn, posix_spawnp: Fix build error on Minix 3.3
Date: Thu, 13 May 2021 17:40:01 +0200	[thread overview]
Message-ID: <2560310.fPQ7BPjyPB@omega> (raw)

Building a current m4 snapshot on Minix 3.3, there are compilation errors,
such as:
 -------------------------------------------------------------------
In file included from ../../lib/execute.c:72:
./spawn.h:727:19: error: conflicting types for 'posix_spawn'
_GL_FUNCDECL_SYS (posix_spawn, int,
                  ^
./time.h:168:24: note: expanded from macro '_GL_FUNCDECL_SYS'
  _GL_EXTERN_C rettype func parameters_and_attributes
                       ^
/usr/include/spawn.h:41:5: note: previous declaration is here
int posix_spawn(pid_t * __restrict, const char * __restrict,
    ^
 -------------------------------------------------------------------

This patch fixes it.


2021-05-13  Bruno Haible  <bruno@clisp.org>

	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.

diff --git a/doc/posix-functions/posix_spawn.texi b/doc/posix-functions/posix_spawn.texi
index d0cf1b9..5e709d4 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 88b6e40..dd27fe8 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 84b7a13..b358da6 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 <spawn.h>]])
   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],



                 reply	other threads:[~2021-05-13 16:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2560310.fPQ7BPjyPB@omega \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=bug-m4@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).