1 #serial 105 -*- 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.])
54 AC_REQUIRE([gl_CLOCK_TIME])
56 AC_CHECK_FUNCS_ONCE(directio)
58 AC_CHECK_FUNCS_ONCE( \
76 dnl This can't use AC_REQUIRE; I'm not quite sure why.
79 # for dd.c and shred.c
80 coreutils_saved_libs=$LIBS
81 AC_SEARCH_LIBS([fdatasync], [rt posix4],
82 [test "$ac_cv_search_fdatasync" = "none required" ||
83 LIB_FDATASYNC=$ac_cv_search_fdatasync])
84 AC_SUBST([LIB_FDATASYNC])
85 AC_CHECK_FUNCS(fdatasync)
86 LIBS=$coreutils_saved_libs
88 # See if linking `seq' requires -lm.
89 # It does on nearly every system. The single exception (so far) is
90 # BeOS which has all the math functions in the normal runtime library
91 # and doesn't have a separate math library.
99 AC_TRY_LINK([#include <math.h>], $ac_seq_body, ,
100 [ac_seq_save_LIBS="$LIBS"
102 AC_TRY_LINK([#include <math.h>], $ac_seq_body, SEQ_LIBM=-lm)
103 LIBS="$ac_seq_save_LIBS"
106 AC_REQUIRE([AM_LANGINFO_CODESET])
108 # Build df only if there's a point to it.
109 if test $gl_cv_list_mounted_fs = yes && test $gl_cv_fs_space = yes; then
110 DF_PROG='df$(EXEEXT)'
114 AC_DEFUN([gl_CHECK_ALL_HEADERS],
116 AC_CHECK_HEADERS_ONCE( \
130 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
132 [#if HAVE_SYS_PARAM_H
133 #include <sys/param.h>
137 # This macro must be invoked before any tests that run the compiler.
138 AC_DEFUN([gl_CHECK_ALL_TYPES],
140 dnl This test must come as early as possible after the compiler configuration
141 dnl tests, because the choice of the file model can (in principle) affect
142 dnl whether functions and headers are available, whether they work, etc.
143 AC_REQUIRE([AC_SYS_LARGEFILE])
145 dnl This test must precede tests of compiler characteristics like
146 dnl that for the inline keyword, since it may change the degree to
147 dnl which the compiler supports such features.
148 AC_REQUIRE([AM_C_PROTOTYPES])
150 dnl Checks for typedefs, structures, and compiler characteristics.
151 AC_REQUIRE([AC_C_BIGENDIAN])
152 AC_REQUIRE([AC_C_VOLATILE])
153 AC_REQUIRE([AC_C_INLINE])
154 AC_REQUIRE([AC_C_LONG_DOUBLE])
155 AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
157 AC_REQUIRE([gl_CHECK_ALL_HEADERS])
159 [struct stat.st_author],,,
160 [$ac_includes_default
161 #include <sys/stat.h>
163 AC_REQUIRE([AC_STRUCT_ST_BLOCKS])
165 AC_REQUIRE([AC_TYPE_GETGROUPS])
166 AC_REQUIRE([AC_TYPE_MBSTATE_T])
167 AC_REQUIRE([AC_TYPE_MODE_T])
168 AC_REQUIRE([AC_TYPE_OFF_T])
169 AC_REQUIRE([AC_TYPE_PID_T])
170 AC_REQUIRE([AC_TYPE_SIZE_T])
171 AC_REQUIRE([AC_TYPE_UID_T])
172 AC_CHECK_TYPE(ino_t, unsigned long int)
174 dnl This relies on the fact that Autoconf's implementation of
175 dnl AC_CHECK_TYPE checks includes unistd.h.
176 AC_CHECK_TYPE(major_t, unsigned int)
177 AC_CHECK_TYPE(minor_t, unsigned int)
179 AC_REQUIRE([AC_HEADER_MAJOR])