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