]> git.saurik.com Git - bison.git/blob - m4/prereq.m4
Playing with autoscan.
[bison.git] / m4 / prereq.m4
1 #serial 27
2
3 dnl We use jm_ for non Autoconf macros.
4 m4_pattern_forbid([^jm_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl
5
6 # These are the prerequisite macros for files in the lib/
7 # directories of the coreutils package.
8
9 AC_DEFUN([jm_PREREQ],
10 [
11 jm_PREREQ_ADDEXT
12 jm_PREREQ_C_STACK
13 jm_PREREQ_CANON_HOST
14 jm_PREREQ_DIRNAME
15 jm_PREREQ_ERROR
16 jm_PREREQ_EXCLUDE
17 jm_PREREQ_GETPAGESIZE
18 jm_PREREQ_HARD_LOCALE
19 jm_PREREQ_HASH
20 jm_PREREQ_HUMAN
21 jm_PREREQ_MBSWIDTH
22 jm_PREREQ_MEMCHR
23 jm_PREREQ_PHYSMEM
24 jm_PREREQ_POSIXVER
25 jm_PREREQ_QUOTEARG
26 jm_PREREQ_READUTMP
27 jm_PREREQ_REGEX
28 jm_PREREQ_STAT
29 jm_PREREQ_STRNLEN
30 jm_PREREQ_TEMPNAME # called by mkstemp
31 jm_PREREQ_XGETCWD
32 jm_PREREQ_XREADLINK
33 ])
34
35 AC_DEFUN([jm_PREREQ_ADDEXT],
36 [
37 dnl For addext.c.
38 AC_SYS_LONG_FILE_NAMES
39 AC_CHECK_FUNCS(pathconf)
40 AC_CHECK_HEADERS(limits.h string.h unistd.h)
41 ])
42
43 AC_DEFUN([jm_PREREQ_CANON_HOST],
44 [
45 dnl Add any libraries as early as possible.
46 dnl In particular, inet_ntoa needs -lnsl at least on Solaris5.5.1,
47 dnl so we have to add -lnsl to LIBS before checking for that function.
48 AC_SEARCH_LIBS(gethostbyname, [inet nsl])
49
50 dnl These come from -lnsl on Solaris5.5.1.
51 AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
52
53 AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
54 AC_CHECK_HEADERS(unistd.h string.h netdb.h sys/socket.h \
55 netinet/in.h arpa/inet.h)
56 ])
57
58 AC_DEFUN([jm_PREREQ_DIRNAME],
59 [
60 AC_HEADER_STDC
61 AC_CHECK_HEADERS(string.h)
62 ])
63
64 AC_DEFUN([jm_PREREQ_EXCLUDE],
65 [
66 AC_FUNC_FNMATCH_GNU
67 AC_HEADER_STDBOOL
68 ])
69
70 AC_DEFUN([jm_PREREQ_GETPAGESIZE],
71 [
72 AC_CHECK_FUNCS(getpagesize)
73 AC_CHECK_HEADERS(OS.h unistd.h)
74 ])
75
76 AC_DEFUN([jm_PREREQ_HARD_LOCALE],
77 [
78 AC_CHECK_HEADERS(locale.h stdlib.h string.h)
79 AC_CHECK_FUNCS(setlocale)
80 AM_C_PROTOTYPES
81 ])
82
83 # AC_DEFUN([jm_PREREQ_HASH],
84 # [
85 # AC_CHECK_HEADERS(stdlib.h)
86 # AC_HEADER_STDBOOL
87 # AC_REQUIRE([jm_CHECK_DECLS])
88 # ])
89
90 # If you use human.c, you need the following files:
91 # inttypes.m4 ulonglong.m4
92 AC_DEFUN([jm_PREREQ_HUMAN],
93 [
94 AC_CHECK_HEADERS(limits.h stdlib.h string.h)
95 AC_CHECK_DECLS([getenv])
96 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
97 ])
98
99 AC_DEFUN([jm_PREREQ_MEMCHR],
100 [
101 AC_CHECK_HEADERS(limits.h stdlib.h bp-sym.h)
102 ])
103
104 AC_DEFUN([jm_PREREQ_PHYSMEM],
105 [
106 AC_CHECK_HEADERS(sys/pstat.h unistd.h)
107 AC_CHECK_FUNCS(pstat_getstatic pstat_getdynamic)
108 ])
109
110 AC_DEFUN([jm_PREREQ_POSIXVER],
111 [
112 AC_CHECK_HEADERS(unistd.h)
113 AC_CHECK_DECLS([getenv])
114 ])
115
116 AC_DEFUN([jm_PREREQ_QUOTEARG],
117 [
118 AC_CHECK_FUNCS(isascii iswprint)
119 jm_FUNC_MBRTOWC
120 jm_FUNC_MEMCMP
121 AC_CHECK_HEADERS(limits.h stddef.h stdlib.h string.h wchar.h wctype.h)
122 AC_HEADER_STDC
123 AC_C_BACKSLASH_A
124 AC_TYPE_MBSTATE_T
125 AM_C_PROTOTYPES
126 ])
127
128 AC_DEFUN([jm_PREREQ_READUTMP],
129 [
130 AC_HEADER_STDC
131 AC_CHECK_HEADERS(string.h utmp.h utmpx.h sys/param.h)
132 AC_CHECK_FUNCS(utmpname)
133 AC_CHECK_FUNCS(utmpxname)
134 AM_C_PROTOTYPES
135
136 if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then
137 utmp_includes="\
138 $ac_includes_default
139 #ifdef HAVE_UTMPX_H
140 # include <utmpx.h>
141 #endif
142 #ifdef HAVE_UTMP_H
143 # include <utmp.h>
144 #endif
145 "
146 AC_CHECK_MEMBERS([struct utmpx.ut_user],,,[$utmp_includes])
147 AC_CHECK_MEMBERS([struct utmp.ut_user],,,[$utmp_includes])
148 AC_CHECK_MEMBERS([struct utmpx.ut_name],,,[$utmp_includes])
149 AC_CHECK_MEMBERS([struct utmp.ut_name],,,[$utmp_includes])
150 AC_CHECK_MEMBERS([struct utmpx.ut_type],,,[$utmp_includes])
151 AC_CHECK_MEMBERS([struct utmp.ut_type],,,[$utmp_includes])
152 AC_CHECK_MEMBERS([struct utmpx.ut_pid],,,[$utmp_includes])
153 AC_CHECK_MEMBERS([struct utmp.ut_pid],,,[$utmp_includes])
154 AC_CHECK_MEMBERS([struct utmpx.ut_id],,,[$utmp_includes])
155 AC_CHECK_MEMBERS([struct utmp.ut_id],,,[$utmp_includes])
156
157 AC_CHECK_MEMBERS([struct utmpx.ut_exit.ut_exit],,,[$utmp_includes])
158 AC_CHECK_MEMBERS([struct utmp.ut_exit.ut_exit],,,[$utmp_includes])
159 AC_CHECK_MEMBERS([struct utmpx.ut_exit.e_exit],,,[$utmp_includes])
160 AC_CHECK_MEMBERS([struct utmp.ut_exit.e_exit],,,[$utmp_includes])
161
162 AC_CHECK_MEMBERS([struct utmpx.ut_exit.ut_termination],,,[$utmp_includes])
163 AC_CHECK_MEMBERS([struct utmp.ut_exit.ut_termination],,,[$utmp_includes])
164 AC_CHECK_MEMBERS([struct utmpx.ut_exit.e_termination],,,[$utmp_includes])
165 AC_CHECK_MEMBERS([struct utmp.ut_exit.e_termination],,,[$utmp_includes])
166 AC_LIBOBJ(readutmp)
167 fi
168 ])
169
170 AC_DEFUN([jm_PREREQ_REGEX],
171 [
172 dnl FIXME: Maybe provide a btowc replacement someday: solaris-2.5.1 lacks it.
173 dnl FIXME: Check for wctype and iswctype, and and add -lw if necessary
174 dnl to get them.
175 AC_CHECK_FUNCS(bzero bcopy isascii btowc)
176 AC_CHECK_HEADERS(alloca.h libintl.h wctype.h wchar.h)
177 AC_HEADER_STDC
178 AC_FUNC_ALLOCA
179 ])
180
181 AC_DEFUN([jm_PREREQ_STAT],
182 [
183 AC_CHECK_HEADERS(sys/sysmacros.h sys/statvfs.h sys/vfs.h inttypes.h)
184 AC_CHECK_HEADERS(sys/param.h sys/mount.h)
185 AC_CHECK_FUNCS(statvfs)
186 jm_AC_TYPE_LONG_LONG
187
188 statxfs_includes="\
189 $ac_includes_default
190 #if HAVE_SYS_STATVFS_H
191 # include <sys/statvfs.h>
192 #endif
193 #if HAVE_SYS_VFS_H
194 # include <sys/vfs.h>
195 #endif
196 #if ( ! HAVE_SYS_STATVFS_H && ! HAVE_SYS_VFS_H && HAVE_SYS_MOUNT_H && HAVE_SYS_PARAM_H )
197 /* NetBSD 1.5.2 needs these, for the declaration of struct statfs. */
198 # include <sys/param.h>
199 # include <sys/mount.h>
200 #endif
201 "
202 AC_CHECK_MEMBERS([struct statfs.f_basetype],,,[$statxfs_includes])
203 AC_CHECK_MEMBERS([struct statvfs.f_basetype],,,[$statxfs_includes])
204 AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$statxfs_includes])
205 AC_CHECK_MEMBERS([struct statfs.f_type],,,[$statxfs_includes])
206 AC_CHECK_MEMBERS([struct statvfs.f_type],,,[$statxfs_includes])
207 AC_CHECK_MEMBERS([struct statfs.f_fsid.__val],,,[$statxfs_includes])
208 AC_CHECK_MEMBERS([struct statvfs.f_fsid.__val],,,[$statxfs_includes])
209 AC_CHECK_MEMBERS([struct statfs.f_namemax],,,[$statxfs_includes])
210 AC_CHECK_MEMBERS([struct statvfs.f_namemax],,,[$statxfs_includes])
211 AC_CHECK_MEMBERS([struct statfs.f_namelen],,,[$statxfs_includes])
212 AC_CHECK_MEMBERS([struct statvfs.f_namelen],,,[$statxfs_includes])
213 ])
214
215 AC_DEFUN([jm_PREREQ_STRNLEN],
216 [
217 AC_FUNC_STRNLEN
218 AC_HEADER_STDC
219 AC_CHECK_HEADERS(memory.h)
220 AC_CHECK_DECLS([memchr])
221
222 # This is necessary because automake-1.6.1 doesn't understand
223 # that the above use of AC_FUNC_STRNLEN means we may have to use
224 # lib/strnlen.c.
225 test $ac_cv_func_strnlen_working = yes \
226 && AC_LIBOBJ(strnlen)
227 ])
228
229 AC_DEFUN([jm_PREREQ_TEMPNAME],
230 [
231 AC_HEADER_STDC
232 AC_HEADER_STAT
233 AC_CHECK_HEADERS(fcntl.h sys/time.h stdint.h unistd.h)
234 AC_CHECK_FUNCS(__secure_getenv gettimeofday)
235 AC_CHECK_DECLS([getenv])
236 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
237 ])
238
239 AC_DEFUN([jm_PREREQ_XGETCWD],
240 [
241 AC_C_PROTOTYPES
242 AC_CHECK_HEADERS(limits.h stdlib.h sys/param.h unistd.h)
243 AC_CHECK_FUNCS(getcwd)
244 AC_FUNC_GETCWD_NULL
245 ])
246
247 AC_DEFUN([jm_PREREQ_XREADLINK],
248 [
249 AC_C_PROTOTYPES
250 AC_CHECK_HEADERS(limits.h stdlib.h sys/types.h unistd.h)
251 ])