build: ensure make-prime-list doesn't access out of bounds memory
[platform/upstream/coreutils.git] / m4 / check-decl.m4
1 #serial 26
2 # Check declarations for this package.
3
4 dnl Copyright (C) 1997-2013 Free Software Foundation, Inc.
5
6 dnl This file is free software; the Free Software Foundation
7 dnl gives unlimited permission to copy and/or distribute it,
8 dnl with or without modifications, as long as this notice is preserved.
9
10
11 dnl This is just a wrapper function to encapsulate this kludge.
12 dnl Putting it in a separate file like this helps share it between
13 dnl different packages.
14 AC_DEFUN([gl_CHECK_DECLS],
15 [
16   AC_REQUIRE([AC_HEADER_TIME])
17
18   AC_CHECK_HEADERS_ONCE([grp.h pwd.h])
19   headers='
20 #include <sys/types.h>
21
22 #include <unistd.h>
23
24 #if HAVE_GRP_H
25 # include <grp.h>
26 #endif
27
28 #if HAVE_PWD_H
29 # include <pwd.h>
30 #endif
31 '
32   AC_CHECK_DECLS([
33     getgrgid,
34     getpwuid,
35     ttyname], , , $headers)
36
37   AC_CHECK_DECLS_ONCE([geteuid])
38   AC_CHECK_DECLS_ONCE([getlogin])
39   AC_CHECK_DECLS_ONCE([getuid])
40 ])