Add/fix copyright notices and adjust to latest GNU FDL.
[platform/upstream/coreutils.git] / m4 / check-decl.m4
1 #serial 22
2 # Check declarations for this package.
3
4 dnl Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006
5 dnl Free Software Foundation, Inc.
6
7 dnl This file is free software; the Free Software Foundation
8 dnl gives unlimited permission to copy and/or distribute it,
9 dnl with or without modifications, as long as this notice is preserved.
10
11
12 dnl This is just a wrapper function to encapsulate this kludge.
13 dnl Putting it in a separate file like this helps share it between
14 dnl different packages.
15 AC_DEFUN([gl_CHECK_DECLS],
16 [
17   AC_REQUIRE([_gl_DECL_HEADERS])
18   AC_REQUIRE([AC_HEADER_TIME])
19   headers='
20 #include <stdio.h>
21 #include <string.h>
22 #include <stdlib.h>
23
24 #include <unistd.h>
25
26 #include <sys/types.h>
27 #if TIME_WITH_SYS_TIME
28 # include <sys/time.h>
29 # include <time.h>
30 #else
31 # if HAVE_SYS_TIME_H
32 #  include <sys/time.h>
33 # else
34 #  include <time.h>
35 # endif
36 #endif
37
38 #if HAVE_UTMP_H
39 # include <utmp.h>
40 #endif
41
42 #if HAVE_GRP_H
43 # include <grp.h>
44 #endif
45
46 #if HAVE_PWD_H
47 # include <pwd.h>
48 #endif
49 '
50
51   AC_CHECK_DECLS([
52     free,
53     getenv,
54     geteuid,
55     getgrgid,
56     getlogin,
57     getpwuid,
58     getuid,
59     getutent,
60     lseek,
61     malloc,
62     memchr,
63     memrchr,
64     nanosleep,
65     realloc,
66     stpcpy,
67     strndup,
68     strnlen,
69     strstr,
70     strtoul,
71     strtoull,
72     ttyname], , , $headers)
73
74   AC_CHECK_DECLS([isblank], [], [], [#include <ctype.h>])
75 ])
76
77 dnl FIXME: when autoconf has support for it.
78 dnl This is a little helper so we can require these header checks.
79 AC_DEFUN([_gl_DECL_HEADERS],
80 [
81   AC_CHECK_HEADERS_ONCE(grp.h pwd.h sys/time.h utmp.h)
82 ])