1 #serial 31 -*- autoconf -*-
3 dnl Misc type-related macros for fileutils, sh-utils, textutils.
9 GNU_PACKAGE="GNU $PACKAGE"
10 AC_DEFINE_UNQUOTED(GNU_PACKAGE, "$GNU_PACKAGE",
11 [The concatenation of the strings `GNU ', and PACKAGE.])
14 AC_SUBST(OPTIONAL_BIN_PROGS)
15 AC_SUBST(OPTIONAL_BIN_ZCRIPTS)
19 dnl This macro actually runs replacement code. See isc-posix.m4.
20 AC_REQUIRE([AC_ISC_POSIX])dnl
23 jm_INCLUDED_REGEX([lib/regex.c])
25 AC_REQUIRE([jm_BISON])
26 AC_REQUIRE([jm_ASSERT])
27 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
28 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_UTIMBUF])
29 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_DIRENT_D_TYPE])
30 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_DIRENT_D_INO])
31 AC_REQUIRE([jm_CHECK_DECLS])
33 AC_REQUIRE([jm_PREREQ])
35 AC_REQUIRE([jm_FUNC_LCHOWN])
36 AC_REQUIRE([fetish_FUNC_RMDIR_NOTEMPTY])
37 AC_REQUIRE([jm_FUNC_CHOWN])
38 AC_REQUIRE([jm_FUNC_MKTIME])
39 AC_REQUIRE([jm_FUNC_LSTAT])
40 AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
41 AC_REQUIRE([jm_FUNC_STAT])
42 AC_REQUIRE([jm_FUNC_REALLOC])
43 AC_REQUIRE([jm_FUNC_MALLOC])
44 AC_REQUIRE([AC_FUNC_STRERROR_R])
45 AC_REQUIRE([jm_FUNC_NANOSLEEP])
46 AC_REQUIRE([jm_FUNC_READDIR])
47 AC_REQUIRE([jm_FUNC_MEMCMP])
48 AC_REQUIRE([jm_FUNC_GLIBC_UNLOCKED_IO])
49 AC_REQUIRE([jm_FUNC_FNMATCH])
50 AC_REQUIRE([jm_FUNC_GROUP_MEMBER])
51 AC_REQUIRE([jm_FUNC_PUTENV])
53 AC_REQUIRE([jm_AC_PREREQ_XSTRTOUMAX])
54 AC_REQUIRE([jm_AC_FUNC_LINK_FOLLOWS_SYMLINK])
55 AC_REQUIRE([AM_FUNC_ERROR_AT_LINE])
56 AC_REQUIRE([jm_FUNC_GNU_STRFTIME])
57 AC_REQUIRE([jm_FUNC_MKTIME])
58 AC_REQUIRE([jm_FUNC_FPENDING])
60 AC_REQUIRE([jm_FUNC_GETGROUPS])
61 test -n "$GETGROUPS_LIB" && LIBS="$GETGROUPS_LIB $LIBS"
63 AC_REQUIRE([AC_FUNC_VPRINTF])
64 AC_REQUIRE([AC_FUNC_ALLOCA])
65 AC_FUNC_GETLOADAVG([lib])
66 AC_REQUIRE([jm_SYS_PROC_UPTIME])
67 AC_REQUIRE([jm_FUNC_FTRUNCATE])
68 AC_REQUIRE([vb_FUNC_RENAME])
70 AC_REPLACE_FUNCS(strcasecmp strncasecmp)
71 AC_REPLACE_FUNCS(dup2)
72 AC_REPLACE_FUNCS(gethostname getusershell)
73 AC_REPLACE_FUNCS(stime strcspn stpcpy strstr strtol strtoul)
74 AC_REPLACE_FUNCS(strpbrk)
75 AC_REPLACE_FUNCS(euidaccess memcmp rmdir rpmatch strndup strverscmp)
76 AC_REPLACE_FUNCS(atexit)
77 AC_REPLACE_FUNCS(strnlen)
78 AC_REPLACE_FUNCS(getpass)
80 dnl used by e.g. intl/*domain.c and lib/canon-host.c
81 AC_REPLACE_FUNCS(strdup)
83 AC_REPLACE_FUNCS(memchr memcpy memmove memrchr memset)
84 AC_CHECK_FUNCS(getpagesize)
86 # By default, argmatch should fail calling usage (1).
87 AC_DEFINE(ARGMATCH_DIE, [usage (1)],
88 [Define to the function xargmatch calls on failures.])
89 AC_DEFINE(ARGMATCH_DIE_DECL, [extern void usage ()],
90 [Define to the declaration of the xargmatch failure function.])
92 dnl Used to define SETVBUF in sys2.h.
93 dnl This evokes the following warning from autoconf:
94 dnl ...: warning: AC_TRY_RUN called without default to allow cross compiling
95 AC_FUNC_SETVBUF_REVERSED
97 # used by sleep and shred
98 # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
99 # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
101 # Save and restore LIBS so e.g., -lrt, isn't added to it. Otherwise, *all*
102 # programs in the package would end up linked with that potentially-shared
103 # library, inducing unnecessary run-time overhead.
104 fetish_saved_libs=$LIBS
105 AC_SEARCH_LIBS(clock_gettime, [rt posix4],
106 [LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
107 AC_SUBST(LIB_CLOCK_GETTIME)
108 AC_CHECK_FUNCS(clock_gettime)
109 LIBS=$fetish_saved_libs
110 AC_CHECK_FUNCS(gettimeofday)
112 AC_REQUIRE([AC_FUNC_CLOSEDIR_VOID])
113 AC_REQUIRE([jm_FUNC_UTIME])
148 if test $am_cv_func_working_getline != yes; then
149 AC_CHECK_FUNCS(getdelim)
155 test $am_cv_func_strtod_needs_libm = yes && POW_LIBM=-lm
157 # See if linking `seq' requires -lm.
158 # It does on nearly every system. The single exception (so far) is
159 # BeOS which has all the math functions in the normal runtime library
160 # and doesn't have a separate math library.
168 AC_TRY_LINK([#include <math.h>], $ac_seq_body, ,
169 [ac_seq_save_LIBS="$LIBS"
171 AC_TRY_LINK([#include <math.h>], $ac_seq_body, SEQ_LIBM=-lm)
172 LIBS="$ac_seq_save_LIBS"
178 jm_FUNC_UNLINK_BUSY_TEXT
180 # These tests are for df.
181 jm_LIST_MOUNTED_FILESYSTEMS([list_mounted_fs=yes], [list_mounted_fs=no])
183 jm_FILE_SYSTEM_USAGE([space=yes], [space=no])
184 if test $list_mounted_fs = yes && test $space = yes; then
189 AC_REQUIRE([jm_AC_DOS])
193 # These tests must be run before any use of AC_CHECK_TYPE,
194 # because that macro compiles code that tests e.g., HAVE_UNISTD_H.
195 # See the definition of ac_includes_default in `configure'.
196 AC_DEFUN(jm_CHECK_ALL_HEADERS,
238 # This macro must be invoked before any tests that run the compiler.
239 AC_DEFUN(jm_CHECK_ALL_TYPES,
241 # FIXME: I shouldn't have to require this macro here. Rather, it should
242 # be required by any autoconf macro that performs a compile-time test or
243 # otherwise uses confdefs.h.
244 AC_REQUIRE([AC__GNU_SOURCE])
246 dnl This test must come as early as possible after the compiler configuration
247 dnl tests, because the choice of the file model can (in principle) affect
248 dnl whether functions and headers are available, whether they work, etc.
249 AC_REQUIRE([AC_SYS_LARGEFILE])
251 dnl This test must precede tests of compiler characteristics like
252 dnl that for the inline keyword, since it may change the degree to
253 dnl which the compiler supports such features.
254 AC_REQUIRE([AM_C_PROTOTYPES])
256 dnl Checks for typedefs, structures, and compiler characteristics.
257 AC_REQUIRE([AC_C_BIGENDIAN])
258 AC_REQUIRE([AC_PROG_CC_STDC])
259 AC_REQUIRE([AC_C_CONST])
260 AC_REQUIRE([AC_C_VOLATILE])
261 AC_REQUIRE([AC_C_INLINE])
262 AC_REQUIRE([AC_C_LONG_DOUBLE])
264 AC_REQUIRE([jm_CHECK_ALL_HEADERS])
265 AC_REQUIRE([AC_HEADER_DIRENT])
266 AC_REQUIRE([AC_HEADER_STDC])
267 AC_CHECK_MEMBERS([struct stat.st_blksize],,,[$ac_includes_default
268 #include <sys/stat.h>
270 AC_REQUIRE([AC_STRUCT_ST_BLOCKS])
272 AC_REQUIRE([AC_STRUCT_TM])
273 AC_REQUIRE([AC_STRUCT_TIMEZONE])
274 AC_REQUIRE([AC_HEADER_STAT])
275 AC_REQUIRE([AC_STRUCT_ST_MTIM_NSEC])
276 AC_REQUIRE([AC_STRUCT_ST_DM_MODE])
277 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_TIMESPEC])
279 AC_REQUIRE([AC_TYPE_GETGROUPS])
280 AC_REQUIRE([AC_TYPE_MODE_T])
281 AC_REQUIRE([AC_TYPE_OFF_T])
282 AC_REQUIRE([AC_TYPE_PID_T])
283 AC_REQUIRE([AC_TYPE_SIGNAL])
284 AC_REQUIRE([AC_TYPE_SIZE_T])
285 AC_REQUIRE([AC_TYPE_UID_T])
286 AC_CHECK_TYPE(ino_t, unsigned long)
288 dnl This relies on the fact that autoconf 2.14a's implementation of
289 dnl AC_CHECK_TYPE checks includes unistd.h.
290 AC_CHECK_TYPE(ssize_t, int)
292 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
293 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
295 AC_REQUIRE([AC_HEADER_MAJOR])
296 AC_REQUIRE([AC_HEADER_DIRENT])