check-decl.m4 revision 1.1 1 #serial 18
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_UTMP_H
42 # include <utmp.h>
43 #endif
44
45 #if HAVE_GRP_H
46 # include <grp.h>
47 #endif
48
49 #if HAVE_PWD_H
50 # include <pwd.h>
51 #endif
52 '
53
54 AC_CHECK_DECLS([
55 free,
56 getenv,
57 geteuid,
58 getgrgid,
59 getlogin,
60 getpwuid,
61 getuid,
62 getutent,
63 lseek,
64 malloc,
65 memchr,
66 memrchr,
67 nanosleep,
68 realloc,
69 stpcpy,
70 strndup,
71 strnlen,
72 strstr,
73 strtoul,
74 strtoull,
75 ttyname], , , $headers)
76 ])
77
78 dnl FIXME: when autoconf has support for it.
79 dnl This is a little helper so we can require these header checks.
80 AC_DEFUN([_jm_DECL_HEADERS],
81 [
82 AC_REQUIRE([AC_HEADER_STDC])
83 AC_CHECK_HEADERS(grp.h memory.h pwd.h string.h strings.h stdlib.h \
84 unistd.h sys/time.h utmp.h utmpx.h)
85 ])
86