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