[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
_AC_FUNC_VFORK with C++ compiler
From: |
Bruno Haible |
Subject: |
_AC_FUNC_VFORK with C++ compiler |
Date: |
Tue, 29 Oct 2002 13:16:11 +0100 (CET) |
The _AC_FUNC_VFORK program has compilation failures when CPPFLAGS is set
to "-x c++". g++-2.95.3 gives the following errors:
20: ANSI C++ forbids declaration `sparc_address_test' with no type
In function `int main()':
20: too few arguments to function `int sparc_address_test(int)'
42: at this point in file
74: implicit declaration of function `int wait(...)'
g++-3.0 gives the following errors:
20: ISO C++ forbids declaration of `sparc_address_test' with no type
In function `int main()':
20: too few arguments to function `int sparc_address_test(int)'
42: at this point in file
74: `wait' undeclared (first use this function)
74: (Each undeclared identifier is reported only once for each function
it appears in.)
88: `exit' undeclared (first use this function)
Here is a patch for autoconf 2.50; it should apply to autoconf 2.54b
as well.
*** acfunctions.m4.bak Tue Jul 17 18:19:21 2001
--- acfunctions.m4 Sun Aug 26 01:36:15 2001
***************
*** 1479,1486 ****
--- 1479,1488 ----
[AC_CACHE_CHECK(for working vfork, ac_cv_func_vfork_works,
[AC_TRY_RUN([/* Thanks to Paul Eggert for this test. */
#include <stdio.h>
+ #include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
+ #include <sys/wait.h>
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
***************
*** 1493,1499 ****
(e.g. gcc -O) don't grok <vfork.h>. Test for this by using a
static variable whose address is put into a register that is
clobbered by the vfork. */
! static
#ifdef __cplusplus
sparc_address_test (int arg)
# else
--- 1495,1501 ----
(e.g. gcc -O) don't grok <vfork.h>. Test for this by using a
static variable whose address is put into a register that is
clobbered by the vfork. */
! static void
#ifdef __cplusplus
sparc_address_test (int arg)
# else
***************
*** 1521,1527 ****
pid_t parent = getpid ();
pid_t child;
! sparc_address_test ();
child = vfork ();
--- 1523,1529 ----
pid_t parent = getpid ();
pid_t child;
! sparc_address_test (0);
child = vfork ();
- _AC_FUNC_VFORK with C++ compiler,
Bruno Haible <=