[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [autoconf] AmigaOS fork()
From: |
Rüdiger Kuhlmann |
Subject: |
Re: [autoconf] AmigaOS fork() |
Date: |
Thu, 24 May 2001 13:04:37 +0200 |
User-agent: |
Mutt/1.3.17i |
>--[Tim Van Holder]--<address@hidden>
> For the cross-compiling case, I think
Okay, what about this: It doesn't #define fork anymore, but HAVE_FORK if it
works. Then the program has to check this itself.
2001-05-24 Rüdiger Kuhlmann <address@hidden>
* acfunctions.m4: (AC_FUNC_FORK) New, check whether fork() isn't just
a stub and define HAVE_FUNC if it works.
(AC_FUNC_GETPGRP, AC_FUNC_WAIT3) Use AC_FUNC_FORK and #define fork
to vfork if necessary.
(AC_FUN_VFORK) Similarly define HAVE_VFORK.
* acspecific.m4: (AC_SYS_RESTARTABLE_SYSCALLS) dito.
* acfunctions: add HAVE_FORK.
Index: acfunctions
===================================================================
RCS file: /cvs/autoconf/acfunctions,v
retrieving revision 1.13
diff -u -r1.13 acfunctions
--- acfunctions 2001/01/24 07:58:59 1.13
+++ acfunctions 2001/05/24 10:58:09
@@ -7,6 +7,7 @@
error AC_FUNC_ERROR_AT_LINE
error_at_line AC_FUNC_ERROR_AT_LINE
fnmatch AC_FUNC_FNMATCH
+fork AC_FUNC_FORK
fseeko AC_FUNC_FSEEKO
ftello AC_FUNC_FSEEKO
getgroups AC_FUNC_GETGROUPS
Index: acfunctions.m4
===================================================================
RCS file: /cvs/autoconf/acfunctions.m4,v
retrieving revision 1.33
diff -u -r1.33 acfunctions.m4
--- acfunctions.m4 2001/04/22 12:50:07 1.33
+++ acfunctions.m4 2001/05/24 10:58:13
@@ -599,7 +599,8 @@
# AC_FUNC_GETPGRP
# ---------------
AC_DEFUN([AC_FUNC_GETPGRP],
-[AC_CACHE_CHECK(whether getpgrp takes no argument, ac_cv_func_getpgrp_void,
+[AC_REQUIRE([AC_FUNC_FORK])dnl
+AC_CACHE_CHECK(whether getpgrp takes no argument, ac_cv_func_getpgrp_void,
[AC_RUN_IFELSE([AC_LANG_SOURCE([[
/*
* If this system has a BSD-style getpgrp(),
@@ -609,6 +610,9 @@
*/
#include <stdio.h>
#include <sys/types.h>
+#ifndef HAVE_FORK
+# define fork vfork
+#endif
int pid;
int pg1, pg2, pg3, pg4;
@@ -1442,6 +1446,42 @@
AU_ALIAS([AC_UTIME_NULL], [AC_FUNC_UTIME_NULL])
+# AC_FUNC_FORK
+# -------------
+AC_DEFUN([AC_FUNC_FORK],
+ [AC_CHECK_FUNC(fork)
+ ac_cv_func_fork_works=$ac_cv_func_fork
+ if test "x$ac_cv_func_fork" = xyes; then
+ AC_CACHE_CHECK(for working fork, ac_cv_func_fork_works,
+ [AC_TRY_RUN([/* By Rüdiger Kuhlmann. */
+ #include <stdio.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #if HAVE_UNISTD_H
+ # include <unistd.h>
+ #endif
+ /* Some systems only have a dummy stub for fork() */
+ int main ()
+ {
+ if (fork() < 0)
+ exit (1);
+ exit (0);
+ }],
+ [ac_cv_func_fork_works=yes],
+ [ac_cv_func_fork_works=no],
+ [dnl
+ case "$host" in
+ *-*-amigaos* | *-*-msdosdjgpp*)
+ # Override, as these systems have only a dummy fork() stub
+ ac_cv_func_fork_works=no
+ ;;
+ esac])])
+ fi
+ if test "x$ac_cv_func_fork_works" = xyes; then
+ AC_DEFINE(HAVE_FORK,1)
+ endif
+])# AC_FUNC_FORK
+
# AC_FUNC_VFORK
# -------------
AC_DEFUN([AC_FUNC_VFORK],
@@ -1547,6 +1587,8 @@
ac_cv_func_vfork_works=$ac_cv_func_vfork])])
if test "x$ac_cv_func_vfork_works" = xno; then
AC_DEFINE(vfork, fork, [Define as `fork' if `vfork' does not work.])
+else
+ AC_DEFINE(HAVE_VFORK, 1, [Define if `vfork' works.])
fi
])# AC_FUNC_VFORK
@@ -1577,12 +1619,16 @@
# AC_FUNC_WAIT3
# -------------
AC_DEFUN([AC_FUNC_WAIT3],
-[AC_CACHE_CHECK(for wait3 that fills in rusage, ac_cv_func_wait3_rusage,
+[AC_REQUIRE([AC_FUNC_FORK])dnl
+AC_CACHE_CHECK(for wait3 that fills in rusage, ac_cv_func_wait3_rusage,
[AC_TRY_RUN(
[#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <stdio.h>
+#ifndef HAVE_FORK
+# define fork vfork
+#endif
/* HP-UX has wait3 but does not fill in rusage at all. */
int
main ()
Index: acspecific.m4
===================================================================
RCS file: /cvs/autoconf/acspecific.m4,v
retrieving revision 1.338
diff -u -r1.338 acspecific.m4
--- acspecific.m4 2001/04/15 16:20:30 1.338
+++ acspecific.m4 2001/05/24 10:58:16
@@ -495,6 +495,7 @@
# interrupted by a signal, define `HAVE_RESTARTABLE_SYSCALLS'.
AC_DEFUN([AC_SYS_RESTARTABLE_SYSCALLS],
[AC_REQUIRE([AC_HEADER_SYS_WAIT])dnl
+AC_REQUIRE([AC_FUNC_FORK])dnl
AC_CHECK_HEADERS(unistd.h)
AC_CACHE_CHECK(for restartable system calls, ac_cv_sys_restartable_syscalls,
[AC_RUN_IFELSE([AC_LANG_SOURCE(
@@ -509,6 +510,9 @@
#endif
#if HAVE_SYS_WAIT_H
# include <sys/wait.h>
+#endif
+#ifndef HAVE_FORK
+# define fork vfork
#endif
/* Some platforms explicitly require an extern "C" signal handler
Yours, Rüdiger.
--
A "No" uttered from deepest conviction is better and greater than a
"Yes" merely uttered to please, or what is worse, to avoid trouble.
-- Mahatma Ghandi
- AmigaOS fork(), Rüdiger Kuhlmann, 2001/05/23
- Re: AmigaOS fork(), Russ Allbery, 2001/05/23
- Re: AmigaOS fork(), Tim Van Holder, 2001/05/24
- Re: [autoconf] AmigaOS fork(),
Rüdiger Kuhlmann <=
- Re: [autoconf] AmigaOS fork(), Peter Eisentraut, 2001/05/24
- Re: [autoconf] AmigaOS fork(), Russ Allbery, 2001/05/24
- Re: [autoconf] AmigaOS fork(), Rüdiger Kuhlmann, 2001/05/27
- Re: [autoconf] AmigaOS fork(), Rüdiger Kuhlmann, 2001/05/31
- Re: AmigaOS fork(), Lars Hecking, 2001/05/31
- Re: [autoconf] AmigaOS fork(), Akim Demaille, 2001/05/31
- Re: [autoconf] AmigaOS fork(), Rüdiger Kuhlmann, 2001/05/31
- Re: [autoconf] AmigaOS fork(), Tim Van Holder, 2001/05/31
- Re: [autoconf] AmigaOS fork(), Rüdiger Kuhlmann, 2001/05/31
- Re: [autoconf] AmigaOS fork(), Akim Demaille, 2001/05/31