bug-autoconf
[Top][All Lists]
Advanced

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

Re: AC_FUNC_SETPGRP fails to work properly when cross-compiling


From: Paul Eggert
Subject: Re: AC_FUNC_SETPGRP fails to work properly when cross-compiling
Date: Wed, 13 Feb 2013 23:29:52 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2

Thanks for the bug report.  I installed the following
somewhat-different patch.

>From 73c32ee293da657d9f1e3754a017b1c2ba219e4c Mon Sep 17 00:00:00 2001
From: Paul Eggert <address@hidden>
Date: Wed, 13 Feb 2013 23:28:21 -0800
Subject: [PATCH] AC_FUNC_SETPGRP: work even when cross-compiling

* lib/autoconf/functions.m4 (AC_FUNC_SETPGRP):
Use AC_COMPILE_IFELSE rather than AC_RUN_IFELSE.
Problem reported by Alvaro Soliverez in
<http://lists.gnu.org/archive/html/bug-autoconf/2013-02/msg00002.html>.
---
 lib/autoconf/functions.m4 | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4
index 05f59bd..1b56641 100644
--- a/lib/autoconf/functions.m4
+++ b/lib/autoconf/functions.m4
@@ -1518,15 +1518,13 @@ rm -f conftest*
 # ---------------
 AC_DEFUN([AC_FUNC_SETPGRP],
 [AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void,
-[AC_RUN_IFELSE(
-[AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
-[/* If this system has a BSD-style setpgrp which takes arguments,
-  setpgrp(1, 1) will fail with ESRCH and return -1, in that case
-  exit successfully. */
-  return setpgrp (1,1) != -1;])],
-              [ac_cv_func_setpgrp_void=no],
-              [ac_cv_func_setpgrp_void=yes],
-              [AC_MSG_ERROR([cannot check setpgrp when cross compiling])])])
+   [AC_COMPILE_IFELSE(
+      [AC_LANG_PROGRAM(
+        [[#include <unistd.h>
+          static int (*p) (void) = setpgrp;]],
+        [[return setpgrp ();]])],
+      [ac_cv_func_setpgrp_void=yes],
+      [ac_cv_func_setpgrp_void=no])])
 if test $ac_cv_func_setpgrp_void = yes; then
   AC_DEFINE(SETPGRP_VOID, 1,
            [Define to 1 if the `setpgrp' function takes no argument.])
-- 
1.7.11.7




reply via email to

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