autoconf-patches
[Top][All Lists]
Advanced

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

Re: AC_FUNC_GETPGRP and autoconf > 2.50


From: Akim Demaille
Subject: Re: AC_FUNC_GETPGRP and autoconf > 2.50
Date: 17 Jul 2001 14:59:35 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Academic Rigor)

| >From ChangeLog:
| 2001-06-18  Akim Demaille  <address@hidden>
| 
|         * acfunctions.m4 (AC_FUNC_CHOWN, AC_FUNC_CLOSEDIR_VOID)
|         (AC_FUNC_GETPGRP, AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK)
|         (AC_FUNC_MMAP, AC_FUNC_SELECT_ARGTYPES, _AC_FUNC_STAT)
|         (AC_FUNC_UTIME_NULL): Use AC_INCLUDES_DEFAULT.
|         Don't use AC_TRY_RUN, which double quotes, prefer AC_RUN_IFELSE,
|         and either AC_LANG_SOURCE or AC_LANG_PROGRAM.
| 
| This change break AC_FUNC_GETPGRP.

Thanks _a lot_.

How about this patch?  In fact, it's much better than what we used to
have, IMHO.  And it certainly helps when cross-compiling.

Index: acfunctions.m4
===================================================================
RCS file: /cvs/autoconf/acfunctions.m4,v
retrieving revision 1.43
diff -u -u -r1.43 acfunctions.m4
--- acfunctions.m4 2001/07/04 15:12:57 1.43
+++ acfunctions.m4 2001/07/17 12:59:13
@@ -582,11 +582,12 @@
                          [Define if you have the `getmntent' function.])])])
 
 
-# AC_FUNC_GETPGRP
-# ---------------
-AC_DEFUN([AC_FUNC_GETPGRP],
-[AC_CACHE_CHECK(whether getpgrp takes no argument, ac_cv_func_getpgrp_void,
-[AC_RUN_IFELSE([AC_LANG_SOURCE([AC_INCLUDES_DEFAULT]
+# _AC_FUNC_GETPGRP_TEST
+# ---------------------
+# A program that exits with success iff `getpgrp' seems to ignore its
+# argument.
+m4_define([_AC_FUNC_GETPGRP_TEST],
+[AC_LANG_SOURCE([AC_INCLUDES_DEFAULT]
 [[
 /*
  * If this system has a BSD-style getpgrp(),
@@ -634,10 +635,34 @@
       wait (&s);
       exit (s>>8);
     }
-}]])],
-               [ac_cv_func_getpgrp_void=yes],
-               [ac_cv_func_getpgrp_void=no],
-               [AC_MSG_ERROR([cannot check getpgrp if cross compiling])])
+}]])
+])# _AC_FUNC_GETPGRP_TEST
+
+
+# AC_FUNC_GETPGRP
+# ---------------
+# Figure out whether getpgrp takes an argument or not.  Try first using
+# prototypes (AC_COMPILE), and if the compiler is of no help, try a runtime
+# test.
+AC_DEFUN([AC_FUNC_GETPGRP],
+[AC_CACHE_CHECK(whether getpgrp takes no argument, ac_cv_func_getpgrp_void,
+[# Use it with a single arg.
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [getpgrp (0);])],
+                  [ac_func_getpgrp_1=yes],
+                  [ac_func_getpgrp_1=no])
+# Use it with no arg.
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [getpgrp ();])],
+                  [ac_func_getpgrp_0=yes],
+                  [ac_func_getpgrp_0=no])
+# If both static checks agree, we are done.
+case $ac_func_getpgrp_0:$ac_func_getpgrp_1 in
+  yes:no) ac_cv_func_getpgrp_void=yes;;
+  no:yes) ac_cv_func_getpgrp_void=false;;
+  *) AC_RUN_IFELSE([_AC_FUNC_GETPGRP_TEST],
+                   [ac_cv_func_getpgrp_void=yes],
+                   [ac_cv_func_getpgrp_void=no],
+                   [AC_MSG_ERROR([cannot check getpgrp if cross compiling])]);;
+esac # $ac_func_getpgrp_0:$ac_func_getpgrp_1
 ])
 if test $ac_cv_func_getpgrp_void = yes; then
   AC_DEFINE(GETPGRP_VOID, 1,



reply via email to

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