mirror of
git://git.sv.gnu.org/autoconf
synced 2024-12-03 02:00:36 +08:00
(_AC_FUNC_GETPGRP_TEST): Remove.
(AC_FUNC_GETPGRP): Don't bother with a runtime test. Just check whether it is a (compile-time) error to pass an argument to getpgrp. This simpler test supports the revised documentation, and is all that AC_FUNC_GETPGRP's users really need.
This commit is contained in:
parent
23bdb70e0c
commit
994851e7de
@ -594,91 +594,20 @@ AC_CHECK_FUNC(getmntent,
|
||||
[Define if you have the `getmntent' function.])])])
|
||||
|
||||
|
||||
# _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(),
|
||||
* which takes a pid argument, exit unsuccessfully.
|
||||
*
|
||||
* Snarfed from Chet Ramey's bash pgrp.c test program
|
||||
*/
|
||||
|
||||
int pid;
|
||||
int pg1, pg2, pg3, pg4;
|
||||
int ng, np, s, child;
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
pid = getpid ();
|
||||
pg1 = getpgrp (0);
|
||||
pg2 = getpgrp ();
|
||||
pg3 = getpgrp (pid);
|
||||
pg4 = getpgrp (1);
|
||||
|
||||
/* If all of these values are the same, it's pretty sure that we're
|
||||
on a system that ignores getpgrp's first argument. */
|
||||
if (pg2 == pg4 && pg1 == pg3 && pg2 == pg3)
|
||||
exit (0);
|
||||
|
||||
child = fork ();
|
||||
if (child < 0)
|
||||
exit(1);
|
||||
else if (child == 0)
|
||||
{
|
||||
np = getpid ();
|
||||
/* If this is Sys V, this will not work; pgrp will be set to np
|
||||
because setpgrp just changes a pgrp to be the same as the
|
||||
pid. */
|
||||
setpgrp (np, pg1);
|
||||
ng = getpgrp (0); /* Same result for Sys V and BSD */
|
||||
if (ng == pg1)
|
||||
exit (1);
|
||||
else
|
||||
exit (0);
|
||||
}
|
||||
else
|
||||
{
|
||||
wait (&s);
|
||||
exit (s>>8);
|
||||
}
|
||||
}]])
|
||||
])# _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.
|
||||
# Figure out whether getpgrp requires zero arguments.
|
||||
AC_DEFUN([AC_FUNC_GETPGRP],
|
||||
[AC_CACHE_CHECK(whether getpgrp takes no argument, ac_cv_func_getpgrp_void,
|
||||
[AC_CACHE_CHECK(whether getpgrp requires zero arguments,
|
||||
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
|
||||
[ac_cv_func_getpgrp_void=no],
|
||||
[ac_cv_func_getpgrp_void=yes])
|
||||
])
|
||||
if test $ac_cv_func_getpgrp_void = yes; then
|
||||
AC_DEFINE(GETPGRP_VOID, 1,
|
||||
[Define if the `getpgrp' function takes no argument.])
|
||||
[Define if the `getpgrp' function requires zero arguments.])
|
||||
fi
|
||||
])# AC_FUNC_GETPGRP
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user