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 dnl This can't use AC_REQUIRE; I'm not quite sure why.
85 # for dd.c and shred.c
86 coreutils_saved_libs=$LIBS
87 AC_SEARCH_LIBS([fdatasync], [rt posix4],
88 [test "$ac_cv_search_fdatasync" = "none required" ||
89 LIB_FDATASYNC=$ac_cv_search_fdatasync])
90 AC_SUBST([LIB_FDATASYNC])
91 AC_CHECK_FUNCS(fdatasync)
92 LIBS=$coreutils_saved_libs
94 # See if linking `seq' requires -lm.
95 # It does on nearly every system. The single exception (so far) is
96 # BeOS which has all the math functions in the normal runtime library
97 # and doesn't have a separate math library.
105 AC_TRY_LINK([#include <math.h>], $ac_seq_body, ,
106 [ac_seq_save_LIBS="$LIBS"
108 AC_TRY_LINK([#include <math.h>], $ac_seq_body, SEQ_LIBM=-lm)
109 LIBS="$ac_seq_save_LIBS"
112 AC_REQUIRE([AM_LANGINFO_CODESET])
114 # Build df only if there's a point to it.
115 if test $gl_cv_list_mounted_fs = yes && test $gl_cv_fs_space = yes; then
116 DF_PROG='df$(EXEEXT)'
119 # If any of these functions don't exist (e.g. DJGPP 2.03),
120 # use the corresponding stub.
121 AC_CHECK_FUNC([fchdir], , [AC_LIBOBJ(fchdir-stub)])
124 AC_DEFUN([gl_CHECK_ALL_HEADERS],
126 AC_CHECK_HEADERS_ONCE( \
140 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
142 [#if HAVE_SYS_PARAM_H
143 #include <sys/param.h>
147 # This macro must be invoked before any tests that run the compiler.
148 AC_DEFUN([gl_CHECK_ALL_TYPES],
150 dnl This test must come as early as possible after the compiler configuration
151 dnl tests, because the choice of the file model can (in principle) affect
152 dnl whether functions and headers are available, whether they work, etc.
153 AC_REQUIRE([AC_SYS_LARGEFILE])
155 dnl This test must precede tests of compiler characteristics like
156 dnl that for the inline keyword, since it may change the degree to
157 dnl which the compiler supports such features.
158 AC_REQUIRE([AM_C_PROTOTYPES])
160 dnl Checks for typedefs, structures, and compiler characteristics.
161 AC_REQUIRE([AC_C_BIGENDIAN])
162 AC_REQUIRE([AC_C_VOLATILE])
163 AC_REQUIRE([AC_C_INLINE])
164 AC_REQUIRE([AC_C_LONG_DOUBLE])
165 AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
167 AC_REQUIRE([gl_CHECK_ALL_HEADERS])
169 [struct stat.st_author],,,
170 [$ac_includes_default
171 #include <sys/stat.h>
173 AC_REQUIRE([AC_STRUCT_ST_BLOCKS])
175 AC_REQUIRE([AC_TYPE_GETGROUPS])
176 AC_REQUIRE([AC_TYPE_MBSTATE_T])
177 AC_REQUIRE([AC_TYPE_MODE_T])
178 AC_REQUIRE([AC_TYPE_OFF_T])
179 AC_REQUIRE([AC_TYPE_PID_T])
180 AC_REQUIRE([AC_TYPE_SIZE_T])
181 AC_REQUIRE([AC_TYPE_UID_T])
182 AC_CHECK_TYPE(ino_t, unsigned long int)
184 dnl This relies on the fact that Autoconf's implementation of
185 dnl AC_CHECK_TYPE checks includes unistd.h.
186 AC_CHECK_TYPE(major_t, unsigned int)
187 AC_CHECK_TYPE(minor_t, unsigned int)
189 AC_REQUIRE([AC_HEADER_MAJOR])