[!HAVE_UTMPX_H] (headers): Include <utmp.h>.
[gnulib.git] / m4 / check-decl.m4
1 #serial 10
2
3 dnl This is just a wrapper function to encapsulate this kludge.
4 dnl Putting it in a separate file like this helps share it between
5 dnl different packages.
6 AC_DEFUN(jm_CHECK_DECLS,
7 [
8   AC_REQUIRE([_jm_DECL_HEADERS])
9   AC_REQUIRE([AC_HEADER_TIME])
10   headers='
11 #include <stdio.h>
12 #if HAVE_STRING_H
13 # if !STDC_HEADERS && HAVE_MEMORY_H
14 #  include <memory.h>
15 # endif
16 # include <string.h>
17 #else
18 # if HAVE_STRINGS_H
19 #  include <strings.h>
20 # endif
21 #endif
22 #if HAVE_STDLIB_H
23 # include <stdlib.h>
24 #endif
25 #if HAVE_UNISTD_H
26 # include <unistd.h>
27 #endif
28
29 #include <sys/types.h>
30 #if TIME_WITH_SYS_TIME
31 # include <sys/time.h>
32 # include <time.h>
33 #else
34 # if HAVE_SYS_TIME_H
35 #  include <sys/time.h>
36 # else
37 #  include <time.h>
38 # endif
39 #endif
40
41 #if !HAVE_UTMPX_H
42 # include <utmp.h>
43 #endif
44 '
45
46   AC_CHECK_DECLS((
47     free,
48     getenv,
49     geteuid,
50     getlogin,
51     getutent
52     lseek,
53     malloc,
54     memchr,
55     nanosleep,
56     realloc,
57     stpcpy,
58     strstr,
59     strtoul,
60     strtoull,
61     ttyname), , , $headers)
62 ])
63
64 dnl FIXME: when autoconf has support for it.
65 dnl This is a little helper so we can require these header checks.
66 AC_DEFUN(_jm_DECL_HEADERS,
67 [
68   AC_REQUIRE([AC_HEADER_STDC])
69   AC_CHECK_HEADERS(memory.h string.h strings.h stdlib.h unistd.h sys/time.h
70                    utmpx.h)
71 ])