]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
AC_FUNC_SETPGRP: work even when cross-compiling
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 14 Feb 2013 07:28:21 +0000 (23:28 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 14 Feb 2013 07:28:48 +0000 (23:28 -0800)
* 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

index 05f59bdcc892236b712b88c1fae7085482352446..1b566410e95fe749b77281045be841a3668f5be1 100644 (file)
@@ -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.])