*** empty log message ***
[gnulib.git] / m4 / prereq.m4
1 #serial 6
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_GETPAGESIZE
12   jm_PREREQ_QUOTEARG
13   jm_PREREQ_READUTMP
14   jm_PREREQ_REGEX
15 ])
16
17 AC_DEFUN(jm_PREREQ_ADDEXT,
18 [
19   dnl For addext.c.
20   AC_SYS_LONG_FILE_NAMES
21   AC_CHECK_FUNCS(pathconf)
22   AC_CHECK_HEADERS(limits.h string.h unistd.h)
23 ])
24
25 AC_DEFUN(jm_PREREQ_CANON_HOST,
26 [
27   dnl Add any libraries as early as possible.
28   dnl In particular, inet_ntoa needs -lnsl at least on Solaris5.5.1,
29   dnl so we have to add -lnsl to LIBS before checking for that function.
30   AC_SEARCH_LIBS(gethostbyname, [inet nsl])
31
32   dnl These come from -lnsl on Solaris5.5.1.
33   AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
34
35   AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
36   AC_CHECK_HEADERS(unistd.h string.h netdb.h sys/socket.h \
37                    netinet/in.h arpa/inet.h)
38 ])
39
40 AC_DEFUN(jm_PREREQ_GETPAGESIZE,
41 [
42   AC_CHECK_FUNCS(getpagesize)
43   AC_CHECK_HEADERS(OS.h unistd.h)
44 ])
45
46 AC_DEFUN(jm_PREREQ_QUOTEARG,
47 [
48   AC_CHECK_FUNCS(isascii mbrtowc)
49   AC_CHECK_HEADERS(limits.h stdlib.h string.h wchar.h wctype.h)
50   AC_HEADER_STDC
51   AC_C_BACKSLASH_A
52   AM_C_PROTOTYPES
53 ])
54
55 AC_DEFUN(jm_PREREQ_READUTMP,
56 [
57   AC_HEADER_STDC
58   AC_CHECK_HEADERS(string.h utmpx.h sys/param.h)
59   AC_CHECK_FUNCS(utmpname)
60   AC_CHECK_FUNCS(utmpxname)
61   AM_C_PROTOTYPES
62
63   utmp_includes="\
64 $ac_includes_default
65 #ifdef HAVE_UTMPX_H
66 # include <utmpx.h>
67 #else
68 # include <utmp.h>
69 #endif
70 "
71   AC_CHECK_MEMBERS((struct utmpx.ut_user),,,[$utmp_includes])
72   AC_CHECK_MEMBERS((struct utmp.ut_user),,,[$utmp_includes])
73   AC_CHECK_MEMBERS((struct utmpx.ut_name),,,[$utmp_includes])
74   AC_CHECK_MEMBERS((struct utmp.ut_name),,,[$utmp_includes])
75 ])
76
77 AC_DEFUN(jm_PREREQ_REGEX,
78 [
79   dnl FIXME: Maybe provide a btowc replacement someday: solaris-2.5.1 lacks it.
80   dnl FIXME: Check for wctype and iswctype, and and add -lw if necessary
81   dnl to get them.
82   AC_CHECK_FUNCS(bzero bcopy isascii btowc)
83   AC_CHECK_HEADERS(alloca.h libintl.h wctype.h wchar.h)
84   AC_HEADER_STDC
85   AC_FUNC_ALLOCA
86 ])