Fix setres*id checks to work with clang-16.

glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE,
and clang 16 will error out on implicit function definitions, so add
_GNU_SOURCE and the required headers to the configure checks.  From
sam at @gentoo.org via bz#3497.
This commit is contained in:
Darren Tucker 2022-11-07 10:39:01 +11:00
parent 12af712d11
commit 32fddb982f
No known key found for this signature in database
1 changed files with 6 additions and 3 deletions

View File

@ -863,7 +863,8 @@ int main(void) { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
check_for_openpty_ctty_bug=1
dnl Target SUSv3/POSIX.1-2001 plus BSD specifics.
dnl _DEFAULT_SOURCE is the new name for _BSD_SOURCE
CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE"
dnl _GNU_SOURCE is needed for setres*id prototypes.
CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_GNU_SOURCE"
AC_DEFINE([BROKEN_CLOSEFROM], [1], [broken in chroots on older kernels])
AC_DEFINE([PAM_TTY_KLUDGE], [1],
[Work around problematic Linux PAM modules handling of PAM_TTY])
@ -2168,8 +2169,9 @@ AC_CHECK_FUNCS([setresuid], [
AC_MSG_CHECKING([if setresuid seems to work])
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([[
#include <stdlib.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
]], [[
errno=0;
setresuid(0,0,0);
@ -2191,8 +2193,9 @@ AC_CHECK_FUNCS([setresgid], [
AC_MSG_CHECKING([if setresgid seems to work])
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([[
#include <stdlib.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
]], [[
errno=0;
setresgid(0,0,0);