[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [autoconf] AmigaOS fork()
From: |
Akim Demaille |
Subject: |
Re: [autoconf] AmigaOS fork() |
Date: |
31 May 2001 13:28:25 +0200 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (GTK) |
I'll wait for some input from Alexandre, Jim or Paul on this one.
| >--[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.
I prefer HAVE_WORKING_FORK. Let's have HAVE_FOO keep its semantics.
| 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.
We need some documentation, please.
| 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
We avoid ifdef and ifndef, rather use
#if !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. */
AC_TRY_RUN is dead as far as Autoconf per se is concerned, please use
AC_RUN_IFELSE. See AC_FUNC_GETPGRP for instance.
| + #include <stdio.h>
| + #include <sys/types.h>
| + #include <sys/stat.h>
| + #if HAVE_UNISTD_H
| + # include <unistd.h>
| + #endif
Hm, make sure you have the proper requirements to have this header
test. Maybe it's already the case via AC_CHECK_FUNC, but I doubt it.
| + /* 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
No way to actually *test* the feature? This is against the policy for
Autoconf: never test for a platform, test for a feature. Unless you
can convince us, to me this means the patch is not acceptable.
| + if test "x$ac_cv_func_fork_works" = xyes; then
| + AC_DEFINE(HAVE_FORK,1)
| + endif
| +])# AC_FUNC_FORK
| +
| # AC_FUNC_VFORK
Nit picking: two \n between defs.
| # -------------
| 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
Again, HAVE_WORKING_VFORK seems more appropriate to me.
| ])# 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
Instead of ``polluting'' all the tests, I'd suggest inserting this
snippet in confdefs.h. But I'd like to hear comments about this.
| /* 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.
Thanks!
- 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, 2001/05/24
- 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 <=
- 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
- Re: [autoconf] AmigaOS fork(), Akim Demaille, 2001/05/31
- Re: [autoconf] AmigaOS fork(), Rüdiger Kuhlmann, 2001/05/31