build: update gnulib submodule to latest
[coreutils.git] / configure.ac
blobc2ad08c39301a5eaa8dff89596ceb04413389d32
1 # -*- autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 # Copyright (C) 1991-2020 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.
21 AC_PREREQ([2.69])
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],
30         [coreutils],
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
45 dnl   ./configure
46 dnl   make
47 dnl   make -C src clean
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])
55 AC_PROG_CC_STDC
56 AM_PROG_CC_C_O
57 AC_PROG_CPP
58 AC_PROG_GCC_TRADITIONAL
59 AC_PROG_RANLIB
60 AC_PROG_LN_S
61 gl_EARLY
62 gl_SET_CRYPTO_CHECK_DEFAULT([auto-gpl-compat])
63 gl_INIT
64 coreutils_MACROS
66 # The test suite needs to know if we have a working perl.
67 # FIXME: this is suboptimal.  Ideally, we would be able to call gl_PERL
68 # with an ACTION-IF-NOT-FOUND argument ...
69 cu_have_perl=yes
70 case $PERL in *"/missing "*) cu_have_perl=no;; esac
71 AM_CONDITIONAL([HAVE_PERL], [test $cu_have_perl = yes])
73 # gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found])
74 # ------------------------------------------------
75 # If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND.
76 # Otherwise, run RUN-IF-NOT-FOUND.
77 AC_DEFUN([gl_GCC_VERSION_IFELSE],
78   [AC_PREPROC_IFELSE(
79     [AC_LANG_PROGRAM(
80       [[
81 #if ($1) < __GNUC__ || (($1) == __GNUC__ && ($2) <= __GNUC_MINOR__)
82 /* ok */
83 #else
84 # error "your version of gcc is older than $1.$2"
85 #endif
86       ]]),
87     ], [$3], [$4])
88   ]
91 AC_ARG_ENABLE([gcc-warnings],
92   [AS_HELP_STRING([--enable-gcc-warnings],
93      [turn on many GCC warnings (for developers; best with GNU make)])],
94   [case $enableval in
95      yes|no) ;;
96      *)      AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
97    esac
98    gl_gcc_warnings=$enableval],
99   [
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.
104    gl_gcc_warnings=no
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" = yes; then
112   gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
113   AC_SUBST([WERROR_CFLAGS])
115   nw=
116   # This, $nw, is the list of warnings we disable.
117   nw="$nw -Wdeclaration-after-statement" # too useful to forbid
118   nw="$nw -Waggregate-return"       # anachronistic
119   nw="$nw -Wlong-long"              # C90 is anachronistic (lib/gethrxtime.h)
120   nw="$nw -Wc++-compat"             # We don't care about C++ compilers
121   nw="$nw -Wundef"                  # Warns on '#if GNULIB_FOO' etc in gnulib
122   nw="$nw -Wtraditional"            # Warns on #elif which we use often
123   nw="$nw -Wcast-qual"              # Too many warnings for now
124   nw="$nw -Wconversion"             # Too many warnings for now
125   nw="$nw -Wsystem-headers"         # Don't let system headers trigger warnings
126   nw="$nw -Wsign-conversion"        # Too many warnings for now
127   nw="$nw -Wtraditional-conversion" # Too many warnings for now
128   nw="$nw -Wunreachable-code"       # Too many warnings for now
129   nw="$nw -Wpadded"                 # Our structs are not padded
130   nw="$nw -Wredundant-decls"        # openat.h declares e.g., mkdirat
131   nw="$nw -Wformat-nonliteral"      # who.c and pinky.c strftime uses
132   nw="$nw -Wnested-externs"         # use of XARGMATCH/verify_function__
133   nw="$nw -Wswitch-enum"            # Too many warnings for now
134   nw="$nw -Wswitch-default"         # Too many warnings for now
135   nw="$nw -Wstack-protector"        # not worth working around
136   nw="$nw -Wformat-overflow=2"      # False alarms due to GCC bug 80776
137   nw="$nw -Wformat-truncation=2"    # False alarm in ls.c, probably related
138   # things I might fix soon:
139   nw="$nw -Wfloat-equal"            # sort.c, seq.c
140   nw="$nw -Wmissing-format-attribute" # copy.c
141   nw="$nw -Wunsafe-loop-optimizations" # a few src/*.c
142   nw="$nw -Winline"                 # system.h's readdir_ignoring_dot_and_dotdot
143   nw="$nw -Wsuggest-attribute=format" # warns about copy.c and factor.c
144   nw="$nw -Wvector-operation-performance" # warns about randperm.c
147   # Using -Wstrict-overflow is a pain, but the alternative is worse.
148   # For an example, see the code that provoked this report:
149   # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33498
150   # Code like that still infloops with gcc-4.6.0 and -O2.  Scary indeed.
152   gl_MANYWARN_ALL_GCC([ws])
153   gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
154   for w in $ws; do
155     gl_WARN_ADD([$w])
156   done
157   gl_WARN_ADD([-Wno-sign-compare])     # Too many warnings for now
158   gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
159   gl_WARN_ADD([-Wno-format-nonliteral])
161   # clang is unduly picky about some things.
162   AC_CACHE_CHECK([whether the compiler is clang], [utils_cv_clang],
163     [AC_COMPILE_IFELSE(
164        [AC_LANG_PROGRAM([[
165             #ifndef __clang__
166               #error "not clang"
167             #endif
168           ]])],
169        [utils_cv_clang=yes],
170        [utils_cv_clang=no])])
171   if test $utils_cv_clang = yes; then
172     gl_WARN_ADD([-Wno-format-extra-args])
173     gl_WARN_ADD([-Wno-tautological-constant-out-of-range-compare])
174   fi
176   gl_WARN_ADD([-fdiagnostics-show-option])
177   gl_WARN_ADD([-funit-at-a-time])
179   AC_SUBST([WARN_CFLAGS])
181   AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
182   AH_VERBATIM([FORTIFY_SOURCE],
183   [/* Enable compile-time and run-time bounds-checking, and some warnings,
184       without upsetting glibc 2.15+. */
185    #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
186    # define _FORTIFY_SOURCE 2
187    #endif
188   ])
189   AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
191   # We use a slightly smaller set of warning options for lib/.
192   # Remove the following and save the result in GNULIB_WARN_CFLAGS.
193   nw=
194   nw="$nw -Wduplicated-branches"    # Too many false alarms
195   nw="$nw -Wformat-truncation=2"
196   nw="$nw -Wstrict-overflow"
197   nw="$nw -Wuninitialized"
198   nw="$nw -Wunused-macros"
199   nw="$nw -Wmissing-prototypes"
200   nw="$nw -Wold-style-definition"
201   # FIXME: it may be easy to remove this, since it affects only one file:
202   # the snprintf call at ftoastr.c:132.
203   nw="$nw -Wdouble-promotion"
205   # FIXME: remove this line when gcc improves
206   # FP in careadlinkat.c w/gcc 10.0.1 20200205
207   gl_WARN_ADD([-Wno-return-local-addr])
209   gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
210   AC_SUBST([GNULIB_WARN_CFLAGS])
212   # For gnulib-tests, the set is slightly smaller still.
213   nw=
214   nw="$nw -Wstrict-prototypes"
215   # It's not worth being this picky about test programs.
216   nw="$nw -Wsuggest-attribute=const"
217   nw="$nw -Wsuggest-attribute=pure"
218   gl_MANYWARN_COMPLEMENT([GNULIB_TEST_WARN_CFLAGS],
219                          [$GNULIB_WARN_CFLAGS], [$nw])
220   AC_SUBST([GNULIB_TEST_WARN_CFLAGS])
223 AC_ARG_ENABLE([single-binary],
224   [AS_HELP_STRING([--enable-single-binary=[shebangs|symlinks]],
225      [Compile all the tools in a single binary, reducing the overall size.
226       When compiled this way, shebangs (default when enabled) or symlinks are
227       installed for each tool that points to the single binary.])],
228   [gl_single_binary=no ;
229    case $enableval in
230      yes) gl_single_binary=shebangs ;;
231      no|shebangs|symlinks) gl_single_binary=$enableval ;;
232      *)      AC_MSG_ERROR([bad value $enableval for single-binary option.
233                            Options are: symlinks, shebangs, no.]) ;;
234    esac],
235   [gl_single_binary=no]
237 AC_ARG_ENABLE([single-binary-exceptions],
238   [AS_HELP_STRING([--enable-single-binary-exceptions=PROG_LIST],
239      [When used with --enable-single-binary, exclude the PROG_LIST from
240       it, so these programs are compiled as separated files
241       (comma-separated, default none))])],
242   [gl_single_binary_exceptions=$enableval],
243   [gl_single_binary_exceptions=]
245 if test "$gl_single_binary" = 'symlinks'; then
246   if ! test "`echo ls | sed \"$program_transform_name\"`" = 'ls'; then
247     AC_MSG_ERROR([program name transformations are not currently supported
248                   with --enable-single-binary=symlinks.])
249   fi
251 AM_CONDITIONAL([SINGLE_BINARY], [test "$gl_single_binary" != no])
253 AC_FUNC_FORK
255 optional_bin_progs=
256 AC_CHECK_FUNCS([chroot],
257         gl_ADD_PROG([optional_bin_progs], [chroot]))
258 AC_CHECK_FUNCS([gethostid],
259         gl_ADD_PROG([optional_bin_progs], [hostid]))
260 AC_CHECK_FUNCS([sigsuspend],
261         gl_ADD_PROG([optional_bin_progs], [timeout]))
263 gl_WINSIZE_IN_PTEM
265 AC_MSG_CHECKING([whether localtime caches TZ])
266 AC_CACHE_VAL([utils_cv_localtime_cache],
267 [if test x$ac_cv_func_tzset = xyes; then
268 AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <time.h>
269 #if STDC_HEADERS
270 # include <stdlib.h>
271 #endif
272 extern char **environ;
273 void unset_TZ (void)
275   char **from, **to;
276   for (to = from = environ; (*to = *from); from++)
277     if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
278       to++;
280 int main()
282   time_t now = time ((time_t *) 0);
283   int hour_GMT0, hour_unset;
284   if (putenv ("TZ=GMT0") != 0)
285     return 1;
286   hour_GMT0 = localtime (&now)->tm_hour;
287   unset_TZ ();
288   hour_unset = localtime (&now)->tm_hour;
289   if (putenv ("TZ=PST8") != 0)
290     return 1;
291   if (localtime (&now)->tm_hour == hour_GMT0)
292     return 1;
293   unset_TZ ();
294   if (localtime (&now)->tm_hour != hour_unset)
295     return 1;
296   return 0;
297 }]])],
298 [utils_cv_localtime_cache=no],
299 [utils_cv_localtime_cache=yes],
300 [# If we have tzset, assume the worst when cross-compiling.
301 utils_cv_localtime_cache=yes])
302 else
303         # If we lack tzset, report that localtime does not cache TZ,
304         # since we can't invalidate the cache if we don't have tzset.
305         utils_cv_localtime_cache=no
306 fi])dnl
307 AC_MSG_RESULT([$utils_cv_localtime_cache])
308 if test $utils_cv_localtime_cache = yes; then
309   AC_DEFINE([LOCALTIME_CACHE], [1], [FIXME])
312 # Assume that if getattrat exists, it's compatible with Solaris 11.
313 AC_CHECK_FUNCS([getattrat])
314 if test $ac_cv_func_getattrat = yes; then
315   LIB_NVPAIR=-lnvpair
316   AC_SUBST([LIB_NVPAIR])
319 # glibc >= 2.28 and linux kernel >= 4.11
320 AC_CHECK_FUNCS([statx])
322 # SCO-ODT-3.0 is reported to need -los to link programs using initgroups
323 AC_CHECK_FUNCS([initgroups])
324 if test $ac_cv_func_initgroups = no; then
325   AC_CHECK_LIB([os], [initgroups])
328 AC_CHECK_FUNCS([syslog])
329 if test $ac_cv_func_syslog = no; then
330   # syslog is not in the default libraries.  See if it's in some other.
331   for lib in bsd socket inet; do
332     AC_CHECK_LIB([$lib], [syslog], [AC_DEFINE([HAVE_SYSLOG], [1], [FIXME])
333       LIBS="$LIBS -l$lib"; break])
334   done
337 AC_CACHE_CHECK([for 3-argument setpriority function],
338   [utils_cv_func_setpriority],
339   [AC_LINK_IFELSE(
340     [AC_LANG_PROGRAM(
341        [[#include <sys/time.h>
342          #include <sys/resource.h>
343        ]],
344        [[setpriority (0, 0, 0);]])],
345     [utils_cv_func_setpriority=yes],
346     [utils_cv_func_setpriority=no])])
347 if test $utils_cv_func_setpriority = no; then
348   AC_CHECK_FUNCS([nice])
350 case $utils_cv_func_setpriority,$ac_cv_func_nice in
351 *yes*)
352   gl_ADD_PROG([optional_bin_progs], [nice])
353 esac
355 if test "$cross_compiling" = yes || test -c /dev/stdin <.; then
356   AC_DEFINE([DEV_FD_MIGHT_BE_CHR], [1],
357     [Define to 1 if /dev/std{in,out,err} and /dev/fd/N, if they exist, might be
358      character-special devices whose minor device number is the file
359      descriptor number, such as on Solaris.  Leave undefined if they are
360      definitely the actual files.  This determination should be done after any
361      symbolic links are followed.])
364 AC_DEFUN([coreutils_DUMMY_1],
366   AC_REQUIRE([gl_READUTMP])
367   if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then
368     gl_ADD_PROG([optional_bin_progs], [who])
369     gl_ADD_PROG([optional_bin_progs], [users])
370     gl_ADD_PROG([optional_bin_progs], [pinky])
371   fi
373 coreutils_DUMMY_1
375 AC_MSG_CHECKING([ut_host in struct utmp])
376 AC_CACHE_VAL([su_cv_func_ut_host_in_utmp],
377 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
378                                    #include <utmp.h>
379                                    struct utmp ut;
380                                    int s = sizeof ut.ut_host;]])],
381   [su_cv_func_ut_host_in_utmp=yes],
382   [su_cv_func_ut_host_in_utmp=no])])
383 AC_MSG_RESULT([$su_cv_func_ut_host_in_utmp])
384 if test $su_cv_func_ut_host_in_utmp = yes; then
385   have_ut_host=1
386   AC_DEFINE([HAVE_UT_HOST], [1], [FIXME])
389 if test -z "$have_ut_host"; then
390   AC_MSG_CHECKING([ut_host in struct utmpx])
391   AC_CACHE_VAL([su_cv_func_ut_host_in_utmpx],
392   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
393                                      #include <utmpx.h>
394                                      struct utmpx ut;
395                                      int s = sizeof ut.ut_host;]])],
396     [su_cv_func_ut_host_in_utmpx=yes],
397     [su_cv_func_ut_host_in_utmpx=no])])
398   AC_MSG_RESULT([$su_cv_func_ut_host_in_utmpx])
399   if test $su_cv_func_ut_host_in_utmpx = yes; then
400     AC_DEFINE([HAVE_UTMPX_H], [1], [FIXME])
401     AC_DEFINE([HAVE_UT_HOST], [1], [FIXME])
402   fi
405 GNULIB_BOOT_TIME([gl_ADD_PROG([optional_bin_progs], [uptime])])
407 AC_SYS_POSIX_TERMIOS()
408 gl_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL
410 if test $ac_cv_sys_posix_termios = yes; then
411   gl_ADD_PROG([optional_bin_progs], [stty])
413   AC_MSG_CHECKING([whether termios.h needs _XOPEN_SOURCE])
414   AC_CACHE_VAL([su_cv_sys_termios_needs_xopen_source],
415   [AC_EGREP_CPP([yes], [#include <termios.h>
416 #ifdef IUCLC
418 #endif], su_cv_sys_termios_needs_xopen_source=no,
419    AC_EGREP_CPP([yes], [#define _XOPEN_SOURCE
420 #include <termios.h>
421 #ifdef IUCLC
423 #endif], su_cv_sys_termios_needs_xopen_source=yes,
424    su_cv_sys_termios_needs_xopen_source=no))])
425   AC_MSG_RESULT([$su_cv_sys_termios_needs_xopen_source])
426   test $su_cv_sys_termios_needs_xopen_source = yes &&
427     AC_DEFINE([TERMIOS_NEEDS_XOPEN_SOURCE], [1], [FIXME])
429   AC_MSG_CHECKING([c_line in struct termios])
430   AC_CACHE_VAL([su_cv_sys_c_line_in_termios],
431   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if TERMIOS_NEEDS_XOPEN_SOURCE
432                                       #define _XOPEN_SOURCE
433                                      #endif
434                                      #include <sys/types.h>
435                                      #include <termios.h>
436                                      struct termios t;
437                                      int s = sizeof t.c_line;]])],
438     [su_cv_sys_c_line_in_termios=yes],
439     [su_cv_sys_c_line_in_termios=no])])
440   AC_MSG_RESULT([$su_cv_sys_c_line_in_termios])
441   test $su_cv_sys_c_line_in_termios = yes \
442     && AC_DEFINE([HAVE_C_LINE], [1], [FIXME])
445 # FIXME: note that this macro appears above, too.
446 # I'm leaving it here for now.  This whole thing needs to be modernized...
447 gl_WINSIZE_IN_PTEM
449 gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H
451 if test $gl_cv_sys_tiocgwinsz_needs_termios_h = no && \
452    test $gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h = no; then
453   AC_MSG_CHECKING([TIOCGWINSZ in sys/pty.h])
454   AC_CACHE_VAL([su_cv_sys_tiocgwinsz_in_sys_pty_h],
455   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
456 #ifdef WINSIZE_IN_PTEM
457 # include <sys/stream.h>
458 # include <sys/ptem.h>
459 #endif
460 #include <sys/ioctl.h>
461 #include <sys/tty.h>
462 #include <sys/pty.h>]], [[int x = TIOCGWINSZ;]])],
463     [su_cv_sys_tiocgwinsz_in_sys_pty_h=yes],
464     [su_cv_sys_tiocgwinsz_in_sys_pty_h=no])])
465   AC_MSG_RESULT([$su_cv_sys_tiocgwinsz_in_sys_pty_h])
467   test $su_cv_sys_tiocgwinsz_in_sys_pty_h = yes \
468       && AC_DEFINE([GWINSZ_IN_SYS_PTY], [1],
469                    [Define if your system defines TIOCGWINSZ in sys/pty.h.])
472 # For src/kill.c.
473 AC_CHECK_DECLS([strsignal, sys_siglist, _sys_siglist, __sys_siglist], , ,
474   [AC_INCLUDES_DEFAULT
475 #include <signal.h>])
477 cu_GMP
479 # Build df only if there's a point to it.
480 if test $gl_cv_list_mounted_fs = yes && test $gl_cv_fs_space = yes; then
481   gl_ADD_PROG([optional_bin_progs], [df])
484 # Build stdbuf only if supported
485 ac_save_CFLAGS=$CFLAGS
486 ac_save_LDFLAGS=$LDFLAGS
487 cu_save_c_werror_flag=$ac_c_werror_flag
488 AC_LANG_WERROR
489 # Detect warnings about ignored "constructor" attributes.
490 gl_WARN_ADD([-Werror], [CFLAGS])
491 gl_WARN_ADD([-errwarn], [CFLAGS])
492 # Put this message here, after gl_WARN_ADD's chatter.
493 AC_MSG_CHECKING([whether this system supports stdbuf])
494 CFLAGS="-fPIC $CFLAGS"
495 LDFLAGS="-shared $LDFLAGS"
496 stdbuf_supported=no
497 # Note we only LINK here rather than RUN to support cross compilation
498 AC_LINK_IFELSE(
499   [AC_LANG_PROGRAM([[
500     static int stdbuf = 0;
502     void __attribute__ ((constructor))
503     stdbuf_init (void)
504     {
505       stdbuf = 1;
506     }]],[[
507     if (stdbuf != 1)
508       return 1;]])
509   ],
510   [stdbuf_supported=yes])
511 AC_MSG_RESULT([$stdbuf_supported])
512 if test "$stdbuf_supported" = "yes" && test -z "$EXEEXT"; then
513   gl_ADD_PROG([optional_bin_progs], [stdbuf])
515 CFLAGS=$ac_save_CFLAGS
516 LDFLAGS=$ac_save_LDFLAGS
517 ac_c_werror_flag=$cu_save_c_werror_flag
519 ############################################################################
521 dnl Autogenerated by the 'gen-lists-of-programs.sh' auxiliary script.
522 dnl Issue proper calls to the macros gl_INCLUDE_EXCLUDE_PROG and
523 dnl gl_ADD_PROG (updating $optional_bin_progs), and generate the list
524 dnl of coreutils programs to be built only upon explicit user request,
525 dnl saving that list in the $no_install_progs_default shell variable.
526 m4_include([m4/cu-progs.m4])
528 # Now that we know which programs will actually be built, determine
529 # which optional helper progs should be compiled.
530 # Note it adding to pkglibexec_PROGRAMS, $(transform) in src/local.mk
531 # may need to be updated accordingly.
532 case " $optional_bin_progs " in
533   *' stdbuf '*) pkglibexec_PROGRAMS='src/libstdbuf.so';;
534   *) pkglibexec_PROGRAMS='';;
535 esac
537 man1_MANS=`
538   for p in $optional_bin_progs; do
539     # Change "ginstall.1" to "install.1".
540     test $p = ginstall && p=install
541     # Ignore the "[" program, since writing a portable make rule to
542     # generate its manpage is not practical.
543     dnl Use the autoconf-provided quadrigraph to represent "[",
544     dnl otherwise we will incur in dreadful quoting issues.
545     test x$p = x'@<:@' && continue
546     echo "man/$p.1"
547   done`
549 # Not installed by "make install", but must be built when creating
550 # a distribution tarball.
551 EXTRA_MANS=`for p in $no_install_progs_default $gl_no_install_prog; do
552               echo man/$p.1
553             done`
555 # Replace all the programs by the single binary and symlinks if specified.
556 single_binary_progs=
557 single_binary_libs=
558 single_binary_deps=
559 single_binary_install_type=
560 if test "$gl_single_binary" != no; then
561   man1_MANS="$man1_MANS man/coreutils.1"
562   # Convert the list to a space separated list
563   gl_single_binary_exceptions=`echo $gl_single_binary_exceptions | tr ',' ' '`
565   single_binary_progs=`echo $optional_bin_progs`
566   optional_bin_progs="coreutils"
567   for prog in $gl_single_binary_exceptions; do
568     # Fail if requested to exclude a program than was not part of coreutils.
569     case " $single_binary_progs " in
570       *" $prog "*)
571         gl_REMOVE_PROG([single_binary_progs], [$prog]) ;
572         gl_ADD_PROG([optional_bin_progs], [$prog]) ;;
573       *) AC_MSG_ERROR(['$prog' is not being compiled.]) ;;
574     esac
575   done
577   # single_binary_libs holds the list of libs required by the selected
578   # programs, such as for example -lrt.
579   single_binary_libs=`
580     for p in $single_binary_progs; do
581       # Convert '[' to '_'
582       test x"$p" = x'@<:@' && p='_'
583       printf '$(src_libsinglebin_%s_a_ldadd) ' "$p"
584     done`
585   # single_binary_deps holds the list of libsinglebin_*.a files that have the
586   # compiled code of each selected program in a "library" format.
587   single_binary_deps=`
588     for p in $single_binary_progs; do
589       # Convert '[' to '_'
590       test x"$p" = x'@<:@' && p='_'
591       printf 'src/libsinglebin_%s.a ' "$p"
592     done`
593   single_binary_install_type="$gl_single_binary"
595 AC_SUBST([single_binary_progs], [$single_binary_progs])
596 AC_SUBST([single_binary_libs], [$single_binary_libs])
597 AC_SUBST([single_binary_deps], [$single_binary_deps])
598 AC_SUBST([single_binary_install_type], [$single_binary_install_type])
601 # The programs built and installed by "make && make install".
602 # Since this is AC_SUBST'd, Automake won't be able to perform rewrite
603 # with $(EXEEXT) appending on it, so we have to do it ourselves -- in
604 # this case, only for $(bin_PROGRAMS).
605 bin_PROGRAMS=`
606   for p in $optional_bin_progs; do echo src/"$p"'$(EXEEXT)'; done`
608 # Normalize whitespace.
609 man1_MANS=`echo $man1_MANS`
610 EXTRA_MANS=`echo $EXTRA_MANS`
611 bin_PROGRAMS=`echo $bin_PROGRAMS`
612 pkglibexec_PROGS=`echo $pkglibexec_PROGRAMS`
614 AC_SUBST([bin_PROGRAMS])        AM_SUBST_NOTMAKE([bin_PROGRAMS])
615 AC_SUBST([pkglibexec_PROGRAMS]) AM_SUBST_NOTMAKE([pkglibexec_PROGRAMS])
616 AC_SUBST([man1_MANS])           AM_SUBST_NOTMAKE([man1_MANS])
617 AC_SUBST([EXTRA_MANS])          AM_SUBST_NOTMAKE([EXTRA_MANS])
619 AC_SUBST([built_programs], [$optional_bin_progs])
621 AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
623 ############################################################################
625 # As long as "grep 'PRI[diouxX]' po/*.pot" reports matches in
626 # translatable strings, we must use need-formatstring-macros here.
627 AM_GNU_GETTEXT([external], [need-formatstring-macros])
628 AM_GNU_GETTEXT_VERSION([0.19.2])
630 # For a test of uniq: it uses the $LOCALE_FR envvar.
631 gt_LOCALE_FR
633 AC_CONFIG_FILES(
634   Makefile
635   po/Makefile.in
636   gnulib-tests/Makefile
637   )
638 AC_OUTPUT