autoconf
[Top][All Lists]
Advanced

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

[Hubert Chan] Bug#332713: autoconf: checking for fork does not work for


From: Ben Pfaff
Subject: [Hubert Chan] Bug#332713: autoconf: checking for fork does not work for C++
Date: Sat, 22 Oct 2005 20:48:15 -0700
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)

The following bug was reported against the Debian packaging of
Autoconf 2.59.  I verified that it produced the reported results
on my system as well.

[Preserving the CC to address@hidden in replies
would be kind, because that allows replies to be preserved in the
Debian BTS.]

[Hubert: sorry about the delay in acting on this.  I've been
pretty busy.]

-------------------- Start of forwarded message --------------------
Subject: Bug#332713: autoconf: checking for fork does not work for C++
From: Hubert Chan <address@hidden>
To: Debian Bug Tracking System <address@hidden>
Date: Fri, 07 Oct 2005 22:31:55 -0400
Message-ID: <address@hidden>

[...]

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.
-------------------- End of forwarded message --------------------

-- 
"While the Melissa license is a bit unclear, Melissa aggressively
 encourages free distribution of its source code."
--Kevin Dalley <address@hidden>




reply via email to

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