2 # Process this file with autoconf to produce a configure script.
4 # Copyright (C) 1991-2022 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 dnl Written by Jim Meyering.
23 # Make inter-release version strings look like, e.g., v6.9-219-g58ddd, which
24 # indicates that it is built from the 219th delta (in _some_ repository)
25 # following the v6.9 tag, and that 58ddd is a prefix of the commit SHA1.
26 # The explicit URL can be removed when autoconf > 2.69 is released.
27 AC_INIT([GNU coreutils],
28 m4_esyscmd([build-aux/git-version-gen .tarball-version]),
29 [bug-coreutils@gnu.org],
31 [https://www.gnu.org/software/coreutils/])
33 AC_CONFIG_SRCDIR([src/ls.c])
35 AC_CONFIG_AUX_DIR([build-aux])
36 AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
38 AM_INIT_AUTOMAKE([1.11.2 dist-xz color-tests parallel-tests subdir-objects])
39 AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
41 dnl POSIXCHECK is worthwhile for maintainers, but adds several seconds
42 dnl (more than 10% execution time) to ./configure, with no benefit for
43 dnl most users. Using it to look for bugs requires:
44 dnl GNULIB_POSIXCHECK=1 autoreconf -f
48 dnl make CFLAGS=-DGNULIB_POSIXCHECK=1
49 dnl FIXME: Once we figure out how to avoid false positives, we should
50 dnl have 'make my-distcheck' in dist-check.mk exercise this.
51 m4_syscmd([test "${GNULIB_POSIXCHECK+set}" = set])
52 m4_if(m4_sysval, [0], [], [dnl
53 gl_ASSERT_NO_GNULIB_POSIXCHECK])
58 AC_PROG_GCC_TRADITIONAL
62 gl_SET_CRYPTO_CHECK_DEFAULT([auto-gpl-compat])
66 # The test suite needs to know if we have a working perl.
67 AM_CONDITIONAL([HAVE_PERL], [test "$gl_cv_prog_perl" != no])
69 # gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found])
70 # ------------------------------------------------
71 # If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND.
72 # Otherwise, run RUN-IF-NOT-FOUND.
73 AC_DEFUN([gl_GCC_VERSION_IFELSE],
77 #if ($1) < __GNUC__ || (($1) == __GNUC__ && ($2) <= __GNUC_MINOR__)
80 # error "your version of gcc is older than $1.$2"
87 AC_ARG_ENABLE([gcc-warnings],
88 [AS_HELP_STRING([--enable-gcc-warnings@<:@=TYPE@:>@],
89 [control generation of GCC warnings. The TYPE 'no' disables
90 warnings (default for non-developer builds); 'yes' generates
91 cheap warnings if available (default for developer builds);
92 'expensive' in addition generates expensive-to-compute warnings
96 *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
98 gl_gcc_warnings=$enableval],
100 # GCC provides fine-grained control over diagnostics which
101 # is used in gnulib for example to suppress warnings from
102 # certain sections of code. So if this is available and
103 # we're running from a git repo, then auto enable the warnings.
105 gl_GCC_VERSION_IFELSE([4], [6],
106 [test -d "$srcdir"/.git \
107 && ! test -f "$srcdir"/.tarball-version \
108 && gl_gcc_warnings=yes])]
111 if test $gl_gcc_warnings != no; then
112 gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
113 AC_SUBST([WERROR_CFLAGS])
116 AS_IF([test $gl_gcc_warnings != expensive],
117 [# -fanalyzer and related options slow GCC considerably.
118 ew="$ew -fanalyzer -Wno-analyzer-double-free -Wno-analyzer-malloc-leak"
119 ew="$ew -Wno-analyzer-null-dereference -Wno-analyzer-use-after-free"])
121 # This, $nw, is the list of warnings we disable.
123 nw="$nw -Wdeclaration-after-statement" # too useful to forbid
124 nw="$nw -Waggregate-return" # anachronistic
125 nw="$nw -Wlong-long" # C90 is anachronistic (lib/gethrxtime.h)
126 nw="$nw -Wc++-compat" # We don't care about C++ compilers
127 nw="$nw -Wundef" # Warns on '#if GNULIB_FOO' etc in gnulib
128 nw="$nw -Wtraditional" # Warns on #elif which we use often
129 nw="$nw -Wcast-qual" # Too many warnings for now
130 nw="$nw -Wconversion" # Too many warnings for now
131 nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings
132 nw="$nw -Wsign-conversion" # Too many warnings for now
133 nw="$nw -Wtraditional-conversion" # Too many warnings for now
134 nw="$nw -Wunreachable-code" # Too many warnings for now
135 nw="$nw -Wpadded" # Our structs are not padded
136 nw="$nw -Wredundant-decls" # openat.h declares e.g., mkdirat
137 nw="$nw -Wformat-nonliteral" # who.c and pinky.c strftime uses
138 nw="$nw -Wnested-externs" # use of XARGMATCH/verify_function__
139 nw="$nw -Wswitch-enum" # Too many warnings for now
140 nw="$nw -Wswitch-default" # Too many warnings for now
141 nw="$nw -Wstack-protector" # not worth working around
142 nw="$nw -Wformat-overflow=2" # False alarms due to GCC bug 80776
143 nw="$nw -Wformat-truncation=2" # False alarm in ls.c, probably related
144 # things I might fix soon:
145 nw="$nw -Wfloat-equal" # sort.c, seq.c
146 nw="$nw -Wmissing-format-attribute" # copy.c
147 nw="$nw -Wunsafe-loop-optimizations" # a few src/*.c
148 nw="$nw -Winline" # system.h's readdir_ignoring_dot_and_dotdot
149 nw="$nw -Wvector-operation-performance" # warns about randperm.c
152 # Using -Wstrict-overflow is a pain, but the alternative is worse.
153 # For an example, see the code that provoked this report:
154 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33498
155 # Code like that still infloops with gcc-4.6.0 and -O2. Scary indeed.
157 gl_MANYWARN_ALL_GCC([ws])
158 gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
162 gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now
163 gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
164 gl_WARN_ADD([-Wno-format-nonliteral])
166 # clang is unduly picky about some things.
167 AC_CACHE_CHECK([whether the compiler is clang], [utils_cv_clang],
174 [utils_cv_clang=yes],
175 [utils_cv_clang=no])])
176 if test $utils_cv_clang = yes; then
177 gl_WARN_ADD([-Wno-format-extra-args])
178 gl_WARN_ADD([-Wno-tautological-constant-out-of-range-compare])
181 gl_WARN_ADD([-fdiagnostics-show-option])
182 gl_WARN_ADD([-funit-at-a-time])
184 AC_SUBST([WARN_CFLAGS])
186 AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
187 AH_VERBATIM([FORTIFY_SOURCE],
188 [/* Enable compile-time and run-time bounds-checking, and some warnings,
189 without upsetting glibc 2.15+. */
190 #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
191 # define _FORTIFY_SOURCE 2
194 AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
196 # We use a slightly smaller set of warning options for lib/.
197 # Remove the following and save the result in GNULIB_WARN_CFLAGS.
199 nw="$nw -Wduplicated-branches" # Too many false alarms
200 nw="$nw -Wformat-truncation=2"
201 nw="$nw -Wstrict-overflow"
202 nw="$nw -Wuninitialized"
203 nw="$nw -Wunused-macros"
204 nw="$nw -Wmissing-prototypes"
205 nw="$nw -Wold-style-definition"
206 # FIXME: it may be easy to remove this, since it affects only one file:
207 # the snprintf call at ftoastr.c:132.
208 nw="$nw -Wdouble-promotion"
210 # FIXME: remove this line when gcc improves
211 # FP in careadlinkat.c w/gcc 10.0.1 20200205
212 gl_WARN_ADD([-Wno-return-local-addr])
214 gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
215 AC_SUBST([GNULIB_WARN_CFLAGS])
217 # For gnulib-tests, the set is slightly smaller still.
219 nw="$nw -Wstrict-prototypes"
220 # It's not worth being this picky about test programs.
221 nw="$nw -Wsuggest-attribute=const"
222 nw="$nw -Wsuggest-attribute=format"
223 nw="$nw -Wsuggest-attribute=pure"
224 gl_MANYWARN_COMPLEMENT([GNULIB_TEST_WARN_CFLAGS],
225 [$GNULIB_WARN_CFLAGS], [$nw])
226 AC_SUBST([GNULIB_TEST_WARN_CFLAGS])
229 AC_ARG_ENABLE([single-binary],
230 [AS_HELP_STRING([--enable-single-binary=[shebangs|symlinks]],
231 [Compile all the tools in a single binary, reducing the overall size.
232 When compiled this way, shebangs (default when enabled) or symlinks are
233 installed for each tool that points to the single binary.])],
234 [gl_single_binary=no ;
236 yes) gl_single_binary=shebangs ;;
237 no|shebangs|symlinks) gl_single_binary=$enableval ;;
238 *) AC_MSG_ERROR([bad value $enableval for single-binary option.
239 Options are: symlinks, shebangs, no.]) ;;
241 [gl_single_binary=no]
243 AC_ARG_ENABLE([single-binary-exceptions],
244 [AS_HELP_STRING([--enable-single-binary-exceptions=PROG_LIST],
245 [When used with --enable-single-binary, exclude the PROG_LIST from
246 it, so these programs are compiled as separated files
247 (comma-separated, default none))])],
248 [gl_single_binary_exceptions=$enableval],
249 [gl_single_binary_exceptions=]
251 if test "$gl_single_binary" = 'symlinks'; then
252 if ! test "`echo ls | sed \"$program_transform_name\"`" = 'ls'; then
253 AC_MSG_ERROR([program name transformations are not currently supported
254 with --enable-single-binary=symlinks.])
257 AM_CONDITIONAL([SINGLE_BINARY], [test "$gl_single_binary" != no])
262 AC_CHECK_FUNCS([chroot],
263 gl_ADD_PROG([optional_bin_progs], [chroot]))
264 AC_CHECK_FUNCS([gethostid],
265 gl_ADD_PROG([optional_bin_progs], [hostid]))
266 AC_CHECK_FUNCS([sigsuspend],
267 gl_ADD_PROG([optional_bin_progs], [timeout]))
271 AC_MSG_CHECKING([whether localtime caches TZ])
272 AC_CACHE_VAL([utils_cv_localtime_cache],
273 [if test x$ac_cv_func_tzset = xyes; then
274 AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <time.h>
278 extern char **environ;
282 for (to = from = environ; (*to = *from); from++)
283 if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
289 time_t now = time ((time_t *) 0);
290 int hour_GMT0, hour_unset;
291 if (putenv ("TZ=GMT0") != 0)
293 hour_GMT0 = localtime (&now)->tm_hour;
295 hour_unset = localtime (&now)->tm_hour;
296 if (putenv ("TZ=PST8") != 0)
298 if (localtime (&now)->tm_hour == hour_GMT0)
301 if (localtime (&now)->tm_hour != hour_unset)
305 [utils_cv_localtime_cache=no],
306 [utils_cv_localtime_cache=yes],
307 [# If we have tzset, assume the worst when cross-compiling.
308 utils_cv_localtime_cache=yes])
310 # If we lack tzset, report that localtime does not cache TZ,
311 # since we can't invalidate the cache if we don't have tzset.
312 utils_cv_localtime_cache=no
314 AC_MSG_RESULT([$utils_cv_localtime_cache])
315 if test $utils_cv_localtime_cache = yes; then
316 AC_DEFINE([LOCALTIME_CACHE], [1], [FIXME])
320 AC_CHECK_FUNCS([fclonefileat])
322 # Assume that if getattrat exists, it's compatible with Solaris 11.
323 AC_CHECK_FUNCS([getattrat])
324 if test $ac_cv_func_getattrat = yes; then
326 AC_SUBST([LIB_NVPAIR])
329 # glibc >= 2.28 and linux kernel >= 4.11
330 AC_CHECK_FUNCS([statx])
332 # SCO-ODT-3.0 is reported to need -los to link programs using initgroups
333 AC_CHECK_FUNCS([initgroups])
334 if test $ac_cv_func_initgroups = no; then
335 AC_CHECK_LIB([os], [initgroups])
338 AC_CHECK_FUNCS([syslog])
339 if test $ac_cv_func_syslog = no; then
340 # syslog is not in the default libraries. See if it's in some other.
341 for lib in bsd socket inet; do
342 AC_CHECK_LIB([$lib], [syslog], [AC_DEFINE([HAVE_SYSLOG], [1], [FIXME])
343 LIBS="$LIBS -l$lib"; break])
347 AC_CACHE_CHECK([for 3-argument setpriority function],
348 [utils_cv_func_setpriority],
351 [[#include <sys/time.h>
352 #include <sys/resource.h>
354 [[setpriority (0, 0, 0);]])],
355 [utils_cv_func_setpriority=yes],
356 [utils_cv_func_setpriority=no])])
357 if test $utils_cv_func_setpriority = no; then
358 AC_CHECK_FUNCS([nice])
360 case $utils_cv_func_setpriority,$ac_cv_func_nice in
362 gl_ADD_PROG([optional_bin_progs], [nice])
365 if test "$cross_compiling" = yes || test -c /dev/stdin <.; then
366 AC_DEFINE([DEV_FD_MIGHT_BE_CHR], [1],
367 [Define to 1 if /dev/std{in,out,err} and /dev/fd/N, if they exist, might be
368 character-special devices whose minor device number is the file
369 descriptor number, such as on Solaris. Leave undefined if they are
370 definitely the actual files. This determination should be done after any
371 symbolic links are followed.])
374 AC_DEFUN([coreutils_DUMMY_1],
376 AC_REQUIRE([gl_READUTMP])
377 if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then
378 gl_ADD_PROG([optional_bin_progs], [who])
379 gl_ADD_PROG([optional_bin_progs], [users])
380 gl_ADD_PROG([optional_bin_progs], [pinky])
385 AC_MSG_CHECKING([ut_host in struct utmp])
386 AC_CACHE_VAL([su_cv_func_ut_host_in_utmp],
387 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
390 int s = sizeof ut.ut_host;]])],
391 [su_cv_func_ut_host_in_utmp=yes],
392 [su_cv_func_ut_host_in_utmp=no])])
393 AC_MSG_RESULT([$su_cv_func_ut_host_in_utmp])
394 if test $su_cv_func_ut_host_in_utmp = yes; then
396 AC_DEFINE([HAVE_UT_HOST], [1], [FIXME])
399 if test -z "$have_ut_host"; then
400 AC_MSG_CHECKING([ut_host in struct utmpx])
401 AC_CACHE_VAL([su_cv_func_ut_host_in_utmpx],
402 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
405 int s = sizeof ut.ut_host;]])],
406 [su_cv_func_ut_host_in_utmpx=yes],
407 [su_cv_func_ut_host_in_utmpx=no])])
408 AC_MSG_RESULT([$su_cv_func_ut_host_in_utmpx])
409 if test $su_cv_func_ut_host_in_utmpx = yes; then
410 AC_DEFINE([HAVE_UTMPX_H], [1], [FIXME])
411 AC_DEFINE([HAVE_UT_HOST], [1], [FIXME])
415 GNULIB_BOOT_TIME([gl_ADD_PROG([optional_bin_progs], [uptime])])
417 AC_SYS_POSIX_TERMIOS()
418 gl_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL
420 if test $ac_cv_sys_posix_termios = yes; then
421 gl_ADD_PROG([optional_bin_progs], [stty])
423 AC_MSG_CHECKING([whether termios.h needs _XOPEN_SOURCE])
424 AC_CACHE_VAL([su_cv_sys_termios_needs_xopen_source],
425 [AC_EGREP_CPP([yes], [#include <termios.h>
428 #endif], su_cv_sys_termios_needs_xopen_source=no,
429 AC_EGREP_CPP([yes], [#define _XOPEN_SOURCE
433 #endif], su_cv_sys_termios_needs_xopen_source=yes,
434 su_cv_sys_termios_needs_xopen_source=no))])
435 AC_MSG_RESULT([$su_cv_sys_termios_needs_xopen_source])
436 test $su_cv_sys_termios_needs_xopen_source = yes &&
437 AC_DEFINE([TERMIOS_NEEDS_XOPEN_SOURCE], [1], [FIXME])
439 AC_MSG_CHECKING([c_line in struct termios])
440 AC_CACHE_VAL([su_cv_sys_c_line_in_termios],
441 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if TERMIOS_NEEDS_XOPEN_SOURCE
442 #define _XOPEN_SOURCE
444 #include <sys/types.h>
447 int s = sizeof t.c_line;]])],
448 [su_cv_sys_c_line_in_termios=yes],
449 [su_cv_sys_c_line_in_termios=no])])
450 AC_MSG_RESULT([$su_cv_sys_c_line_in_termios])
451 test $su_cv_sys_c_line_in_termios = yes \
452 && AC_DEFINE([HAVE_C_LINE], [1], [FIXME])
455 # FIXME: note that this macro appears above, too.
456 # I'm leaving it here for now. This whole thing needs to be modernized...
459 gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H
461 if test $gl_cv_sys_tiocgwinsz_needs_termios_h = no && \
462 test $gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h = no; then
463 AC_MSG_CHECKING([TIOCGWINSZ in sys/pty.h])
464 AC_CACHE_VAL([su_cv_sys_tiocgwinsz_in_sys_pty_h],
465 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
466 #ifdef WINSIZE_IN_PTEM
467 # include <sys/stream.h>
468 # include <sys/ptem.h>
470 #include <sys/ioctl.h>
472 #include <sys/pty.h>]], [[int x = TIOCGWINSZ;]])],
473 [su_cv_sys_tiocgwinsz_in_sys_pty_h=yes],
474 [su_cv_sys_tiocgwinsz_in_sys_pty_h=no])])
475 AC_MSG_RESULT([$su_cv_sys_tiocgwinsz_in_sys_pty_h])
477 test $su_cv_sys_tiocgwinsz_in_sys_pty_h = yes \
478 && AC_DEFINE([GWINSZ_IN_SYS_PTY], [1],
479 [Define if your system defines TIOCGWINSZ in sys/pty.h.])
483 AC_CHECK_DECLS([strsignal, sys_siglist, _sys_siglist, __sys_siglist], , ,
485 #include <signal.h>])
487 # Build df only if there's a point to it.
488 if test $gl_cv_list_mounted_fs = yes && test $gl_cv_fs_space = yes; then
489 gl_ADD_PROG([optional_bin_progs], [df])
492 # Build stdbuf only if supported
493 ac_save_CFLAGS=$CFLAGS
494 ac_save_LDFLAGS=$LDFLAGS
495 cu_save_c_werror_flag=$ac_c_werror_flag
497 # Detect warnings about ignored "constructor" attributes.
498 gl_WARN_ADD([-Werror], [CFLAGS])
499 gl_WARN_ADD([-errwarn], [CFLAGS])
500 # Put this message here, after gl_WARN_ADD's chatter.
501 AC_MSG_CHECKING([whether this system supports stdbuf])
502 CFLAGS="-fPIC $CFLAGS"
503 LDFLAGS="-shared $LDFLAGS"
505 # Note we only LINK here rather than RUN to support cross compilation
508 static int stdbuf = 0;
510 void __attribute__ ((constructor))
518 [stdbuf_supported=yes])
519 AC_MSG_RESULT([$stdbuf_supported])
520 if test "$stdbuf_supported" = "yes" && test -z "$EXEEXT"; then
521 gl_ADD_PROG([optional_bin_progs], [stdbuf])
523 CFLAGS=$ac_save_CFLAGS
524 LDFLAGS=$ac_save_LDFLAGS
525 ac_c_werror_flag=$cu_save_c_werror_flag
527 AC_MSG_CHECKING([if __get_cpuid available])
535 unsigned int eax, ebx, ecx, edx;
536 __get_cpuid (1, &eax, &ebx, &ecx, &edx);
542 AC_DEFINE([HAVE_CPUID], [1], [__get_cpuid available])
548 ac_save_CFLAGS=$CFLAGS
549 CFLAGS="-mavx -mpclmul $CFLAGS"
550 AC_MSG_CHECKING([if pclmul intrinsic exists])
553 #include <x86intrin.h>
559 a = _mm_clmulepi64_si128 (a, b, 0x00);
565 AC_DEFINE([HAVE_PCLMUL_INTRINSIC], [1], [pclmul intrinsic exists])
566 pclmul_intrinsic_exists=yes
570 if test "x$cpuid_exists" = "xyes" &&
571 test "x$pclmul_intrinsic_exists" = "xyes"; then
572 AC_DEFINE([USE_PCLMUL_CRC32], [1],
573 [CRC32 calculation by pclmul hardware instruction enabled])
575 AM_CONDITIONAL([USE_PCLMUL_CRC32],
576 [test "x$cpuid_exists" = "xyes" &&
577 test "x$pclmul_intrinsic_exists" = "xyes"])
578 CFLAGS=$ac_save_CFLAGS
580 AC_MSG_CHECKING([if __get_cpuid_count exists])
588 unsigned int eax = 0, ebx = 0, ecx = 0, edx = 0;
589 __get_cpuid_count (7, 0, &eax, &ebx, &ecx, &edx);
595 get_cpuid_count_exists=yes
600 CFLAGS="-mavx2 $CFLAGS"
601 AC_MSG_CHECKING([if avx2 intrinstics exists])
604 #include <x86intrin.h>
610 a = _mm256_sad_epu8 (a, b);
616 AC_DEFINE([HAVE_AVX2_INTRINSIC], [1], [avx2 intrinsics exists])
617 avx2_intrinsic_exists=yes
621 if test "x$get_cpuid_count_exists" = "xyes" &&
622 test "x$avx2_intrinsic_exists" = "xyes"; then
623 AC_DEFINE([USE_AVX2_WC_LINECOUNT], [1], [Counting lines with AVX2 enabled])
625 AM_CONDITIONAL([USE_AVX2_WC_LINECOUNT],
626 [test "x$get_cpuid_count_exists" = "xyes" &&
627 test "x$avx2_intrinsic_exists" = "xyes"])
629 CFLAGS=$ac_save_CFLAGS
631 ############################################################################
633 dnl Autogenerated by the 'gen-lists-of-programs.sh' auxiliary script.
634 dnl Issue proper calls to the macros gl_INCLUDE_EXCLUDE_PROG and
635 dnl gl_ADD_PROG (updating $optional_bin_progs), and generate the list
636 dnl of coreutils programs to be built only upon explicit user request,
637 dnl saving that list in the $no_install_progs_default shell variable.
638 m4_include([m4/cu-progs.m4])
640 # Now that we know which programs will actually be built, determine
641 # which optional helper progs should be compiled.
642 # Note it adding to pkglibexec_PROGRAMS, $(transform) in src/local.mk
643 # may need to be updated accordingly.
644 case " $optional_bin_progs " in
645 *' stdbuf '*) pkglibexec_PROGRAMS='src/libstdbuf.so';;
646 *) pkglibexec_PROGRAMS='';;
650 for p in $optional_bin_progs; do
651 # Change "ginstall.1" to "install.1".
652 test $p = ginstall && p=install
653 # Ignore the "[" program, since writing a portable make rule to
654 # generate its manpage is not practical.
655 dnl Use the autoconf-provided quadrigraph to represent "[",
656 dnl otherwise we will incur in dreadful quoting issues.
657 test x$p = x'@<:@' && continue
661 # Not installed by "make install", but must be built when creating
662 # a distribution tarball.
663 EXTRA_MANS=`for p in $no_install_progs_default $gl_no_install_prog; do
667 # Replace all the programs by the single binary and symlinks if specified.
671 single_binary_install_type=
672 if test "$gl_single_binary" != no; then
673 man1_MANS="$man1_MANS man/coreutils.1"
674 # Convert the list to a space separated list
675 gl_single_binary_exceptions=`echo $gl_single_binary_exceptions | tr ',' ' '`
677 single_binary_progs=`echo $optional_bin_progs`
678 optional_bin_progs="coreutils"
679 for prog in $gl_single_binary_exceptions; do
680 # Fail if requested to exclude a program than was not part of coreutils.
681 case " $single_binary_progs " in
683 gl_REMOVE_PROG([single_binary_progs], [$prog]) ;
684 gl_ADD_PROG([optional_bin_progs], [$prog]) ;;
685 *) AC_MSG_ERROR(['$prog' is not being compiled.]) ;;
689 # single_binary_libs holds the list of libs required by the selected
690 # programs, such as for example -lrt.
692 for p in $single_binary_progs; do
694 test x"$p" = x'@<:@' && p='_'
695 printf '$(src_libsinglebin_%s_a_ldadd) ' "$p"
697 # single_binary_deps holds the list of libsinglebin_*.a files that have the
698 # compiled code of each selected program in a "library" format.
700 for p in $single_binary_progs; do
702 test x"$p" = x'@<:@' && p='_'
703 printf 'src/libsinglebin_%s.a ' "$p"
705 single_binary_install_type="$gl_single_binary"
707 AC_SUBST([single_binary_progs], [$single_binary_progs])
708 AC_SUBST([single_binary_libs], [$single_binary_libs])
709 AC_SUBST([single_binary_deps], [$single_binary_deps])
710 AC_SUBST([single_binary_install_type], [$single_binary_install_type])
713 # The programs built and installed by "make && make install".
714 # Since this is AC_SUBST'd, Automake won't be able to perform rewrite
715 # with $(EXEEXT) appending on it, so we have to do it ourselves -- in
716 # this case, only for $(bin_PROGRAMS).
718 for p in $optional_bin_progs; do echo src/"$p"'$(EXEEXT)'; done`
720 # Normalize whitespace.
721 man1_MANS=`echo $man1_MANS`
722 EXTRA_MANS=`echo $EXTRA_MANS`
723 bin_PROGRAMS=`echo $bin_PROGRAMS`
724 pkglibexec_PROGS=`echo $pkglibexec_PROGRAMS`
726 AC_SUBST([bin_PROGRAMS]) AM_SUBST_NOTMAKE([bin_PROGRAMS])
727 AC_SUBST([pkglibexec_PROGRAMS]) AM_SUBST_NOTMAKE([pkglibexec_PROGRAMS])
728 AC_SUBST([man1_MANS]) AM_SUBST_NOTMAKE([man1_MANS])
729 AC_SUBST([EXTRA_MANS]) AM_SUBST_NOTMAKE([EXTRA_MANS])
731 AC_SUBST([built_programs], [$optional_bin_progs])
733 AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
735 ############################################################################
737 # As long as "grep 'PRI[diouxX]' po/*.pot" reports matches in
738 # translatable strings, we must use need-formatstring-macros here.
739 AM_GNU_GETTEXT([external], [need-formatstring-macros])
740 AM_GNU_GETTEXT_VERSION([0.19.2])
742 # For a test of uniq: it uses the $LOCALE_FR envvar.
748 gnulib-tests/Makefile