From: Akim Demaille Date: Tue, 17 Jul 2001 16:21:25 +0000 (+0000) Subject: The runtime test for AC_FUNC_GETPGRP fails when prototypes are X-Git-Tag: AUTOCONF-2.51~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9098f2529a80dc3156fbee2b4c6afdbba67698e2;p=thirdparty%2Fautoconf.git 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. --- diff --git a/ChangeLog b/ChangeLog index fe43876af..e8ec87dec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2001-07-17 Akim Demaille + + 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 * actypes.m4 (_AC_CHECK_TYPE_REPLACEMENT_TYPE_P): `foo_t' is a diff --git a/NEWS b/NEWS index 922b24d34..f4f67535d 100644 --- 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] * Major changes in Autoconf 2.50 diff --git a/THANKS b/THANKS index 11dd73de0..bd43c27f5 100644 --- 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 diff --git a/acfunctions.m4 b/acfunctions.m4 index be9a92bed..bdffeb0f3 100644 --- a/acfunctions.m4 +++ b/acfunctions.m4 @@ -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, diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4 index be9a92bed..bdffeb0f3 100644 --- a/lib/autoconf/functions.m4 +++ b/lib/autoconf/functions.m4 @@ -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,