1 #serial 114 -*- autoconf -*-
3 dnl Misc type-related macros for coreutils.
5 # Copyright (C) 1998-2023 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 <https://www.gnu.org/licenses/>.
20 # Written by Jim Meyering.
22 AC_DEFUN([coreutils_MACROS],
24 AM_MISSING_PROG(HELP2MAN, help2man)
29 AC_REQUIRE([gl_CHECK_DECLS])
31 AC_REQUIRE([gl_PREREQ])
33 AC_REQUIRE([AC_FUNC_FSEEKO])
35 # By default, argmatch should fail calling usage (EXIT_FAILURE).
36 AC_DEFINE([ARGMATCH_DIE], [usage (EXIT_FAILURE)],
37 [Define to the function xargmatch calls on failures.])
38 AC_DEFINE([ARGMATCH_DIE_DECL], [void usage (int _e)],
39 [Define to the declaration of the xargmatch failure function.])
41 # Ensure VLAs are not used.
42 # Note -Wvla is implicitly added by gl_MANYWARN_ALL_GCC
43 AC_DEFINE([GNULIB_NO_VLA], [1], [Define to 1 to disable use of VLAs])
46 AC_CHECK_FUNCS_ONCE([directio])
48 coreutils_saved_libs=$LIBS
49 LIBS="$LIBS $LIB_SELINUX"
51 AC_CHECK_FUNCS([mode_to_security_class], [], [])
52 LIBS=$coreutils_saved_libs
55 AC_CHECK_FUNCS_ONCE([nl_langinfo])
57 AC_CHECK_FUNCS_ONCE([setitimer setrlimit prctl])
60 AC_CHECK_FUNCS([inotify_init],
61 [AC_DEFINE([HAVE_INOTIFY], [1],
62 [Define to 1 if you have usable inotify support.])])
84 # These checks are for Interix, to avoid its getgr* functions, in favor
85 # of these replacements. The replacement functions are much more efficient
86 # because they do not query the domain controller for user information
87 # when it is not needed.
94 dnl This can't use AC_REQUIRE; I'm not quite sure why.
97 # for dd.c and shred.c
99 # Use fdatasync only if declared. On MacOS X 10.7, fdatasync exists but
100 # is not declared, and is ineffective.
102 AC_SUBST([LIB_FDATASYNC])
103 AC_CHECK_DECLS_ONCE([fdatasync])
104 if test $ac_cv_have_decl_fdatasync = yes; then
105 coreutils_saved_libs=$LIBS
106 AC_SEARCH_LIBS([fdatasync], [rt posix4],
107 [test "$ac_cv_search_fdatasync" = "none required" ||
108 LIB_FDATASYNC=$ac_cv_search_fdatasync])
109 AC_CHECK_FUNCS([fdatasync])
110 LIBS=$coreutils_saved_libs
113 # Check whether libcap is usable -- for ls --color support
115 AC_ARG_ENABLE([libcap],
116 AS_HELP_STRING([--disable-libcap], [disable libcap support]))
117 if test "X$enable_libcap" != "Xno"; then
118 AC_CHECK_LIB([cap], [cap_get_file],
119 [AC_CHECK_HEADER([sys/capability.h],
121 AC_DEFINE([HAVE_CAP], [1], [libcap usability])]
123 if test "X$LIB_CAP" = "X"; then
124 if test "X$enable_libcap" = "Xyes"; then
125 AC_MSG_ERROR([libcap library was not found or not usable])
127 AC_MSG_WARN([libcap library was not found or not usable.])
128 AC_MSG_WARN([AC_PACKAGE_NAME will be built without capability support.])
132 AC_MSG_WARN([libcap support disabled by user])
136 # See if linking 'seq' requires -lm.
137 # It does on nearly every system. The single exception (so far) is
138 # BeOS which has all the math functions in the normal runtime library
139 # and doesn't have a separate math library.
143 for jm_seqlibs in '' '-lm'; do
144 jm_seq_save_LIBS=$LIBS
149 [[static double x, y;
152 x = modf (x, &y);]])],
153 [SEQ_LIBM=$jm_seqlibs
155 LIBS=$jm_seq_save_LIBS
159 # See is fpsetprec() required to use extended double precision
160 # This is needed on 32 bit FreeBSD to give accurate conversion of:
161 # `numfmt 9223372036854775808`
164 [[#include <ieeefp.h>
169 # error not required on 64 bit
172 [ac_have_fpsetprec=yes],
173 [ac_have_fpsetprec=no])
174 if test "$ac_have_fpsetprec" = "yes" ; then
175 AC_DEFINE([HAVE_FPSETPREC], 1, [whether fpsetprec is present and required])
178 AC_REQUIRE([AM_LANGINFO_CODESET])
180 # Accept configure options: --with-tty-group[=GROUP], --without-tty-group
181 # You can determine the group of a TTY via 'stat --format %G /dev/tty'
182 # Omitting this option is equivalent to using --without-tty-group.
183 AC_ARG_WITH([tty-group],
184 AS_HELP_STRING([--with-tty-group[[[=NAME]]]],
185 [group used by system for TTYs, "tty" when not specified]
186 [ (default: do not rely on any group used for TTYs)]),
187 [tty_group_name=$withval],
190 if test "x$tty_group_name" != xno; then
191 if test "x$tty_group_name" = xyes; then
194 AC_MSG_NOTICE([TTY group used by system set to "$tty_group_name"])
195 AC_DEFINE_UNQUOTED([TTY_GROUP_NAME], ["$tty_group_name"],
196 [group used by system for TTYs])
200 AC_DEFUN([gl_CHECK_ALL_HEADERS],
202 AC_CHECK_HEADERS_ONCE([
214 AC_CHECK_HEADERS([sys/sysctl.h], [], [],
216 [#if HAVE_SYS_PARAM_H
217 #include <sys/param.h>
221 # This macro must be invoked before any tests that run the compiler.
222 AC_DEFUN([gl_CHECK_ALL_TYPES],
224 dnl Checks for typedefs, structures, and compiler characteristics.
225 AC_REQUIRE([gl_BIGENDIAN])
226 AC_REQUIRE([AC_C_VOLATILE])
227 AC_REQUIRE([AC_C_INLINE])
228 AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
230 AC_REQUIRE([gl_CHECK_ALL_HEADERS])
232 [struct stat.st_author],,,
233 [$ac_includes_default
234 #include <sys/stat.h>
236 AC_REQUIRE([AC_STRUCT_ST_BLOCKS])
238 AC_REQUIRE([AC_TYPE_GETGROUPS])
239 AC_REQUIRE([AC_TYPE_MBSTATE_T])
240 AC_REQUIRE([AC_TYPE_MODE_T])
241 AC_REQUIRE([AC_TYPE_OFF_T])
242 AC_REQUIRE([AC_TYPE_PID_T])
243 AC_REQUIRE([AC_TYPE_SIZE_T])
244 AC_REQUIRE([AC_TYPE_UID_T])
245 AC_CHECK_TYPE([ino_t], [unsigned long int])
247 dnl This relies on the fact that Autoconf's implementation of
248 dnl AC_CHECK_TYPE checks includes unistd.h.
249 AC_CHECK_TYPE([major_t], [unsigned int])
250 AC_CHECK_TYPE([minor_t], [unsigned int])
252 AC_REQUIRE([AC_HEADER_MAJOR])