1 #serial 107 -*- autoconf -*-
3 dnl Misc type-related macros for coreutils.
5 # Copyright (C) 1998, 2000-2008 Free Software Foundation, Inc.
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 # Written by Jim Meyering.
22 AC_DEFUN([coreutils_MACROS],
24 AM_MISSING_PROG(HELP2MAN, help2man)
27 dnl This macro actually runs replacement code. See isc-posix.m4.
28 AC_REQUIRE([AC_ISC_POSIX])dnl
32 AC_REQUIRE([gl_CHECK_DECLS])
34 AC_REQUIRE([gl_PREREQ])
36 AC_REQUIRE([AC_FUNC_FSEEKO])
38 # By default, argmatch should fail calling usage (1).
39 AC_DEFINE(ARGMATCH_DIE, [usage (1)],
40 [Define to the function xargmatch calls on failures.])
41 AC_DEFINE(ARGMATCH_DIE_DECL, [void usage ()],
42 [Define to the declaration of the xargmatch failure function.])
45 AC_REQUIRE([gl_CLOCK_TIME])
47 AC_CHECK_FUNCS_ONCE(directio)
50 AC_CHECK_FUNCS_ONCE([matchpathcon_init_prefix])
53 AC_CHECK_FUNCS_ONCE([nl_langinfo])
55 AC_CHECK_FUNCS_ONCE( \
73 dnl This can't use AC_REQUIRE; I'm not quite sure why.
76 # for dd.c and shred.c
77 coreutils_saved_libs=$LIBS
78 AC_SEARCH_LIBS([fdatasync], [rt posix4],
79 [test "$ac_cv_search_fdatasync" = "none required" ||
80 LIB_FDATASYNC=$ac_cv_search_fdatasync])
81 AC_SUBST([LIB_FDATASYNC])
82 AC_CHECK_FUNCS(fdatasync)
83 LIBS=$coreutils_saved_libs
85 # Check whether libcap is usable -- for ls --color support
86 AC_ARG_ENABLE([libcap],
87 AC_HELP_STRING([--disable-libcap], [disable libcap support]),
88 AC_MSG_WARN([libcap support disabled by user]),
89 [AC_CHECK_LIB([cap], [cap_get_file],
90 [AC_CHECK_HEADER([sys/capability.h],
91 [LIB_CAP=-lcap AC_DEFINE([HAVE_CAP], 1, [libcap usability])],
92 [AC_MSG_WARN([header sys/capability.h was not found, support for libcap will not be built])]
94 [AC_MSG_WARN([libcap library was not found or not usable, support for libcap will not be built])])
98 # See if linking `seq' requires -lm.
99 # It does on nearly every system. The single exception (so far) is
100 # BeOS which has all the math functions in the normal runtime library
101 # and doesn't have a separate math library.
109 AC_TRY_LINK([#include <math.h>], $ac_seq_body, ,
110 [ac_seq_save_LIBS="$LIBS"
112 AC_TRY_LINK([#include <math.h>], $ac_seq_body, SEQ_LIBM=-lm)
113 LIBS="$ac_seq_save_LIBS"
116 AC_REQUIRE([AM_LANGINFO_CODESET])
119 AC_DEFUN([gl_CHECK_ALL_HEADERS],
121 AC_CHECK_HEADERS_ONCE( \
135 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
137 [#if HAVE_SYS_PARAM_H
138 #include <sys/param.h>
142 # This macro must be invoked before any tests that run the compiler.
143 AC_DEFUN([gl_CHECK_ALL_TYPES],
145 dnl This test must come as early as possible after the compiler configuration
146 dnl tests, because the choice of the file model can (in principle) affect
147 dnl whether functions and headers are available, whether they work, etc.
148 AC_REQUIRE([AC_SYS_LARGEFILE])
150 dnl This test must precede tests of compiler characteristics like
151 dnl that for the inline keyword, since it may change the degree to
152 dnl which the compiler supports such features.
153 AC_REQUIRE([AM_C_PROTOTYPES])
155 dnl Checks for typedefs, structures, and compiler characteristics.
156 AC_REQUIRE([AC_C_BIGENDIAN])
157 AC_REQUIRE([AC_C_VOLATILE])
158 AC_REQUIRE([AC_C_INLINE])
159 AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
161 AC_REQUIRE([gl_CHECK_ALL_HEADERS])
163 [struct stat.st_author],,,
164 [$ac_includes_default
165 #include <sys/stat.h>
167 AC_REQUIRE([AC_STRUCT_ST_BLOCKS])
169 AC_REQUIRE([AC_TYPE_GETGROUPS])
170 AC_REQUIRE([AC_TYPE_MBSTATE_T])
171 AC_REQUIRE([AC_TYPE_MODE_T])
172 AC_REQUIRE([AC_TYPE_OFF_T])
173 AC_REQUIRE([AC_TYPE_PID_T])
174 AC_REQUIRE([AC_TYPE_SIZE_T])
175 AC_REQUIRE([AC_TYPE_UID_T])
176 AC_CHECK_TYPE(ino_t, unsigned long int)
178 dnl This relies on the fact that Autoconf's implementation of
179 dnl AC_CHECK_TYPE checks includes unistd.h.
180 AC_CHECK_TYPE(major_t, unsigned int)
181 AC_CHECK_TYPE(minor_t, unsigned int)
183 AC_REQUIRE([AC_HEADER_MAJOR])