1 #serial 104 -*- 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.
24 AC_DEFUN([coreutils_MACROS],
26 GNU_PACKAGE="GNU $PACKAGE"
27 AC_DEFINE_UNQUOTED(GNU_PACKAGE, "$GNU_PACKAGE",
28 [The concatenation of the strings `GNU ', and PACKAGE.])
31 AM_MISSING_PROG(HELP2MAN, help2man)
32 AC_SUBST(OPTIONAL_BIN_PROGS)
36 dnl This macro actually runs replacement code. See isc-posix.m4.
37 AC_REQUIRE([AC_ISC_POSIX])dnl
41 AC_REQUIRE([gl_CHECK_DECLS])
43 AC_REQUIRE([gl_PREREQ])
45 AC_REQUIRE([AC_FUNC_FSEEKO])
47 # By default, argmatch should fail calling usage (1).
48 AC_DEFINE(ARGMATCH_DIE, [usage (1)],
49 [Define to the function xargmatch calls on failures.])
50 AC_DEFINE(ARGMATCH_DIE_DECL, [extern void usage ()],
51 [Define to the declaration of the xargmatch failure function.])
53 dnl Used to define SETVBUF in ../src/system.h.
54 AC_FUNC_SETVBUF_REVERSED
57 AC_REQUIRE([gl_CLOCK_TIME])
59 AC_CHECK_FUNCS_ONCE(directio)
61 AC_CHECK_FUNCS_ONCE( \
79 dnl This can't use AC_REQUIRE; I'm not quite sure why.
82 # for dd.c and shred.c
83 coreutils_saved_libs=$LIBS
84 AC_SEARCH_LIBS([fdatasync], [rt posix4],
85 [test "$ac_cv_search_fdatasync" = "none required" ||
86 LIB_FDATASYNC=$ac_cv_search_fdatasync])
87 AC_SUBST([LIB_FDATASYNC])
88 AC_CHECK_FUNCS(fdatasync)
89 LIBS=$coreutils_saved_libs
91 # See if linking `seq' requires -lm.
92 # It does on nearly every system. The single exception (so far) is
93 # BeOS which has all the math functions in the normal runtime library
94 # and doesn't have a separate math library.
102 AC_TRY_LINK([#include <math.h>], $ac_seq_body, ,
103 [ac_seq_save_LIBS="$LIBS"
105 AC_TRY_LINK([#include <math.h>], $ac_seq_body, SEQ_LIBM=-lm)
106 LIBS="$ac_seq_save_LIBS"
109 AC_REQUIRE([AM_LANGINFO_CODESET])
111 # Build df only if there's a point to it.
112 if test $gl_cv_list_mounted_fs = yes && test $gl_cv_fs_space = yes; then
113 DF_PROG='df$(EXEEXT)'
116 # If any of these functions don't exist (e.g. DJGPP 2.03),
117 # use the corresponding stub.
118 AC_CHECK_FUNC([fchdir], , [AC_LIBOBJ(fchdir-stub)])
121 AC_DEFUN([gl_CHECK_ALL_HEADERS],
123 AC_CHECK_HEADERS_ONCE( \
137 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
139 [#if HAVE_SYS_PARAM_H
140 #include <sys/param.h>
144 # This macro must be invoked before any tests that run the compiler.
145 AC_DEFUN([gl_CHECK_ALL_TYPES],
147 dnl This test must come as early as possible after the compiler configuration
148 dnl tests, because the choice of the file model can (in principle) affect
149 dnl whether functions and headers are available, whether they work, etc.
150 AC_REQUIRE([AC_SYS_LARGEFILE])
152 dnl This test must precede tests of compiler characteristics like
153 dnl that for the inline keyword, since it may change the degree to
154 dnl which the compiler supports such features.
155 AC_REQUIRE([AM_C_PROTOTYPES])
157 dnl Checks for typedefs, structures, and compiler characteristics.
158 AC_REQUIRE([AC_C_BIGENDIAN])
159 AC_REQUIRE([AC_C_VOLATILE])
160 AC_REQUIRE([AC_C_INLINE])
161 AC_REQUIRE([AC_C_LONG_DOUBLE])
162 AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
164 AC_REQUIRE([gl_CHECK_ALL_HEADERS])
166 [struct stat.st_author],,,
167 [$ac_includes_default
168 #include <sys/stat.h>
170 AC_REQUIRE([AC_STRUCT_ST_BLOCKS])
172 AC_REQUIRE([AC_TYPE_GETGROUPS])
173 AC_REQUIRE([AC_TYPE_MBSTATE_T])
174 AC_REQUIRE([AC_TYPE_MODE_T])
175 AC_REQUIRE([AC_TYPE_OFF_T])
176 AC_REQUIRE([AC_TYPE_PID_T])
177 AC_REQUIRE([AC_TYPE_SIZE_T])
178 AC_REQUIRE([AC_TYPE_UID_T])
179 AC_CHECK_TYPE(ino_t, unsigned long int)
181 dnl This relies on the fact that Autoconf's implementation of
182 dnl AC_CHECK_TYPE checks includes unistd.h.
183 AC_CHECK_TYPE(major_t, unsigned int)
184 AC_CHECK_TYPE(minor_t, unsigned int)
186 AC_REQUIRE([AC_HEADER_MAJOR])