(jm_FUNC_FTRUNCATE): AC_REQUIRE it.
[gnulib.git] / m4 / prereq.m4
1 #serial 5
2
3 dnl These are the prerequisite macros for files in the lib/
4 dnl directories of the fileutils, sh-utils, and textutils packages.
5
6 AC_DEFUN(jm_PREREQ,
7 [
8   jm_PREREQ_ADDEXT
9   jm_PREREQ_CANON_HOST
10   jm_PREREQ_ERROR
11   jm_PREREQ_QUOTEARG
12   jm_PREREQ_READUTMP
13   jm_PREREQ_REGEX
14 ])
15
16 AC_DEFUN(jm_PREREQ_ADDEXT,
17 [
18   dnl For addext.c.
19   AC_SYS_LONG_FILE_NAMES
20   AC_CHECK_FUNC(pathconf)
21   AC_CHECK_HEADERS(limits.h string.h unistd.h)
22 ])
23
24 AC_DEFUN(jm_PREREQ_CANON_HOST,
25 [
26   dnl Add any libraries as early as possible.
27   dnl In particular, inet_ntoa needs -lnsl at least on Solaris5.5.1,
28   dnl so we have to add -lnsl to LIBS before checking for that function.
29   AC_SEARCH_LIBS(gethostbyname, [inet nsl])
30
31   dnl These come from -lnsl on Solaris5.5.1.
32   AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
33
34   AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
35   AC_CHECK_HEADERS(unistd.h string.h netdb.h sys/socket.h \
36                    netinet/in.h arpa/inet.h)
37 ])
38
39 AC_DEFUN(jm_PREREQ_QUOTEARG,
40 [
41   AC_CHECK_FUNCS(isascii mbrtowc)
42   AC_CHECK_HEADERS(limits.h stdlib.h string.h wchar.h wctype.h)
43   AC_HEADER_STDC
44   AC_C_BACKSLASH_A
45   AM_C_PROTOTYPES
46 ])
47
48 AC_DEFUN(jm_PREREQ_READUTMP,
49 [
50   AC_HEADER_STDC
51   AC_CHECK_HEADERS(string.h utmpx.h sys/param.h)
52   AC_CHECK_FUNCS(utmpname)
53   AM_C_PROTOTYPES
54 ])
55
56 AC_DEFUN(jm_PREREQ_REGEX,
57 [
58   dnl FIXME: Maybe provide a btowc replacement someday: solaris-2.5.1 lacks it.
59   dnl FIXME: Check for wctype and iswctype, and and add -lw if necessary
60   dnl to get them.
61   AC_CHECK_FUNCS(bzero bcopy isascii btowc)
62   AC_CHECK_HEADERS(alloca.h libintl.h wctype.h wchar.h)
63   AC_HEADER_STDC
64   AC_FUNC_ALLOCA
65 ])