all: update gnulib submodule to latest
[coreutils.git] / configure.ac
blob80bda2b6a90bfbd6a2797d9c949e5fdfd61683cb
1 # -*- autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 # Copyright (C) 1991-2017 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 <http://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 AC_INIT([GNU coreutils],
27         m4_esyscmd([build-aux/git-version-gen .tarball-version]),
28         [bug-coreutils@gnu.org])
30 AC_CONFIG_SRCDIR([src/ls.c])
32 AC_CONFIG_AUX_DIR([build-aux])
33 AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
35 AM_INIT_AUTOMAKE([1.11.2 no-dist-gzip dist-xz color-tests parallel-tests
36                   subdir-objects])
37 AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
39 dnl POSIXCHECK is worthwhile for maintainers, but adds several seconds
40 dnl (more than 10% execution time) to ./configure, with no benefit for
41 dnl most users.  Using it to look for bugs requires:
42 dnl   GNULIB_POSIXCHECK=1 autoreconf -f
43 dnl   ./configure
44 dnl   make
45 dnl   make -C src clean
46 dnl   make CFLAGS=-DGNULIB_POSIXCHECK=1
47 dnl FIXME: Once we figure out how to avoid false positives, we should
48 dnl have 'make my-distcheck' in dist-check.mk exercise this.
49 m4_syscmd([test "${GNULIB_POSIXCHECK+set}" = set])
50 m4_if(m4_sysval, [0], [], [dnl
51 gl_ASSERT_NO_GNULIB_POSIXCHECK])
53 AC_PROG_CC_STDC
54 AM_PROG_CC_C_O
55 AC_PROG_CPP
56 AC_PROG_GCC_TRADITIONAL
57 AC_PROG_RANLIB
58 AC_PROG_LN_S
59 gl_EARLY
60 gl_INIT
61 coreutils_MACROS
63 # The test suite needs to know if we have a working perl.
64 # FIXME: this is suboptimal.  Ideally, we would be able to call gl_PERL
65 # with an ACTION-IF-NOT-FOUND argument ...
66 cu_have_perl=yes
67 case $PERL in *"/missing "*) cu_have_perl=no;; esac
68 AM_CONDITIONAL([HAVE_PERL], [test $cu_have_perl = yes])
70 # gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found])
71 # ------------------------------------------------
72 # If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND.
73 # Otherwise, run RUN-IF-NOT-FOUND.
74 AC_DEFUN([gl_GCC_VERSION_IFELSE],
75   [AC_PREPROC_IFELSE(
76     [AC_LANG_PROGRAM(
77       [[
78 #if ($1) < __GNUC__ || (($1) == __GNUC__ && ($2) <= __GNUC_MINOR__)
79 /* ok */
80 #else
81 # error "your version of gcc is older than $1.$2"
82 #endif
83       ]]),
84     ], [$3], [$4])
85   ]
88 AC_ARG_ENABLE([gcc-warnings],
89   [AS_HELP_STRING([--enable-gcc-warnings],
90      [turn on many GCC warnings (for developers; best with GNU make)])],
91   [case $enableval in
92      yes|no) ;;
93      *)      AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
94    esac
95    gl_gcc_warnings=$enableval],
96   [
97    # GCC provides fine-grained control over diagnostics which
98    # is used in gnulib for example to suppress warnings from
99    # certain sections of code.  So if this is available and
100    # we're running from a git repo, then auto enable the warnings.
101    gl_gcc_warnings=no
102    gl_GCC_VERSION_IFELSE([4], [6],
103                          [test -d "$srcdir"/.git \
104                           && ! test -f "$srcdir"/.tarball-version \
105                           && gl_gcc_warnings=yes])]
108 if test "$gl_gcc_warnings" = yes; then
109   gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
110   AC_SUBST([WERROR_CFLAGS])
112   nw=
113   # This, $nw, is the list of warnings we disable.
114   nw="$nw -Wdeclaration-after-statement" # too useful to forbid
115   nw="$nw -Waggregate-return"       # anachronistic
116   nw="$nw -Wlong-long"              # C90 is anachronistic (lib/gethrxtime.h)
117   nw="$nw -Wc++-compat"             # We don't care about C++ compilers
118   nw="$nw -Wundef"                  # Warns on '#if GNULIB_FOO' etc in gnulib
119   nw="$nw -Wtraditional"            # Warns on #elif which we use often
120   nw="$nw -Wcast-qual"              # Too many warnings for now
121   nw="$nw -Wconversion"             # Too many warnings for now
122   nw="$nw -Wsystem-headers"         # Don't let system headers trigger warnings
123   nw="$nw -Wsign-conversion"        # Too many warnings for now
124   nw="$nw -Wtraditional-conversion" # Too many warnings for now
125   nw="$nw -Wunreachable-code"       # Too many warnings for now
126   nw="$nw -Wpadded"                 # Our structs are not padded
127   nw="$nw -Wredundant-decls"        # openat.h declares e.g., mkdirat
128   nw="$nw -Wlogical-op"             # Too many warnings until GCC 4.8.0
129   nw="$nw -Wformat-nonliteral"      # who.c and pinky.c strftime uses
130   nw="$nw -Wvla"                    # warnings in gettext.h
131   nw="$nw -Wnested-externs"         # use of XARGMATCH/verify_function__
132   nw="$nw -Wswitch-enum"            # Too many warnings for now
133   nw="$nw -Wswitch-default"         # Too many warnings for now
134   nw="$nw -Wstack-protector"        # not worth working around
135   nw="$nw -Wtype-limits"            # False alarms for portable code
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
145   # Using -Wstrict-overflow is a pain, but the alternative is worse.
146   # For an example, see the code that provoked this report:
147   # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33498
148   # Code like that still infloops with gcc-4.6.0 and -O2.  Scary indeed.
150   gl_MANYWARN_ALL_GCC([ws])
151   gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
152   for w in $ws; do
153     gl_WARN_ADD([$w])
154   done
155   gl_WARN_ADD([-Wno-sign-compare])     # Too many warnings for now
156   gl_WARN_ADD([-Wno-type-limits])      # False alarms for portable code
157   gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
158   gl_WARN_ADD([-Wno-format-nonliteral])
160   # Enable this warning only with gcc-4.8 and newer.  Before that
161   # bounds checking as done in truncate.c was incorrectly flagged.
162   # See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43772
163   gl_GCC_VERSION_IFELSE([4], [8], [gl_WARN_ADD([-Wlogical-op])])
165   # clang is unduly picky about some things.
166   AC_CACHE_CHECK([whether the compiler is clang], [utils_cv_clang],
167     [AC_COMPILE_IFELSE(
168        [AC_LANG_PROGRAM([[
169             #ifndef __clang__
170               #error "not clang"
171             #endif
172           ]])],
173        [utils_cv_clang=yes],
174        [utils_cv_clang=no])])
175   if test $utils_cv_clang = yes; then
176     gl_WARN_ADD([-Wno-format-extra-args])
177     gl_WARN_ADD([-Wno-tautological-constant-out-of-range-compare])
178   fi
180   gl_WARN_ADD([-fdiagnostics-show-option])
181   gl_WARN_ADD([-funit-at-a-time])
183   AC_SUBST([WARN_CFLAGS])
185   AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
186   AH_VERBATIM([FORTIFY_SOURCE],
187   [/* Enable compile-time and run-time bounds-checking, and some warnings,
188       without upsetting glibc 2.15+. */
189    #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
190    # define _FORTIFY_SOURCE 2
191    #endif
192   ])
193   AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
195   # We use a slightly smaller set of warning options for lib/.
196   # Remove the following and save the result in GNULIB_WARN_CFLAGS.
197   nw=
198   nw="$nw -Wduplicated-branches"    # Too many false alarms
199   nw="$nw -Wformat-truncation=2"
200   nw="$nw -Wstrict-overflow"
201   nw="$nw -Wuninitialized"
202   nw="$nw -Wunused-macros"
203   nw="$nw -Wmissing-prototypes"
204   nw="$nw -Wold-style-definition"
205   # FIXME: it may be easy to remove this, since it affects only one file:
206   # the snprintf call at ftoastr.c:132.
207   nw="$nw -Wdouble-promotion"
208   gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
209   AC_SUBST([GNULIB_WARN_CFLAGS])
211   # For gnulib-tests, the set is slightly smaller still.
212   nw=
213   nw="$nw -Wstrict-prototypes"
214   # It's not worth being this picky about test programs.
215   nw="$nw -Wsuggest-attribute=const"
216   nw="$nw -Wsuggest-attribute=pure"
217   gl_MANYWARN_COMPLEMENT([GNULIB_TEST_WARN_CFLAGS],
218                          [$GNULIB_WARN_CFLAGS], [$nw])
219   AC_SUBST([GNULIB_TEST_WARN_CFLAGS])
222 AC_ARG_ENABLE([single-binary],
223   [AS_HELP_STRING([--enable-single-binary=[shebangs|symlinks]],
224      [Compile all the tools in a single binary, reducing the overall size.
225       When compiled this way, shebangs (default when enabled) or symlinks are
226       installed for each tool that points to the single binary.])],
227   [gl_single_binary=no ;
228    case $enableval in
229      yes) gl_single_binary=shebangs ;;
230      no|shebangs|symlinks) gl_single_binary=$enableval ;;
231      *)      AC_MSG_ERROR([bad value $enableval for single-binary option.
232                            Options are: symlinks, shebangs, no.]) ;;
233    esac],
234   [gl_single_binary=no]
236 AC_ARG_ENABLE([single-binary-exceptions],
237   [AS_HELP_STRING([--enable-single-binary-exceptions=PROG_LIST],
238      [When used with --enable-single-binary, exclude the PROG_LIST from
239       it, so these programs are compiled as separated files
240       (comma-separated, default none))])],
241   [gl_single_binary_exceptions=$enableval],
242   [gl_single_binary_exceptions=]
244 if test "$gl_single_binary" = 'symlinks'; then
245   if ! test "`echo ls | sed \"$program_transform_name\"`" = 'ls'; then
246     AC_MSG_ERROR([program name transformations are not currently supported
247                   with --enable-single-binary=symlinks.])
248   fi
250 AM_CONDITIONAL([SINGLE_BINARY], [test "$gl_single_binary" != no])
252 AC_FUNC_FORK
254 optional_bin_progs=
255 AC_CHECK_FUNCS([chroot],
256         gl_ADD_PROG([optional_bin_progs], [chroot]))
257 AC_CHECK_FUNCS([gethostid],
258         gl_ADD_PROG([optional_bin_progs], [hostid]))
259 AC_CHECK_FUNCS([sigsuspend],
260         gl_ADD_PROG([optional_bin_progs], [timeout]))
262 gl_WINSIZE_IN_PTEM
264 AC_MSG_CHECKING([whether localtime caches TZ])
265 AC_CACHE_VAL([utils_cv_localtime_cache],
266 [if test x$ac_cv_func_tzset = xyes; then
267 AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <time.h>
268 #if STDC_HEADERS
269 # include <stdlib.h>
270 #endif
271 extern char **environ;
272 void unset_TZ (void)
274   char **from, **to;
275   for (to = from = environ; (*to = *from); from++)
276     if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
277       to++;
279 int main()
281   time_t now = time ((time_t *) 0);
282   int hour_GMT0, hour_unset;
283   if (putenv ("TZ=GMT0") != 0)
284     return 1;
285   hour_GMT0 = localtime (&now)->tm_hour;
286   unset_TZ ();
287   hour_unset = localtime (&now)->tm_hour;
288   if (putenv ("TZ=PST8") != 0)
289     return 1;
290   if (localtime (&now)->tm_hour == hour_GMT0)
291     return 1;
292   unset_TZ ();
293   if (localtime (&now)->tm_hour != hour_unset)
294     return 1;
295   return 0;
296 }]])],
297 [utils_cv_localtime_cache=no],
298 [utils_cv_localtime_cache=yes],
299 [# If we have tzset, assume the worst when cross-compiling.
300 utils_cv_localtime_cache=yes])
301 else
302         # If we lack tzset, report that localtime does not cache TZ,
303         # since we can't invalidate the cache if we don't have tzset.
304         utils_cv_localtime_cache=no
305 fi])dnl
306 AC_MSG_RESULT([$utils_cv_localtime_cache])
307 if test $utils_cv_localtime_cache = yes; then
308   AC_DEFINE([LOCALTIME_CACHE], [1], [FIXME])
311 # Assume that if getattrat exists, it's compatible with Solaris 11.
312 AC_CHECK_FUNCS([getattrat])
313 if test $ac_cv_func_getattrat = yes; then
314   LIB_NVPAIR=-lnvpair
315   AC_SUBST([LIB_NVPAIR])
318 # SCO-ODT-3.0 is reported to need -los to link programs using initgroups
319 AC_CHECK_FUNCS([initgroups])
320 if test $ac_cv_func_initgroups = no; then
321   AC_CHECK_LIB([os], [initgroups])
324 AC_CHECK_FUNCS([syslog])
325 if test $ac_cv_func_syslog = no; then
326   # syslog is not in the default libraries.  See if it's in some other.
327   for lib in bsd socket inet; do
328     AC_CHECK_LIB([$lib], [syslog], [AC_DEFINE([HAVE_SYSLOG], [1], [FIXME])
329       LIBS="$LIBS -l$lib"; break])
330   done
333 AC_CACHE_CHECK([for 3-argument setpriority function],
334   [utils_cv_func_setpriority],
335   [AC_LINK_IFELSE(
336     [AC_LANG_PROGRAM(
337        [[#include <sys/time.h>
338          #include <sys/resource.h>
339        ]],
340        [[setpriority (0, 0, 0);]])],
341     [utils_cv_func_setpriority=yes],
342     [utils_cv_func_setpriority=no])])
343 if test $utils_cv_func_setpriority = no; then
344   AC_CHECK_FUNCS([nice])
346 case $utils_cv_func_setpriority,$ac_cv_func_nice in
347 *yes*)
348   gl_ADD_PROG([optional_bin_progs], [nice])
349 esac
351 AC_DEFUN([coreutils_DUMMY_1],
353   AC_REQUIRE([gl_READUTMP])
354   if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then
355     gl_ADD_PROG([optional_bin_progs], [who])
356     gl_ADD_PROG([optional_bin_progs], [users])
357     gl_ADD_PROG([optional_bin_progs], [pinky])
358   fi
360 coreutils_DUMMY_1
362 AC_MSG_CHECKING([ut_host in struct utmp])
363 AC_CACHE_VAL([su_cv_func_ut_host_in_utmp],
364 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
365                                    #include <utmp.h>
366                                    struct utmp ut;
367                                    int s = sizeof ut.ut_host;]])],
368   [su_cv_func_ut_host_in_utmp=yes],
369   [su_cv_func_ut_host_in_utmp=no])])
370 AC_MSG_RESULT([$su_cv_func_ut_host_in_utmp])
371 if test $su_cv_func_ut_host_in_utmp = yes; then
372   have_ut_host=1
373   AC_DEFINE([HAVE_UT_HOST], [1], [FIXME])
376 if test -z "$have_ut_host"; then
377   AC_MSG_CHECKING([ut_host in struct utmpx])
378   AC_CACHE_VAL([su_cv_func_ut_host_in_utmpx],
379   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
380                                      #include <utmpx.h>
381                                      struct utmpx ut;
382                                      int s = sizeof ut.ut_host;]])],
383     [su_cv_func_ut_host_in_utmpx=yes],
384     [su_cv_func_ut_host_in_utmpx=no])])
385   AC_MSG_RESULT([$su_cv_func_ut_host_in_utmpx])
386   if test $su_cv_func_ut_host_in_utmpx = yes; then
387     AC_DEFINE([HAVE_UTMPX_H], [1], [FIXME])
388     AC_DEFINE([HAVE_UT_HOST], [1], [FIXME])
389   fi
392 GNULIB_BOOT_TIME([gl_ADD_PROG([optional_bin_progs], [uptime])])
394 AC_SYS_POSIX_TERMIOS()
395 gl_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL
397 if test $ac_cv_sys_posix_termios = yes; then
398   gl_ADD_PROG([optional_bin_progs], [stty])
400   AC_MSG_CHECKING([whether termios.h needs _XOPEN_SOURCE])
401   AC_CACHE_VAL([su_cv_sys_termios_needs_xopen_source],
402   [AC_EGREP_CPP([yes], [#include <termios.h>
403 #ifdef IUCLC
405 #endif], su_cv_sys_termios_needs_xopen_source=no,
406    AC_EGREP_CPP([yes], [#define _XOPEN_SOURCE
407 #include <termios.h>
408 #ifdef IUCLC
410 #endif], su_cv_sys_termios_needs_xopen_source=yes,
411    su_cv_sys_termios_needs_xopen_source=no))])
412   AC_MSG_RESULT([$su_cv_sys_termios_needs_xopen_source])
413   test $su_cv_sys_termios_needs_xopen_source = yes &&
414     AC_DEFINE([TERMIOS_NEEDS_XOPEN_SOURCE], [1], [FIXME])
416   AC_MSG_CHECKING([c_line in struct termios])
417   AC_CACHE_VAL([su_cv_sys_c_line_in_termios],
418   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if TERMIOS_NEEDS_XOPEN_SOURCE
419                                       #define _XOPEN_SOURCE
420                                      #endif
421                                      #include <sys/types.h>
422                                      #include <termios.h>
423                                      struct termios t;
424                                      int s = sizeof t.c_line;]])],
425     [su_cv_sys_c_line_in_termios=yes],
426     [su_cv_sys_c_line_in_termios=no])])
427   AC_MSG_RESULT([$su_cv_sys_c_line_in_termios])
428   test $su_cv_sys_c_line_in_termios = yes \
429     && AC_DEFINE([HAVE_C_LINE], [1], [FIXME])
432 # FIXME: note that this macro appears above, too.
433 # I'm leaving it here for now.  This whole thing needs to be modernized...
434 gl_WINSIZE_IN_PTEM
436 gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H
438 if test $gl_cv_sys_tiocgwinsz_needs_termios_h = no && \
439    test $gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h = no; then
440   AC_MSG_CHECKING([TIOCGWINSZ in sys/pty.h])
441   AC_CACHE_VAL([su_cv_sys_tiocgwinsz_in_sys_pty_h],
442   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
443 #ifdef WINSIZE_IN_PTEM
444 # include <sys/stream.h>
445 # include <sys/ptem.h>
446 #endif
447 #include <sys/ioctl.h>
448 #include <sys/tty.h>
449 #include <sys/pty.h>]], [[int x = TIOCGWINSZ;]])],
450     [su_cv_sys_tiocgwinsz_in_sys_pty_h=yes],
451     [su_cv_sys_tiocgwinsz_in_sys_pty_h=no])])
452   AC_MSG_RESULT([$su_cv_sys_tiocgwinsz_in_sys_pty_h])
454   test $su_cv_sys_tiocgwinsz_in_sys_pty_h = yes \
455       && AC_DEFINE([GWINSZ_IN_SYS_PTY], [1],
456                    [Define if your system defines TIOCGWINSZ in sys/pty.h.])
459 # For src/kill.c.
460 AC_CHECK_DECLS([strsignal, sys_siglist, _sys_siglist, __sys_siglist], , ,
461   [AC_INCLUDES_DEFAULT
462 #include <signal.h>])
464 cu_GMP
466 # Build df only if there's a point to it.
467 if test $gl_cv_list_mounted_fs = yes && test $gl_cv_fs_space = yes; then
468   gl_ADD_PROG([optional_bin_progs], [df])
471 # Build stdbuf only if supported
472 ac_save_CFLAGS=$CFLAGS
473 ac_save_LDFLAGS=$LDFLAGS
474 # Detect warnings about ignored "constructor" attributes.
475 gl_WARN_ADD([-Werror], [CFLAGS])
476 gl_WARN_ADD([-errwarn], [CFLAGS])
477 # Put this message here, after gl_WARN_ADD's chatter.
478 AC_MSG_CHECKING([whether this system supports stdbuf])
479 CFLAGS="-fPIC $CFLAGS"
480 LDFLAGS="-shared $LDFLAGS"
481 stdbuf_supported=no
482 # Note we only LINK here rather than RUN to support cross compilation
483 AC_LINK_IFELSE(
484   [AC_LANG_PROGRAM([[
485     static int stdbuf = 0;
487     void __attribute__ ((constructor))
488     stdbuf_init (void)
489     {
490       stdbuf = 1;
491     }]],[[
492     if (stdbuf != 1)
493       return 1;]])
494   ],
495   [stdbuf_supported=yes])
496 AC_MSG_RESULT([$stdbuf_supported])
497 if test "$stdbuf_supported" = "yes" && test -z "$EXEEXT"; then
498   gl_ADD_PROG([optional_bin_progs], [stdbuf])
500 CFLAGS=$ac_save_CFLAGS
501 LDFLAGS=$ac_save_LDFLAGS
503 # Detect when using xlc to determine whether to use -qinclude=
504 AC_CACHE_CHECK([whether the system supports xlc include], [utils_cv_xlc],
505   [AC_COMPILE_IFELSE(
506      [AC_LANG_PROGRAM([[
507           #ifndef __xlc__
508             #error "not xlc"
509           #endif
510         ]])],
511      [utils_cv_xlc=yes],
512      [utils_cv_xlc=no])])
513 AM_CONDITIONAL([USE_XLC_INCLUDE], [test "$utils_cv_xlc" = yes])
515 ############################################################################
517 dnl Autogenerated by the 'gen-lists-of-programs.sh' auxiliary script.
518 dnl Issue proper calls to the macros gl_INCLUDE_EXCLUDE_PROG and
519 dnl gl_ADD_PROG (updating $optional_bin_progs), and generate the list
520 dnl of coreutils programs to be built only upon explicit user request,
521 dnl saving that list in the $no_install_progs_default shell variable.
522 m4_include([m4/cu-progs.m4])
524 # Now that we know which programs will actually be built, determine
525 # which optional helper progs should be compiled.
526 # Note it adding to pkglibexec_PROGRAMS, $(transform) in src/local.mk
527 # may need to be updated accordingly.
528 case " $optional_bin_progs " in
529   *' stdbuf '*) pkglibexec_PROGRAMS='src/libstdbuf.so';;
530   *) pkglibexec_PROGRAMS='';;
531 esac
533 man1_MANS=`
534   for p in $optional_bin_progs; do
535     # Change "ginstall.1" to "install.1".
536     test $p = ginstall && p=install
537     # Ignore the "[" program, since writing a portable make rule to
538     # generate its manpage is not practical.
539     dnl Use the autoconf-provided quadrigraph to represent "[",
540     dnl otherwise we will incur in dreadful quoting issues.
541     test x$p = x'@<:@' && continue
542     echo "man/$p.1"
543   done`
545 # Not installed by "make install", but must be built when creating
546 # a distribution tarball.
547 EXTRA_MANS=`for p in $no_install_progs_default $gl_no_install_prog; do
548               echo man/$p.1
549             done`
551 # Replace all the programs by the single binary and symlinks if specified.
552 single_binary_progs=
553 single_binary_libs=
554 single_binary_deps=
555 single_binary_install_type=
556 if test "$gl_single_binary" != no; then
557   man1_MANS="$man1_MANS man/coreutils.1"
558   # Convert the list to a space separated list
559   gl_single_binary_exceptions=`echo $gl_single_binary_exceptions | tr ',' ' '`
561   single_binary_progs=`echo $optional_bin_progs`
562   optional_bin_progs="coreutils"
563   for prog in $gl_single_binary_exceptions; do
564     # Fail if requested to exclude a program than was not part of coreutils.
565     case " $single_binary_progs " in
566       *" $prog "*)
567         gl_REMOVE_PROG([single_binary_progs], [$prog]) ;
568         gl_ADD_PROG([optional_bin_progs], [$prog]) ;;
569       *) AC_MSG_ERROR(['$prog' is not being compiled.]) ;;
570     esac
571   done
573   # single_binary_libs holds the list of libs required by the selected
574   # programs, such as for example -lrt.
575   single_binary_libs=`
576     for p in $single_binary_progs; do
577       # Convert '[' to '_'
578       test x"$p" = x'@<:@' && p='_'
579       printf '$(src_libsinglebin_%s_a_ldadd) ' "$p"
580     done`
581   # single_binary_deps holds the list of libsinglebin_*.a files that have the
582   # compiled code of each selected program in a "library" format.
583   single_binary_deps=`
584     for p in $single_binary_progs; do
585       # Convert '[' to '_'
586       test x"$p" = x'@<:@' && p='_'
587       printf 'src/libsinglebin_%s.a ' "$p"
588     done`
589   single_binary_install_type="$gl_single_binary"
591 AC_SUBST([single_binary_progs], [$single_binary_progs])
592 AC_SUBST([single_binary_libs], [$single_binary_libs])
593 AC_SUBST([single_binary_deps], [$single_binary_deps])
594 AC_SUBST([single_binary_install_type], [$single_binary_install_type])
597 # The programs built and installed by "make && make install".
598 # Since this is AC_SUBST'd, Automake won't be able to perform rewrite
599 # with $(EXEEXT) appending on it, so we have to do it ourselves -- in
600 # this case, only for $(bin_PROGRAMS).
601 bin_PROGRAMS=`
602   for p in $optional_bin_progs; do echo src/"$p"'$(EXEEXT)'; done`
604 # Normalize whitespace.
605 man1_MANS=`echo $man1_MANS`
606 EXTRA_MANS=`echo $EXTRA_MANS`
607 bin_PROGRAMS=`echo $bin_PROGRAMS`
608 pkglibexec_PROGS=`echo $pkglibexec_PROGRAMS`
610 AC_SUBST([bin_PROGRAMS])        AM_SUBST_NOTMAKE([bin_PROGRAMS])
611 AC_SUBST([pkglibexec_PROGRAMS]) AM_SUBST_NOTMAKE([pkglibexec_PROGRAMS])
612 AC_SUBST([man1_MANS])           AM_SUBST_NOTMAKE([man1_MANS])
613 AC_SUBST([EXTRA_MANS])          AM_SUBST_NOTMAKE([EXTRA_MANS])
615 AC_SUBST([built_programs], [$optional_bin_progs])
617 AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
619 ############################################################################
621 # As long as "grep 'PRI[diouxX]' po/*.pot" reports matches in
622 # translatable strings, we must use need-formatstring-macros here.
623 AM_GNU_GETTEXT([external], [need-formatstring-macros])
624 AM_GNU_GETTEXT_VERSION([0.19.2])
626 # For a test of uniq: it uses the $LOCALE_FR envvar.
627 gt_LOCALE_FR
629 AC_CONFIG_FILES(
630   Makefile
631   po/Makefile.in
632   gnulib-tests/Makefile
633   )
634 AC_OUTPUT