3 dnl We use jm_ for non Autoconf macros.
4 m4_pattern_forbid([^jm_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl
6 # These are the prerequisite macros for files in the lib/
7 # directories of the coreutils package.
30 jm_PREREQ_TEMPNAME # called by mkstemp
35 AC_DEFUN([jm_PREREQ_ADDEXT],
38 AC_SYS_LONG_FILE_NAMES
39 AC_CHECK_FUNCS(pathconf)
40 AC_CHECK_HEADERS(limits.h string.h unistd.h)
43 AC_DEFUN([jm_PREREQ_CANON_HOST],
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])
50 dnl These come from -lnsl on Solaris5.5.1.
51 AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
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)
58 AC_DEFUN([jm_PREREQ_DIRNAME],
61 AC_CHECK_HEADERS(string.h)
64 AC_DEFUN([jm_PREREQ_EXCLUDE],
70 AC_DEFUN([jm_PREREQ_GETPAGESIZE],
72 AC_CHECK_FUNCS(getpagesize)
73 AC_CHECK_HEADERS(OS.h unistd.h)
76 AC_DEFUN([jm_PREREQ_HARD_LOCALE],
78 AC_CHECK_HEADERS(locale.h stdlib.h string.h)
79 AC_CHECK_FUNCS(setlocale)
83 # AC_DEFUN([jm_PREREQ_HASH],
85 # AC_CHECK_HEADERS(stdlib.h)
87 # AC_REQUIRE([jm_CHECK_DECLS])
90 # If you use human.c, you need the following files:
91 # inttypes.m4 ulonglong.m4
92 AC_DEFUN([jm_PREREQ_HUMAN],
94 AC_CHECK_HEADERS(limits.h stdlib.h string.h)
95 AC_CHECK_DECLS([getenv])
96 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
99 AC_DEFUN([jm_PREREQ_MEMCHR],
101 AC_CHECK_HEADERS(limits.h stdlib.h bp-sym.h)
104 AC_DEFUN([jm_PREREQ_PHYSMEM],
106 AC_CHECK_HEADERS(sys/pstat.h unistd.h)
107 AC_CHECK_FUNCS(pstat_getstatic pstat_getdynamic)
110 AC_DEFUN([jm_PREREQ_POSIXVER],
112 AC_CHECK_HEADERS(unistd.h)
113 AC_CHECK_DECLS([getenv])
116 AC_DEFUN([jm_PREREQ_QUOTEARG],
118 AC_CHECK_FUNCS(isascii iswprint)
121 AC_CHECK_HEADERS(limits.h stddef.h stdlib.h string.h wchar.h wctype.h)
128 AC_DEFUN([jm_PREREQ_READUTMP],
131 AC_CHECK_HEADERS(string.h utmp.h utmpx.h sys/param.h)
132 AC_CHECK_FUNCS(utmpname)
133 AC_CHECK_FUNCS(utmpxname)
136 if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then
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])
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])
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])
170 AC_DEFUN([jm_PREREQ_REGEX],
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
175 AC_CHECK_FUNCS(bzero bcopy isascii btowc)
176 AC_CHECK_HEADERS(alloca.h libintl.h wctype.h wchar.h)
181 AC_DEFUN([jm_PREREQ_STAT],
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)
190 #if HAVE_SYS_STATVFS_H
191 # include <sys/statvfs.h>
194 # include <sys/vfs.h>
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>
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])
215 AC_DEFUN([jm_PREREQ_STRNLEN],
219 AC_CHECK_HEADERS(memory.h)
220 AC_CHECK_DECLS([memchr])
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
225 test $ac_cv_func_strnlen_working = yes \
226 && AC_LIBOBJ(strnlen)
229 AC_DEFUN([jm_PREREQ_TEMPNAME],
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])
239 AC_DEFUN([jm_PREREQ_XGETCWD],
242 AC_CHECK_HEADERS(limits.h stdlib.h sys/param.h unistd.h)
243 AC_CHECK_FUNCS(getcwd)
247 AC_DEFUN([jm_PREREQ_XREADLINK],
250 AC_CHECK_HEADERS(limits.h stdlib.h sys/types.h unistd.h)