1 #serial 116 -*- autoconf -*-
3 dnl Misc type-related macros for coreutils.
5 # Copyright (C) 1998-2024 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.])])
79 # These checks are for Interix, to avoid its getgr* functions, in favor
80 # of these replacements. The replacement functions are much more efficient
81 # because they do not query the domain controller for user information
82 # when it is not needed.
89 dnl This can't use AC_REQUIRE; I'm not quite sure why.
92 # Check whether libcap is usable -- for ls --color support
94 AC_ARG_ENABLE([libcap],
95 AS_HELP_STRING([--disable-libcap], [disable libcap support]))
96 if test "X$enable_libcap" != "Xno"; then
97 AC_CHECK_LIB([cap], [cap_get_file],
98 [AC_CHECK_HEADER([sys/capability.h],
100 AC_DEFINE([HAVE_CAP], [1], [libcap usability])]
102 if test "X$LIB_CAP" = "X"; then
103 if test "X$enable_libcap" = "Xyes"; then
104 AC_MSG_ERROR([libcap library was not found or not usable])
106 AC_MSG_WARN([libcap library was not found or not usable.])
107 AC_MSG_WARN([AC_PACKAGE_NAME will be built without capability support.])
111 AC_MSG_WARN([libcap support disabled by user])
115 # See if linking 'seq' requires -lm.
116 # It does on nearly every system. The single exception (so far) is
117 # BeOS which has all the math functions in the normal runtime library
118 # and doesn't have a separate math library.
122 for jm_seqlibs in '' '-lm'; do
123 jm_seq_save_LIBS=$LIBS
128 [[static double x, y;
131 x = modf (x, &y);]])],
132 [SEQ_LIBM=$jm_seqlibs
134 LIBS=$jm_seq_save_LIBS
138 # See is fpsetprec() required to use extended double precision
139 # This is needed on 32 bit FreeBSD to give accurate conversion of:
140 # `numfmt 9223372036854775808`
143 [[#include <ieeefp.h>
148 # error not required on 64 bit
151 [ac_have_fpsetprec=yes],
152 [ac_have_fpsetprec=no])
153 if test "$ac_have_fpsetprec" = "yes" ; then
154 AC_DEFINE([HAVE_FPSETPREC], 1, [whether fpsetprec is present and required])
157 AC_REQUIRE([AM_LANGINFO_CODESET])
159 # Accept configure options: --with-tty-group[=GROUP], --without-tty-group
160 # You can determine the group of a TTY via 'stat --format %G /dev/tty'
161 # Omitting this option is equivalent to using --without-tty-group.
162 AC_ARG_WITH([tty-group],
163 AS_HELP_STRING([--with-tty-group[[[=NAME]]]],
164 [group used by system for TTYs, "tty" when not specified]
165 [ (default: do not rely on any group used for TTYs)]),
166 [tty_group_name=$withval],
169 if test "x$tty_group_name" != xno; then
170 if test "x$tty_group_name" = xyes; then
173 AC_MSG_NOTICE([TTY group used by system set to "$tty_group_name"])
174 AC_DEFINE_UNQUOTED([TTY_GROUP_NAME], ["$tty_group_name"],
175 [group used by system for TTYs])
179 AC_DEFUN([gl_CHECK_ALL_HEADERS],
181 AC_CHECK_HEADERS_ONCE([
193 AC_CHECK_HEADERS([sys/sysctl.h], [], [],
195 [#if HAVE_SYS_PARAM_H
196 #include <sys/param.h>
200 # This macro must be invoked before any tests that run the compiler.
201 AC_DEFUN([gl_CHECK_ALL_TYPES],
203 dnl Checks for typedefs, structures, and compiler characteristics.
204 AC_REQUIRE([gl_BIGENDIAN])
205 AC_REQUIRE([AC_C_VOLATILE])
206 AC_REQUIRE([AC_C_INLINE])
207 AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
209 AC_REQUIRE([gl_CHECK_ALL_HEADERS])
211 [struct stat.st_author],,,
212 [$ac_includes_default
213 #include <sys/stat.h>
215 AC_REQUIRE([AC_STRUCT_ST_BLOCKS])
217 AC_REQUIRE([AC_TYPE_GETGROUPS])
219 dnl FIXME is this section still needed?
220 dnl These types are universally available now.
221 AC_REQUIRE([AC_TYPE_MBSTATE_T])
222 AC_REQUIRE([AC_TYPE_MODE_T])
223 AC_REQUIRE([AC_TYPE_OFF_T])
224 AC_REQUIRE([AC_TYPE_PID_T])
225 AC_REQUIRE([AC_TYPE_SIZE_T])
226 AC_REQUIRE([AC_TYPE_UID_T])
227 AC_CHECK_TYPE([ino_t], [],
228 [AC_DEFINE([ino_t], [unsigned long int],
229 [Type of file serial numbers, also known as inode numbers.])])
231 dnl This relies on the fact that Autoconf's implementation of
232 dnl AC_CHECK_TYPE checks includes unistd.h.
233 AC_CHECK_TYPE([major_t], [],
234 [AC_DEFINE([major_t], [unsigned int], [Type of major device numbers.])])
235 AC_CHECK_TYPE([minor_t], [],
236 [AC_DEFINE([minor_t], [unsigned int], [Type of minor device numbers.])])
238 AC_REQUIRE([AC_HEADER_MAJOR])