1 #serial 103 -*- autoconf -*-
3 dnl Misc type-related macros for coreutils.
5 # Copyright (C) 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006 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_CHECK_DECLS])
45 AC_REQUIRE([gl_PREREQ])
47 AC_REQUIRE([AC_FUNC_FSEEKO])
49 AC_CONFIG_LIBOBJ_DIR([lib])
51 # By default, argmatch should fail calling usage (1).
52 AC_DEFINE(ARGMATCH_DIE, [usage (1)],
53 [Define to the function xargmatch calls on failures.])
54 AC_DEFINE(ARGMATCH_DIE_DECL, [extern void usage ()],
55 [Define to the declaration of the xargmatch failure function.])
57 dnl Used to define SETVBUF in ../src/system.h.
58 AC_FUNC_SETVBUF_REVERSED
61 AC_REQUIRE([gl_CLOCK_TIME])
63 AC_CHECK_FUNCS_ONCE(directio)
65 AC_CHECK_FUNCS_ONCE( \
82 AC_REQUIRE([cu_PREREQ_STAT_PROG])
84 # for dd.c and shred.c
85 coreutils_saved_libs=$LIBS
86 AC_SEARCH_LIBS([fdatasync], [rt posix4],
87 [test "$ac_cv_search_fdatasync" = "none required" ||
88 LIB_FDATASYNC=$ac_cv_search_fdatasync])
89 AC_SUBST([LIB_FDATASYNC])
90 AC_CHECK_FUNCS(fdatasync)
91 LIBS=$coreutils_saved_libs
93 # See if linking `seq' requires -lm.
94 # It does on nearly every system. The single exception (so far) is
95 # BeOS which has all the math functions in the normal runtime library
96 # and doesn't have a separate math library.
104 AC_TRY_LINK([#include <math.h>], $ac_seq_body, ,
105 [ac_seq_save_LIBS="$LIBS"
107 AC_TRY_LINK([#include <math.h>], $ac_seq_body, SEQ_LIBM=-lm)
108 LIBS="$ac_seq_save_LIBS"
111 AC_REQUIRE([AM_LANGINFO_CODESET])
113 # Build df only if there's a point to it.
114 if test $gl_cv_list_mounted_fs = yes && test $gl_cv_fs_space = yes; then
115 DF_PROG='df$(EXEEXT)'
118 # If any of these functions don't exist (e.g. DJGPP 2.03),
119 # use the corresponding stub.
120 AC_CHECK_FUNC([fchdir], , [AC_LIBOBJ(fchdir-stub)])
123 AC_DEFUN([gl_CHECK_ALL_HEADERS],
125 AC_CHECK_HEADERS_ONCE( \
139 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
141 [#if HAVE_SYS_PARAM_H
142 #include <sys/param.h>
146 # This macro must be invoked before any tests that run the compiler.
147 AC_DEFUN([gl_CHECK_ALL_TYPES],
149 dnl This test must come as early as possible after the compiler configuration
150 dnl tests, because the choice of the file model can (in principle) affect
151 dnl whether functions and headers are available, whether they work, etc.
152 AC_REQUIRE([AC_SYS_LARGEFILE])
154 dnl This test must precede tests of compiler characteristics like
155 dnl that for the inline keyword, since it may change the degree to
156 dnl which the compiler supports such features.
157 AC_REQUIRE([AM_C_PROTOTYPES])
159 dnl Checks for typedefs, structures, and compiler characteristics.
160 AC_REQUIRE([AC_C_BIGENDIAN])
161 AC_REQUIRE([AC_C_VOLATILE])
162 AC_REQUIRE([AC_C_INLINE])
163 AC_REQUIRE([AC_C_LONG_DOUBLE])
164 AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
166 AC_REQUIRE([gl_CHECK_ALL_HEADERS])
168 [struct stat.st_author],,,
169 [$ac_includes_default
170 #include <sys/stat.h>
172 AC_REQUIRE([AC_STRUCT_ST_BLOCKS])
174 AC_REQUIRE([AC_TYPE_GETGROUPS])
175 AC_REQUIRE([AC_TYPE_MBSTATE_T])
176 AC_REQUIRE([AC_TYPE_MODE_T])
177 AC_REQUIRE([AC_TYPE_OFF_T])
178 AC_REQUIRE([AC_TYPE_PID_T])
179 AC_REQUIRE([AC_TYPE_SIZE_T])
180 AC_REQUIRE([AC_TYPE_UID_T])
181 AC_CHECK_TYPE(ino_t, unsigned long int)
183 dnl This relies on the fact that Autoconf's implementation of
184 dnl AC_CHECK_TYPE checks includes unistd.h.
185 AC_CHECK_TYPE(major_t, unsigned int)
186 AC_CHECK_TYPE(minor_t, unsigned int)
188 AC_REQUIRE([AC_HEADER_MAJOR])