autoconf-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] Document AC_FUNC_FORK cache variables


From: Ralf Wildenhues
Subject: Re: [PATCH] Document AC_FUNC_FORK cache variables
Date: Mon, 20 Dec 2010 07:57:11 +0100
User-agent: Mutt/1.5.20 (2010-08-04)

Hello Colin,

* Colin Watson wrote on Mon, Dec 20, 2010 at 12:33:46AM CET:
> I maintain a package where I'd like to fail at configure time if fork
> doesn't work.  This is slightly awkward because 'info autoconf' doesn't
> document the cache variables for AC_FUNC_FORK, so I don't know whether I
> can rely on them in future versions of Autoconf.  Would you be willing
> to document them as follows and thereby promise that they will continue
> to work?

The reason we didn't document them right away was because the semantics
are a bit more complex: while you can read the results in these
variables, you cannot override the test completely by setting these
variables.  ac_cv_func_fork and ac_cv_func_vfork are also involved.

We could change the macro so that the _works variables are not
overridden when set, or just document the need to also set the
other two.  Below is a (fairly untested) patch for the former
(4 new lines plus large reindent).  However, this still differs
in configure output (the _works result is not communicated in the
cache case) so I'm not sure this is the better approach.

Probably easier to append "In order to override the test, you also
need to set the @code{ac_cv_func_fork} and @code{ac_cv_func_vfork}
variables."  Eric?

Thanks,
Ralf

2010-12-20  Ralf Wildenhues  <address@hidden>

        Fix AC_FUNC_FORK to not override pre-set cache variables.
        * lib/autoconf/functions.m4 (AC_FUNC_FORK): Do not recompute
        ac_cv_func_fork_works or ac_cv_func_vfork_works if they are
        already set by the user.
        Prompted by report from Colin Watson.

diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4
index f2048bf..1f2c5e7 100644
--- a/lib/autoconf/functions.m4
+++ b/lib/autoconf/functions.m4
@@ -1791,30 +1791,34 @@ AC_DEFUN([AC_FUNC_FORK],
 [AC_REQUIRE([AC_TYPE_PID_T])dnl
 AC_CHECK_HEADERS(vfork.h)
 AC_CHECK_FUNCS(fork vfork)
-if test "x$ac_cv_func_fork" = xyes; then
-  _AC_FUNC_FORK
-else
-  ac_cv_func_fork_works=$ac_cv_func_fork
-fi
-if test "x$ac_cv_func_fork_works" = xcross; then
-  case $host in
-    *-*-amigaos* | *-*-msdosdjgpp*)
-      # Override, as these systems have only a dummy fork() stub
-      ac_cv_func_fork_works=no
-      ;;
-    *)
-      ac_cv_func_fork_works=yes
-      ;;
-  esac
-  AC_MSG_WARN([result $ac_cv_func_fork_works guessed because of cross 
compilation])
+if test "${ac_cv_func_fork_works+set}" != set; then
+  if test "x$ac_cv_func_fork" = xyes; then
+    _AC_FUNC_FORK
+  else
+    ac_cv_func_fork_works=$ac_cv_func_fork
+  fi
+  if test "x$ac_cv_func_fork_works" = xcross; then
+    case $host in
+      *-*-amigaos* | *-*-msdosdjgpp*)
+       # Override, as these systems have only a dummy fork() stub
+       ac_cv_func_fork_works=no
+       ;;
+      *)
+       ac_cv_func_fork_works=yes
+       ;;
+    esac
+    AC_MSG_WARN([result $ac_cv_func_fork_works guessed because of cross 
compilation])
+  fi
 fi
-ac_cv_func_vfork_works=$ac_cv_func_vfork
-if test "x$ac_cv_func_vfork" = xyes; then
-  _AC_FUNC_VFORK
-fi;
-if test "x$ac_cv_func_fork_works" = xcross; then
+if test "${ac_cv_func_vfork_works+set}" != set; then
   ac_cv_func_vfork_works=$ac_cv_func_vfork
-  AC_MSG_WARN([result $ac_cv_func_vfork_works guessed because of cross 
compilation])
+  if test "x$ac_cv_func_vfork" = xyes; then
+    _AC_FUNC_VFORK
+  fi;
+  if test "x$ac_cv_func_fork_works" = xcross; then
+    ac_cv_func_vfork_works=$ac_cv_func_vfork
+    AC_MSG_WARN([result $ac_cv_func_vfork_works guessed because of cross 
compilation])
+  fi
 fi
 
 if test "x$ac_cv_func_vfork_works" = xyes; then



reply via email to

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