files added from libit
[findutils.git] / m4 / check-decl.m4
blob14cc001907b0c947185b9cb5306146544a926f6c
1 #serial 9, except remove memchr and nanosleep as findutils doesn't need them
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,
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
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
42   AC_CHECK_DECLS((
43     free,
44     getenv,
45     geteuid,
46     getlogin,
47     lseek,
48     malloc,
49     realloc,
50     stpcpy,
51     strstr,
52     strtoul,
53     strtoull,
54     ttyname), , , $headers)
57 dnl FIXME: when autoconf has support for it.
58 dnl This is a little helper so we can require these header checks.
59 AC_DEFUN(_jm_DECL_HEADERS,
61   AC_REQUIRE([AC_HEADER_STDC])
62   AC_CHECK_HEADERS(memory.h string.h strings.h stdlib.h unistd.h sys/time.h)