bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

posix_spawn, posix_spawnp: Fix build error on Minix 3.3


From: Bruno Haible
Subject: posix_spawn, posix_spawnp: Fix build error on Minix 3.3
Date: Thu, 13 May 2021 17:40:01 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-206-generic; KDE/5.18.0; x86_64; ; )

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 via email to

[Prev in Thread] Current Thread [Next in Thread]