1 #serial 95 -*- autoconf -*-
3 dnl Misc type-related macros for coreutils.
5 # Copyright (C) 1998, 2000, 2001, 2002, 2003, 2004, 2005 Free Software
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2, or (at your option)
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software Foundation,
20 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 # Written by Jim Meyering.
28 GNU_PACKAGE="GNU $PACKAGE"
29 AC_DEFINE_UNQUOTED(GNU_PACKAGE, "$GNU_PACKAGE",
30 [The concatenation of the strings `GNU ', and PACKAGE.])
33 AM_MISSING_PROG(HELP2MAN, help2man)
34 AC_SUBST(OPTIONAL_BIN_PROGS)
38 dnl This macro actually runs replacement code. See isc-posix.m4.
39 AC_REQUIRE([AC_ISC_POSIX])dnl
43 AC_REQUIRE([gl_HOST_OS])
44 AC_REQUIRE([gl_ASSERT])
45 AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE])
46 AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO])
47 AC_REQUIRE([gl_CHECK_DECLS])
49 AC_REQUIRE([gl_PREREQ])
51 AC_REQUIRE([gl_FUNC_DIRFD])
52 AC_REQUIRE([AC_FUNC_ACL])
53 AC_REQUIRE([gl_FUNC_LCHOWN])
54 AC_REQUIRE([gl_FUNC_RMDIR_NOTEMPTY])
55 AC_REQUIRE([gl_FUNC_CHOWN])
56 AC_REQUIRE([AC_FUNC_LSTAT])
57 AC_REQUIRE([AC_FUNC_STRERROR_R])
58 AC_REQUIRE([gl_FUNC_GROUP_MEMBER])
60 AC_REQUIRE([gl_AC_FUNC_LINK_FOLLOWS_SYMLINK])
61 AC_REQUIRE([gl_FUNC_FPENDING])
63 # This is for od and stat, and any other program that
64 # uses the PRI.MAX macros from inttypes.h.
65 AC_REQUIRE([gt_INTTYPES_PRI])
66 AC_REQUIRE([gl_ULLONG_MAX])
68 AC_REQUIRE([gl_FUNC_GETGROUPS])
70 AC_REQUIRE([AC_FUNC_FSEEKO])
71 AC_REQUIRE([AC_FUNC_ALLOCA])
73 AC_CONFIG_LIBOBJ_DIR([lib])
74 AC_FUNC_GETLOADAVG([lib])
76 AC_REQUIRE([gl_SYS_PROC_UPTIME])
77 AC_REQUIRE([gl_FUNC_FTRUNCATE])
79 # raise is used by at least sort and ls.
80 AC_REPLACE_FUNCS(raise)
82 # By default, argmatch should fail calling usage (1).
83 AC_DEFINE(ARGMATCH_DIE, [usage (1)],
84 [Define to the function xargmatch calls on failures.])
85 AC_DEFINE(ARGMATCH_DIE_DECL, [extern void usage ()],
86 [Define to the declaration of the xargmatch failure function.])
88 dnl Used to define SETVBUF in sys2.h.
89 dnl This evokes the following warning from autoconf:
90 dnl ...: warning: AC_TRY_RUN called without default to allow cross compiling
91 AC_FUNC_SETVBUF_REVERSED
93 # used by sleep and shred
94 AC_REQUIRE([gl_CLOCK_TIME])
95 AC_CHECK_FUNCS_ONCE(gettimeofday)
96 AC_FUNC_GETTIMEOFDAY_CLOBBER
98 AC_CHECK_FUNCS_ONCE(directio)
100 AC_REQUIRE([AC_FUNC_CLOSEDIR_VOID])
102 AC_CHECK_FUNCS_ONCE( \
128 AC_REQUIRE([cu_PREREQ_STAT_PROG])
130 # for dd.c and shred.c
131 coreutils_saved_libs=$LIBS
132 AC_SEARCH_LIBS([fdatasync], [rt posix4],
133 [test "$ac_cv_search_fdatasync" = "none required" ||
134 LIB_FDATASYNC=$ac_cv_search_fdatasync])
135 AC_SUBST([LIB_FDATASYNC])
136 AC_CHECK_FUNCS(fdatasync)
137 LIBS=$coreutils_saved_libs
139 # See if linking `seq' requires -lm.
140 # It does on nearly every system. The single exception (so far) is
141 # BeOS which has all the math functions in the normal runtime library
142 # and doesn't have a separate math library.
150 AC_TRY_LINK([#include <math.h>], $ac_seq_body, ,
151 [ac_seq_save_LIBS="$LIBS"
153 AC_TRY_LINK([#include <math.h>], $ac_seq_body, SEQ_LIBM=-lm)
154 LIBS="$ac_seq_save_LIBS"
157 AC_REQUIRE([AM_LANGINFO_CODESET])
158 AC_REQUIRE([gl_GLIBC21])
160 gl_FUNC_UNLINK_BUSY_TEXT
162 # These tests are for df.
163 AC_REQUIRE([gl_FSUSAGE])
164 AC_REQUIRE([gl_MOUNTLIST])
165 if test $gl_cv_list_mounted_fs = yes && test $gl_cv_fs_space = yes; then
166 DF_PROG='df$(EXEEXT)'
168 AC_REQUIRE([gl_AC_DOS])
169 AC_REQUIRE([AC_FUNC_CANONICALIZE_FILE_NAME])
171 # If any of these functions don't exist (e.g. DJGPP 2.03),
172 # use the corresponding stub.
173 AC_CHECK_FUNC([fchdir], , [AC_LIBOBJ(fchdir-stub)])
175 AC_REQUIRE([gl_FUNC_FREE])
176 AC_REQUIRE([gl_FUNC_CHDIR_LONG])
177 AC_REQUIRE([gl_FUNC_XFTS])
178 AC_REQUIRE([gl_ROOT_DEV_INO])
179 AC_REQUIRE([gl_VERSION_ETC])
180 AC_REQUIRE([gl_DIACRIT])
181 AC_REQUIRE([gl_TYPE_SOCKLEN_T])
182 AC_REQUIRE([gl_FPRINTFTIME])
183 AC_REQUIRE([gl_CHMOD_SAFER])
184 AC_REQUIRE([gl_CHDIR_SAFER])
187 AC_DEFUN([gl_CHECK_ALL_HEADERS],
189 AC_CHECK_HEADERS_ONCE( \
205 AC_CHECK_HEADERS(sys/mount.h sys/sysctl.h, [], [],
207 [#if HAVE_SYS_PARAM_H
208 #include <sys/param.h>
212 # This macro must be invoked before any tests that run the compiler.
213 AC_DEFUN([gl_CHECK_ALL_TYPES],
215 dnl This test must come as early as possible after the compiler configuration
216 dnl tests, because the choice of the file model can (in principle) affect
217 dnl whether functions and headers are available, whether they work, etc.
218 AC_REQUIRE([AC_SYS_LARGEFILE])
220 dnl This test must precede tests of compiler characteristics like
221 dnl that for the inline keyword, since it may change the degree to
222 dnl which the compiler supports such features.
223 AC_REQUIRE([AM_C_PROTOTYPES])
225 dnl Checks for typedefs, structures, and compiler characteristics.
226 AC_REQUIRE([AC_C_BIGENDIAN])
227 AC_REQUIRE([AC_C_CONST])
228 AC_REQUIRE([AC_C_VOLATILE])
229 AC_REQUIRE([AC_C_INLINE])
230 AC_REQUIRE([AC_C_LONG_DOUBLE])
232 AC_REQUIRE([gl_CHECK_ALL_HEADERS])
233 AC_REQUIRE([AC_HEADER_DIRENT])
234 AC_REQUIRE([AC_HEADER_STDC])
236 [struct stat.st_author,
237 struct stat.st_blksize],,,
238 [$ac_includes_default
239 #include <sys/stat.h>
241 AC_REQUIRE([AC_STRUCT_ST_BLOCKS])
243 AC_REQUIRE([AC_STRUCT_ST_DM_MODE])
245 AC_REQUIRE([AC_TYPE_GETGROUPS])
246 AC_REQUIRE([AC_TYPE_MBSTATE_T])
247 AC_REQUIRE([AC_TYPE_MODE_T])
248 AC_REQUIRE([AC_TYPE_OFF_T])
249 AC_REQUIRE([AC_TYPE_PID_T])
250 AC_REQUIRE([AC_TYPE_SIZE_T])
251 AC_REQUIRE([AC_TYPE_UID_T])
252 AC_CHECK_TYPE(ino_t, unsigned long int)
256 dnl This relies on the fact that autoconf 2.14a's implementation of
257 dnl AC_CHECK_TYPE checks includes unistd.h.
258 AC_CHECK_TYPE(major_t, unsigned int)
259 AC_CHECK_TYPE(minor_t, unsigned int)
261 AC_REQUIRE([gl_AC_TYPE_UINT32_T])
262 AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])
263 AC_REQUIRE([gl_AC_TYPE_UINTPTR_T])
264 AC_REQUIRE([gl_AC_TYPE_UNSIGNED_LONG_LONG])
266 AC_REQUIRE([AC_HEADER_MAJOR])
267 AC_REQUIRE([AC_HEADER_DIRENT])