once: Fix pthread-rwlock crashes with clang (regr. 2024-08-07).
[gnulib.git] / m4 / grantpt.m4
blobf6261ec1c561cdef7b4ef59c7181f3dd7f0cf8e2
1 # grantpt.m4
2 # serial 3
3 dnl Copyright (C) 2010-2024 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 AC_DEFUN([gl_FUNC_GRANTPT],
10   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
12   dnl Persuade glibc <stdlib.h> to declare grantpt().
13   AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
15   dnl We can't use AC_CHECK_FUNC here, because grantpt() is defined as a
16   dnl static inline function when compiling for Android 4.4 or older.
17   AC_CACHE_CHECK([for grantpt], [gl_cv_func_grantpt],
18     [AC_LINK_IFELSE(
19        [AC_LANG_PROGRAM(
20           [[#include <stdlib.h>]],
21           [[return grantpt(0);]])
22        ],
23        [gl_cv_func_grantpt=yes],
24        [gl_cv_func_grantpt=no])
25     ])
26   if test $gl_cv_func_grantpt = no; then
27     HAVE_GRANTPT=0
28   fi
31 # Prerequisites of lib/grantpt.c.
32 AC_DEFUN([gl_PREREQ_GRANTPT], [
33   AC_CHECK_FUNCS([setrlimit])