summaryrefslogtreecommitdiff
path: root/lib/autoconf/functions.m4
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2020-11-28 10:01:31 -0500
committerZack Weinberg <zackw@panix.com>2020-11-30 11:45:25 -0500
commitd81861ed01ffb50ab9f0b5ceab3f4df70510d531 (patch)
tree7416c2717f131cddfca8d6dce51e949f06d67372 /lib/autoconf/functions.m4
parent9e8bc1bffcd8a1de54b05b24717113263a45f0c5 (diff)
downloadautoconf-d81861ed01ffb50ab9f0b5ceab3f4df70510d531.tar.gz
AC_FUNC_SETPGRP: Don’t depend on the return type of setpgrp.
AC_FUNC_SETPGRP determines whether you have the historic BSD setpgrp, which takes two arguments and returns int, or the historic POSIX setpgrp, which takes no arguments and returns int. Solaris has yet a third variant, which takes no arguments and returns a pid_t (the new process group ID). This difference causes AC_FUNC_SETPGRP’s test program to fail to compile under AC_LANG([C++]), which in turn causes the macro to report that setpgrp does take arguments, which is wrong. It is not worth adding a new result #define for this variant, since *all* forms of setpgrp are deprecated in favor of setpgid, which is old enough that it can be used unconditionally. However, it is worth documenting that this variant exists, and fixing AC_FUNC_SETPGRP to produce the right value for its existing result #define on Solaris with C++. * lib/autoconf/functions.m4 (AC_FUNC_SETPGRP): Redesign test program to not depend on the return type of setpgrp. * doc/autoconf.texi (AC_FUNC_SETPGRP): Mention that the macro does not check for the Solaris variant of setpgrp that returns pid_t. Change programming advice to recommend use of setpgid.
Diffstat (limited to 'lib/autoconf/functions.m4')
-rw-r--r--lib/autoconf/functions.m417
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4
index a91eeebc..49aa5c58 100644
--- a/lib/autoconf/functions.m4
+++ b/lib/autoconf/functions.m4
@@ -1541,17 +1541,16 @@ rm -rf conftest*
# AC_FUNC_SETPGRP
# ---------------
AC_DEFUN([AC_FUNC_SETPGRP],
-[AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void,
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <unistd.h>
- static int (*p) (void) = setpgrp;]],
- [[return setpgrp ();]])],
- [ac_cv_func_setpgrp_void=yes],
- [ac_cv_func_setpgrp_void=no])])
+[AC_CACHE_CHECK(whether setpgrp requires zero arguments,
+ ac_cv_func_setpgrp_void,
+[# Call it with two arguments.
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [setpgrp(0, 0);])],
+ [ac_cv_func_setpgrp_void=no],
+ [ac_cv_func_setpgrp_void=yes])
+])
if test $ac_cv_func_setpgrp_void = yes; then
AC_DEFINE(SETPGRP_VOID, 1,
- [Define to 1 if the `setpgrp' function takes no argument.])
+ [Define to 1 if the `setpgrp' function requires zero arguments.])
fi
])# AC_FUNC_SETPGRP