Package: autoconf Version: 2.59a-4 Severity: normal Tags: patch (seems to be an upstream bug)
With the attached configure.ac script, the "[check] for working fork" fails. Changing the AC_LANG from C++ to C results in a successful check. I'm using gcc 4.0.1-9, and I also tried it with gcc 4.0.2-2.
# -*- Autoconf -*- # Run autoheader and autoconf to produce a header and configure script from # this file. AC_INIT([Dummy],[0.0]) AC_LANG([C++]) # Checks for programs. AC_PROG_CC AC_FUNC_FORK
It seems that HAVE_UNISTD_H is not defined automatically in C++, and hence unistd.h is not included in the test program, resulting in the compiler not being able to find the fork function. One way to fix this is to modify autoconf/functions.m4 with the attached patch. This causes the test program to include confdefs.h, which defines HAVE_UNISTD_H if unistd.h exists. I'm not sure if this is the correct fix, though.
--- functions.m4.old 2005-10-07 20:56:19.427016155 -0400 +++ functions.m4 2005-10-07 20:57:22.914057470 -0400 @@ -1742,7 +1742,7 @@ # ------------- AC_DEFUN([_AC_FUNC_FORK], [AC_CACHE_CHECK(for working fork, ac_cv_func_fork_works, - [AC_RUN_IFELSE([/* By Ruediger Kuhlmann. */ + [AC_RUN_IFELSE([AC_LANG_SOURCE([[/* By Ruediger Kuhlmann. */ #include <sys/types.h> #if HAVE_UNISTD_H # include <unistd.h> @@ -1753,7 +1753,7 @@ if (fork() < 0) exit (1); exit (0); - }], + }]])], [ac_cv_func_fork_works=yes], [ac_cv_func_fork_works=no], [ac_cv_func_fork_works=cross])])]
Another issue is that the macro for checking for vfork sets ac_cv_func_vfork_works=$ac_func_vfork (line 1721 of functions.m4), so it never actually runs the test for a working vfork, since it just pulls the cached value of ac_cv_func_vfork. I don't know if this was intentional, though, or if this is a bug. -- System Information: Debian Release: testing/unstable APT prefers unstable APT policy: (500, 'unstable'), (500, 'stable'), (101, 'experimental') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.10-mm3 Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) Versions of packages autoconf depends on: ii debianutils 2.14.3 Miscellaneous utilities specific t ii m4 1.4.3-2 a macro processing language ii perl 5.8.7-5 Larry Wall's Practical Extraction Versions of packages autoconf recommends: ii automake1.4 [automaken] 1:1.4-p6-9 A tool for generating GNU Standard -- no debconf information