autoconf: AC_FUNC_SETPGRP: work even when cross-compiling

https://github.com/libsdl-org/autoconf/commit/a2d199d6ebe06cacaffa10f765bac1dba14ede68

From a2d199d6ebe06cacaffa10f765bac1dba14ede68 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[EMAIL REDACTED]>
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>.
(cherry picked from commit 1c048e2f9f387f01e8f9254f800b909cabd28672)
---
 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 39ef86d6..355e9e79 100644
--- a/lib/autoconf/functions.m4
+++ b/lib/autoconf/functions.m4
@@ -1476,15 +1476,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.])