]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
The runtime test for AC_FUNC_GETPGRP fails when prototypes are
authorAkim Demaille <akim@epita.fr>
Tue, 17 Jul 2001 16:21:25 +0000 (16:21 +0000)
committerAkim Demaille <akim@epita.fr>
Tue, 17 Jul 2001 16:21:25 +0000 (16:21 +0000)
used.  Well, then use the prototypes when you can, and runtime as
a last resort.
Reported by Artur Frysiak
* acfunctions.m4 (_AC_FUNC_GETPGRP_TEST): New.
(AC_FUNC_GETPGRP): Use it.
First try to compile with 0-ary or 1-ary calls.

ChangeLog
NEWS
THANKS
acfunctions.m4
lib/autoconf/functions.m4

index fe43876af8223cb68e73bc5148abe7103e77e755..e8ec87dec708a113a25ab18775308896c53459d2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2001-07-17  Akim Demaille  <akim@epita.fr>
+
+       The runtime test for AC_FUNC_GETPGRP fails when prototypes are
+       used.  Well, then use the prototypes when you can, and runtime as
+       a last resort.
+       Reported by Artur Frysiak
+
+       * acfunctions.m4 (_AC_FUNC_GETPGRP_TEST): New.
+       (AC_FUNC_GETPGRP): Use it.
+       First try to compile with 0-ary or 1-ary calls.
+
 2001-07-17  Akim Demaille  <akim@epita.fr>
 
        * actypes.m4 (_AC_CHECK_TYPE_REPLACEMENT_TYPE_P): `foo_t' is a
diff --git a/NEWS b/NEWS
index 922b24d345886b89bd1453137efd28508191d98e..f4f67535d8ae2f4677c17b62b3c6377bc3355e61 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -36,7 +36,7 @@
 
 ** Generic macros
 - AC_CHECK_HEADER and AC_CHECK_HEADERS support a fourth argument to
-  specify pre-includes.  In this case, the headers are compiler with
+  specify pre-includes.  In this case, the headers are compiled with
   cc, not merely preprocessed by cpp.  Therefore it is the _usability_
   of a header which is checked for, not just its availability.
 - AC_ARG_VAR refuses to run configure when precious variables have
@@ -54,6 +54,7 @@
 - AC_F77_DUMMY_MAIN, AC_F77_MAIN: new macros to detect whether
   a main-like routine is required/possible when linking C/C++ with
   Fortran.  Users of e.g. AC_F77_WRAPPERS should be aware of these.
+- AC_FUNC_GETPGRG behaves better when cross-compiling.
 [2.50][2.50a][2.50b][2.50c]
 \f
 * Major changes in Autoconf 2.50
diff --git a/THANKS b/THANKS
index 11dd73de010adf03bf2b8972367ffb71d949f780..bd43c27f5e56b7f32b1131c834ed4de207c8c627 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -12,6 +12,7 @@ Andreas Jaeger              aj@suse.de
 Andreas Schott              schott@rzg.mpg.de
 Andreas Schwab              schwab@issan.informatik.uni-dortmund.de
 Andrej Borsenkow            borsenkow.msk@sni.de
+Artur Frysiak               wiget@pld.org.pl
 Assar Westerlund            assar@sics.se
 Axel Thimm                  Axel.Thimm@physik.fu-berlin.de
 Ben Elliston                bje@redhat.com
index be9a92bed47695f2dbda852ab68b24c469db7433..bdffeb0f320a8717ddee26e27c839d8b8c234ca0 100644 (file)
@@ -582,11 +582,12 @@ AC_CHECK_FUNC(getmntent,
                          [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 @@ main ()
       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,
index be9a92bed47695f2dbda852ab68b24c469db7433..bdffeb0f320a8717ddee26e27c839d8b8c234ca0 100644 (file)
@@ -582,11 +582,12 @@ AC_CHECK_FUNC(getmntent,
                          [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 @@ main ()
       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,