+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
** 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
- 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
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
[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(),
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,
[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(),
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,