build: ensure sys/select.h is included
[coreutils.git] / configure.ac
blob23086cd640594c6022fcfe0e3ba6fe9401c1b899
1 # -*- autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 # Copyright (C) 1991-2019 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 no-dist-gzip dist-xz color-tests parallel-tests
39                   subdir-objects])
40 AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
42 dnl POSIXCHECK is worthwhile for maintainers, but adds several seconds
43 dnl (more than 10% execution time) to ./configure, with no benefit for
44 dnl most users.  Using it to look for bugs requires:
45 dnl   GNULIB_POSIXCHECK=1 autoreconf -f
46 dnl   ./configure
47 dnl   make
48 dnl   make -C src clean
49 dnl   make CFLAGS=-DGNULIB_POSIXCHECK=1
50 dnl FIXME: Once we figure out how to avoid false positives, we should
51 dnl have 'make my-distcheck' in dist-check.mk exercise this.
52 m4_syscmd([test "${GNULIB_POSIXCHECK+set}" = set])
53 m4_if(m4_sysval, [0], [], [dnl
54 gl_ASSERT_NO_GNULIB_POSIXCHECK])
56 AC_PROG_CC_STDC
57 AM_PROG_CC_C_O
58 AC_PROG_CPP
59 AC_PROG_GCC_TRADITIONAL
60 AC_PROG_RANLIB
61 AC_PROG_LN_S
62 gl_EARLY
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 -Wlogical-op"             # Too many warnings until GCC 4.8.0
132   nw="$nw -Wformat-nonliteral"      # who.c and pinky.c strftime uses
133   nw="$nw -Wnested-externs"         # use of XARGMATCH/verify_function__
134   nw="$nw -Wswitch-enum"            # Too many warnings for now
135   nw="$nw -Wswitch-default"         # Too many warnings for now
136   nw="$nw -Wstack-protector"        # not worth working around
137   nw="$nw -Wtype-limits"            # False alarms for portable code
138   nw="$nw -Wformat-overflow=2"      # False alarms due to GCC bug 80776
139   nw="$nw -Wformat-truncation=2"    # False alarm in ls.c, probably related
140   # things I might fix soon:
141   nw="$nw -Wfloat-equal"            # sort.c, seq.c
142   nw="$nw -Wmissing-format-attribute" # copy.c
143   nw="$nw -Wunsafe-loop-optimizations" # a few src/*.c
144   nw="$nw -Winline"                 # system.h's readdir_ignoring_dot_and_dotdot
145   nw="$nw -Wsuggest-attribute=format" # warns about copy.c and factor.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-type-limits])      # False alarms for portable code
159   gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
160   gl_WARN_ADD([-Wno-format-nonliteral])
162   # Enable this warning only with gcc-4.8 and newer.  Before that
163   # bounds checking as done in truncate.c was incorrectly flagged.
164   # See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43772
165   gl_GCC_VERSION_IFELSE([4], [8], [gl_WARN_ADD([-Wlogical-op])])
167   # clang is unduly picky about some things.
168   AC_CACHE_CHECK([whether the compiler is clang], [utils_cv_clang],
169     [AC_COMPILE_IFELSE(
170        [AC_LANG_PROGRAM([[
171             #ifndef __clang__
172               #error "not clang"
173             #endif
174           ]])],
175        [utils_cv_clang=yes],
176        [utils_cv_clang=no])])
177   if test $utils_cv_clang = yes; then
178     gl_WARN_ADD([-Wno-format-extra-args])
179     gl_WARN_ADD([-Wno-tautological-constant-out-of-range-compare])
180   fi
182   gl_WARN_ADD([-fdiagnostics-show-option])
183   gl_WARN_ADD([-funit-at-a-time])
185   AC_SUBST([WARN_CFLAGS])
187   AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
188   AH_VERBATIM([FORTIFY_SOURCE],
189   [/* Enable compile-time and run-time bounds-checking, and some warnings,
190       without upsetting glibc 2.15+. */
191    #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
192    # define _FORTIFY_SOURCE 2
193    #endif
194   ])
195   AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
197   # We use a slightly smaller set of warning options for lib/.
198   # Remove the following and save the result in GNULIB_WARN_CFLAGS.
199   nw=
200   nw="$nw -Wduplicated-branches"    # Too many false alarms
201   nw="$nw -Wformat-truncation=2"
202   nw="$nw -Wstrict-overflow"
203   nw="$nw -Wuninitialized"
204   nw="$nw -Wunused-macros"
205   nw="$nw -Wmissing-prototypes"
206   nw="$nw -Wold-style-definition"
207   # FIXME: it may be easy to remove this, since it affects only one file:
208   # the snprintf call at ftoastr.c:132.
209   nw="$nw -Wdouble-promotion"
210   gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
211   AC_SUBST([GNULIB_WARN_CFLAGS])
213   # For gnulib-tests, the set is slightly smaller still.
214   nw=
215   nw="$nw -Wstrict-prototypes"
216   # It's not worth being this picky about test programs.
217   nw="$nw -Wsuggest-attribute=const"
218   nw="$nw -Wsuggest-attribute=pure"
219   gl_MANYWARN_COMPLEMENT([GNULIB_TEST_WARN_CFLAGS],
220                          [$GNULIB_WARN_CFLAGS], [$nw])
221   AC_SUBST([GNULIB_TEST_WARN_CFLAGS])
224 AC_ARG_ENABLE([single-binary],
225   [AS_HELP_STRING([--enable-single-binary=[shebangs|symlinks]],
226      [Compile all the tools in a single binary, reducing the overall size.
227       When compiled this way, shebangs (default when enabled) or symlinks are
228       installed for each tool that points to the single binary.])],
229   [gl_single_binary=no ;
230    case $enableval in
231      yes) gl_single_binary=shebangs ;;
232      no|shebangs|symlinks) gl_single_binary=$enableval ;;
233      *)      AC_MSG_ERROR([bad value $enableval for single-binary option.
234                            Options are: symlinks, shebangs, no.]) ;;
235    esac],
236   [gl_single_binary=no]
238 AC_ARG_ENABLE([single-binary-exceptions],
239   [AS_HELP_STRING([--enable-single-binary-exceptions=PROG_LIST],
240      [When used with --enable-single-binary, exclude the PROG_LIST from
241       it, so these programs are compiled as separated files
242       (comma-separated, default none))])],
243   [gl_single_binary_exceptions=$enableval],
244   [gl_single_binary_exceptions=]
246 if test "$gl_single_binary" = 'symlinks'; then
247   if ! test "`echo ls | sed \"$program_transform_name\"`" = 'ls'; then
248     AC_MSG_ERROR([program name transformations are not currently supported
249                   with --enable-single-binary=symlinks.])
250   fi
252 AM_CONDITIONAL([SINGLE_BINARY], [test "$gl_single_binary" != no])
254 AC_FUNC_FORK
256 optional_bin_progs=
257 AC_CHECK_FUNCS([chroot],
258         gl_ADD_PROG([optional_bin_progs], [chroot]))
259 AC_CHECK_FUNCS([gethostid],
260         gl_ADD_PROG([optional_bin_progs], [hostid]))
261 AC_CHECK_FUNCS([sigsuspend],
262         gl_ADD_PROG([optional_bin_progs], [timeout]))
264 gl_WINSIZE_IN_PTEM
266 AC_MSG_CHECKING([whether localtime caches TZ])
267 AC_CACHE_VAL([utils_cv_localtime_cache],
268 [if test x$ac_cv_func_tzset = xyes; then
269 AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <time.h>
270 #if STDC_HEADERS
271 # include <stdlib.h>
272 #endif
273 extern char **environ;
274 void unset_TZ (void)
276   char **from, **to;
277   for (to = from = environ; (*to = *from); from++)
278     if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
279       to++;
281 int main()
283   time_t now = time ((time_t *) 0);
284   int hour_GMT0, hour_unset;
285   if (putenv ("TZ=GMT0") != 0)
286     return 1;
287   hour_GMT0 = localtime (&now)->tm_hour;
288   unset_TZ ();
289   hour_unset = localtime (&now)->tm_hour;
290   if (putenv ("TZ=PST8") != 0)
291     return 1;
292   if (localtime (&now)->tm_hour == hour_GMT0)
293     return 1;
294   unset_TZ ();
295   if (localtime (&now)->tm_hour != hour_unset)
296     return 1;
297   return 0;
298 }]])],
299 [utils_cv_localtime_cache=no],
300 [utils_cv_localtime_cache=yes],
301 [# If we have tzset, assume the worst when cross-compiling.
302 utils_cv_localtime_cache=yes])
303 else
304         # If we lack tzset, report that localtime does not cache TZ,
305         # since we can't invalidate the cache if we don't have tzset.
306         utils_cv_localtime_cache=no
307 fi])dnl
308 AC_MSG_RESULT([$utils_cv_localtime_cache])
309 if test $utils_cv_localtime_cache = yes; then
310   AC_DEFINE([LOCALTIME_CACHE], [1], [FIXME])
313 # Assume that if getattrat exists, it's compatible with Solaris 11.
314 AC_CHECK_FUNCS([getattrat])
315 if test $ac_cv_func_getattrat = yes; then
316   LIB_NVPAIR=-lnvpair
317   AC_SUBST([LIB_NVPAIR])
320 # SCO-ODT-3.0 is reported to need -los to link programs using initgroups
321 AC_CHECK_FUNCS([initgroups])
322 if test $ac_cv_func_initgroups = no; then
323   AC_CHECK_LIB([os], [initgroups])
326 AC_CHECK_FUNCS([syslog])
327 if test $ac_cv_func_syslog = no; then
328   # syslog is not in the default libraries.  See if it's in some other.
329   for lib in bsd socket inet; do
330     AC_CHECK_LIB([$lib], [syslog], [AC_DEFINE([HAVE_SYSLOG], [1], [FIXME])
331       LIBS="$LIBS -l$lib"; break])
332   done
335 AC_CACHE_CHECK([for 3-argument setpriority function],
336   [utils_cv_func_setpriority],
337   [AC_LINK_IFELSE(
338     [AC_LANG_PROGRAM(
339        [[#include <sys/time.h>
340          #include <sys/resource.h>
341        ]],
342        [[setpriority (0, 0, 0);]])],
343     [utils_cv_func_setpriority=yes],
344     [utils_cv_func_setpriority=no])])
345 if test $utils_cv_func_setpriority = no; then
346   AC_CHECK_FUNCS([nice])
348 case $utils_cv_func_setpriority,$ac_cv_func_nice in
349 *yes*)
350   gl_ADD_PROG([optional_bin_progs], [nice])
351 esac
353 AC_DEFUN([coreutils_DUMMY_1],
355   AC_REQUIRE([gl_READUTMP])
356   if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then
357     gl_ADD_PROG([optional_bin_progs], [who])
358     gl_ADD_PROG([optional_bin_progs], [users])
359     gl_ADD_PROG([optional_bin_progs], [pinky])
360   fi
362 coreutils_DUMMY_1
364 AC_MSG_CHECKING([ut_host in struct utmp])
365 AC_CACHE_VAL([su_cv_func_ut_host_in_utmp],
366 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
367                                    #include <utmp.h>
368                                    struct utmp ut;
369                                    int s = sizeof ut.ut_host;]])],
370   [su_cv_func_ut_host_in_utmp=yes],
371   [su_cv_func_ut_host_in_utmp=no])])
372 AC_MSG_RESULT([$su_cv_func_ut_host_in_utmp])
373 if test $su_cv_func_ut_host_in_utmp = yes; then
374   have_ut_host=1
375   AC_DEFINE([HAVE_UT_HOST], [1], [FIXME])
378 if test -z "$have_ut_host"; then
379   AC_MSG_CHECKING([ut_host in struct utmpx])
380   AC_CACHE_VAL([su_cv_func_ut_host_in_utmpx],
381   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
382                                      #include <utmpx.h>
383                                      struct utmpx ut;
384                                      int s = sizeof ut.ut_host;]])],
385     [su_cv_func_ut_host_in_utmpx=yes],
386     [su_cv_func_ut_host_in_utmpx=no])])
387   AC_MSG_RESULT([$su_cv_func_ut_host_in_utmpx])
388   if test $su_cv_func_ut_host_in_utmpx = yes; then
389     AC_DEFINE([HAVE_UTMPX_H], [1], [FIXME])
390     AC_DEFINE([HAVE_UT_HOST], [1], [FIXME])
391   fi
394 GNULIB_BOOT_TIME([gl_ADD_PROG([optional_bin_progs], [uptime])])
396 AC_SYS_POSIX_TERMIOS()
397 gl_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL
399 if test $ac_cv_sys_posix_termios = yes; then
400   gl_ADD_PROG([optional_bin_progs], [stty])
402   AC_MSG_CHECKING([whether termios.h needs _XOPEN_SOURCE])
403   AC_CACHE_VAL([su_cv_sys_termios_needs_xopen_source],
404   [AC_EGREP_CPP([yes], [#include <termios.h>
405 #ifdef IUCLC
407 #endif], su_cv_sys_termios_needs_xopen_source=no,
408    AC_EGREP_CPP([yes], [#define _XOPEN_SOURCE
409 #include <termios.h>
410 #ifdef IUCLC
412 #endif], su_cv_sys_termios_needs_xopen_source=yes,
413    su_cv_sys_termios_needs_xopen_source=no))])
414   AC_MSG_RESULT([$su_cv_sys_termios_needs_xopen_source])
415   test $su_cv_sys_termios_needs_xopen_source = yes &&
416     AC_DEFINE([TERMIOS_NEEDS_XOPEN_SOURCE], [1], [FIXME])
418   AC_MSG_CHECKING([c_line in struct termios])
419   AC_CACHE_VAL([su_cv_sys_c_line_in_termios],
420   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if TERMIOS_NEEDS_XOPEN_SOURCE
421                                       #define _XOPEN_SOURCE
422                                      #endif
423                                      #include <sys/types.h>
424                                      #include <termios.h>
425                                      struct termios t;
426                                      int s = sizeof t.c_line;]])],
427     [su_cv_sys_c_line_in_termios=yes],
428     [su_cv_sys_c_line_in_termios=no])])
429   AC_MSG_RESULT([$su_cv_sys_c_line_in_termios])
430   test $su_cv_sys_c_line_in_termios = yes \
431     && AC_DEFINE([HAVE_C_LINE], [1], [FIXME])
434 # FIXME: note that this macro appears above, too.
435 # I'm leaving it here for now.  This whole thing needs to be modernized...
436 gl_WINSIZE_IN_PTEM
438 gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H
440 if test $gl_cv_sys_tiocgwinsz_needs_termios_h = no && \
441    test $gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h = no; then
442   AC_MSG_CHECKING([TIOCGWINSZ in sys/pty.h])
443   AC_CACHE_VAL([su_cv_sys_tiocgwinsz_in_sys_pty_h],
444   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
445 #ifdef WINSIZE_IN_PTEM
446 # include <sys/stream.h>
447 # include <sys/ptem.h>
448 #endif
449 #include <sys/ioctl.h>
450 #include <sys/tty.h>
451 #include <sys/pty.h>]], [[int x = TIOCGWINSZ;]])],
452     [su_cv_sys_tiocgwinsz_in_sys_pty_h=yes],
453     [su_cv_sys_tiocgwinsz_in_sys_pty_h=no])])
454   AC_MSG_RESULT([$su_cv_sys_tiocgwinsz_in_sys_pty_h])
456   test $su_cv_sys_tiocgwinsz_in_sys_pty_h = yes \
457       && AC_DEFINE([GWINSZ_IN_SYS_PTY], [1],
458                    [Define if your system defines TIOCGWINSZ in sys/pty.h.])
461 # For src/kill.c.
462 AC_CHECK_DECLS([strsignal, sys_siglist, _sys_siglist, __sys_siglist], , ,
463   [AC_INCLUDES_DEFAULT
464 #include <signal.h>])
466 cu_GMP
468 # Build df only if there's a point to it.
469 if test $gl_cv_list_mounted_fs = yes && test $gl_cv_fs_space = yes; then
470   gl_ADD_PROG([optional_bin_progs], [df])
473 # Build stdbuf only if supported
474 ac_save_CFLAGS=$CFLAGS
475 ac_save_LDFLAGS=$LDFLAGS
476 # Detect warnings about ignored "constructor" attributes.
477 gl_WARN_ADD([-Werror], [CFLAGS])
478 gl_WARN_ADD([-errwarn], [CFLAGS])
479 # Put this message here, after gl_WARN_ADD's chatter.
480 AC_MSG_CHECKING([whether this system supports stdbuf])
481 CFLAGS="-fPIC $CFLAGS"
482 LDFLAGS="-shared $LDFLAGS"
483 stdbuf_supported=no
484 # Note we only LINK here rather than RUN to support cross compilation
485 AC_LINK_IFELSE(
486   [AC_LANG_PROGRAM([[
487     static int stdbuf = 0;
489     void __attribute__ ((constructor))
490     stdbuf_init (void)
491     {
492       stdbuf = 1;
493     }]],[[
494     if (stdbuf != 1)
495       return 1;]])
496   ],
497   [stdbuf_supported=yes])
498 AC_MSG_RESULT([$stdbuf_supported])
499 if test "$stdbuf_supported" = "yes" && test -z "$EXEEXT"; then
500   gl_ADD_PROG([optional_bin_progs], [stdbuf])
502 CFLAGS=$ac_save_CFLAGS
503 LDFLAGS=$ac_save_LDFLAGS
505 # Detect when using xlc to determine whether to use -qinclude=
506 AC_CACHE_CHECK([whether the system supports xlc include], [utils_cv_xlc],
507   [AC_COMPILE_IFELSE(
508      [AC_LANG_PROGRAM([[
509           #ifndef __xlc__
510             #error "not xlc"
511           #endif
512         ]])],
513      [utils_cv_xlc=yes],
514      [utils_cv_xlc=no])])
515 AM_CONDITIONAL([USE_XLC_INCLUDE], [test "$utils_cv_xlc" = yes])
517 ############################################################################
519 dnl Autogenerated by the 'gen-lists-of-programs.sh' auxiliary script.
520 dnl Issue proper calls to the macros gl_INCLUDE_EXCLUDE_PROG and
521 dnl gl_ADD_PROG (updating $optional_bin_progs), and generate the list
522 dnl of coreutils programs to be built only upon explicit user request,
523 dnl saving that list in the $no_install_progs_default shell variable.
524 m4_include([m4/cu-progs.m4])
526 # Now that we know which programs will actually be built, determine
527 # which optional helper progs should be compiled.
528 # Note it adding to pkglibexec_PROGRAMS, $(transform) in src/local.mk
529 # may need to be updated accordingly.
530 case " $optional_bin_progs " in
531   *' stdbuf '*) pkglibexec_PROGRAMS='src/libstdbuf.so';;
532   *) pkglibexec_PROGRAMS='';;
533 esac
535 man1_MANS=`
536   for p in $optional_bin_progs; do
537     # Change "ginstall.1" to "install.1".
538     test $p = ginstall && p=install
539     # Ignore the "[" program, since writing a portable make rule to
540     # generate its manpage is not practical.
541     dnl Use the autoconf-provided quadrigraph to represent "[",
542     dnl otherwise we will incur in dreadful quoting issues.
543     test x$p = x'@<:@' && continue
544     echo "man/$p.1"
545   done`
547 # Not installed by "make install", but must be built when creating
548 # a distribution tarball.
549 EXTRA_MANS=`for p in $no_install_progs_default $gl_no_install_prog; do
550               echo man/$p.1
551             done`
553 # Replace all the programs by the single binary and symlinks if specified.
554 single_binary_progs=
555 single_binary_libs=
556 single_binary_deps=
557 single_binary_install_type=
558 if test "$gl_single_binary" != no; then
559   man1_MANS="$man1_MANS man/coreutils.1"
560   # Convert the list to a space separated list
561   gl_single_binary_exceptions=`echo $gl_single_binary_exceptions | tr ',' ' '`
563   single_binary_progs=`echo $optional_bin_progs`
564   optional_bin_progs="coreutils"
565   for prog in $gl_single_binary_exceptions; do
566     # Fail if requested to exclude a program than was not part of coreutils.
567     case " $single_binary_progs " in
568       *" $prog "*)
569         gl_REMOVE_PROG([single_binary_progs], [$prog]) ;
570         gl_ADD_PROG([optional_bin_progs], [$prog]) ;;
571       *) AC_MSG_ERROR(['$prog' is not being compiled.]) ;;
572     esac
573   done
575   # single_binary_libs holds the list of libs required by the selected
576   # programs, such as for example -lrt.
577   single_binary_libs=`
578     for p in $single_binary_progs; do
579       # Convert '[' to '_'
580       test x"$p" = x'@<:@' && p='_'
581       printf '$(src_libsinglebin_%s_a_ldadd) ' "$p"
582     done`
583   # single_binary_deps holds the list of libsinglebin_*.a files that have the
584   # compiled code of each selected program in a "library" format.
585   single_binary_deps=`
586     for p in $single_binary_progs; do
587       # Convert '[' to '_'
588       test x"$p" = x'@<:@' && p='_'
589       printf 'src/libsinglebin_%s.a ' "$p"
590     done`
591   single_binary_install_type="$gl_single_binary"
593 AC_SUBST([single_binary_progs], [$single_binary_progs])
594 AC_SUBST([single_binary_libs], [$single_binary_libs])
595 AC_SUBST([single_binary_deps], [$single_binary_deps])
596 AC_SUBST([single_binary_install_type], [$single_binary_install_type])
599 # The programs built and installed by "make && make install".
600 # Since this is AC_SUBST'd, Automake won't be able to perform rewrite
601 # with $(EXEEXT) appending on it, so we have to do it ourselves -- in
602 # this case, only for $(bin_PROGRAMS).
603 bin_PROGRAMS=`
604   for p in $optional_bin_progs; do echo src/"$p"'$(EXEEXT)'; done`
606 # Normalize whitespace.
607 man1_MANS=`echo $man1_MANS`
608 EXTRA_MANS=`echo $EXTRA_MANS`
609 bin_PROGRAMS=`echo $bin_PROGRAMS`
610 pkglibexec_PROGS=`echo $pkglibexec_PROGRAMS`
612 AC_SUBST([bin_PROGRAMS])        AM_SUBST_NOTMAKE([bin_PROGRAMS])
613 AC_SUBST([pkglibexec_PROGRAMS]) AM_SUBST_NOTMAKE([pkglibexec_PROGRAMS])
614 AC_SUBST([man1_MANS])           AM_SUBST_NOTMAKE([man1_MANS])
615 AC_SUBST([EXTRA_MANS])          AM_SUBST_NOTMAKE([EXTRA_MANS])
617 AC_SUBST([built_programs], [$optional_bin_progs])
619 AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
621 ############################################################################
623 # As long as "grep 'PRI[diouxX]' po/*.pot" reports matches in
624 # translatable strings, we must use need-formatstring-macros here.
625 AM_GNU_GETTEXT([external], [need-formatstring-macros])
626 AM_GNU_GETTEXT_VERSION([0.19.2])
628 # For a test of uniq: it uses the $LOCALE_FR envvar.
629 gt_LOCALE_FR
631 AC_CONFIG_FILES(
632   Makefile
633   po/Makefile.in
634   gnulib-tests/Makefile
635   )
636 AC_OUTPUT