Blame configure.ac

Packit Service 2723c6
# -*- autoconf -*-
Packit Service 2723c6
# Process this file with autoconf to produce a configure script.
Packit Service 2723c6
Packit Service 2723c6
# Copyright (C) 1991-2018 Free Software Foundation, Inc.
Packit Service 2723c6
Packit Service 2723c6
# This program is free software: you can redistribute it and/or modify
Packit Service 2723c6
# it under the terms of the GNU General Public License as published by
Packit Service 2723c6
# the Free Software Foundation, either version 3 of the License, or
Packit Service 2723c6
# (at your option) any later version.
Packit Service 2723c6
Packit Service 2723c6
# This program is distributed in the hope that it will be useful,
Packit Service 2723c6
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 2723c6
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service 2723c6
# GNU General Public License for more details.
Packit Service 2723c6
Packit Service 2723c6
# You should have received a copy of the GNU General Public License
Packit Service 2723c6
# along with this program.  If not, see <https://www.gnu.org/licenses/>.
Packit Service 2723c6
Packit Service 2723c6
dnl Written by Jim Meyering.
Packit Service 2723c6
Packit Service 2723c6
AC_PREREQ([2.69])
Packit Service 2723c6
Packit Service 2723c6
# Make inter-release version strings look like, e.g., v6.9-219-g58ddd, which
Packit Service 2723c6
# indicates that it is built from the 219th delta (in _some_ repository)
Packit Service 2723c6
# following the v6.9 tag, and that 58ddd is a prefix of the commit SHA1.
Packit Service 2723c6
# The explicit URL can be removed when autoconf > 2.69 is released.
Packit Service 2723c6
AC_INIT([GNU coreutils],
Packit Service 2723c6
        m4_esyscmd([build-aux/git-version-gen .tarball-version]),
Packit Service 2723c6
        [bug-coreutils@gnu.org],
Packit Service 2723c6
        [coreutils],
Packit Service 2723c6
        [https://www.gnu.org/software/coreutils/])
Packit Service 2723c6
Packit Service 2723c6
AC_CONFIG_SRCDIR([src/ls.c])
Packit Service 2723c6
Packit Service 2723c6
AC_CONFIG_AUX_DIR([build-aux])
Packit Service 2723c6
AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
Packit Service 2723c6
Packit Service 2723c6
AM_INIT_AUTOMAKE([1.11.2 no-dist-gzip dist-xz color-tests parallel-tests
Packit Service 2723c6
                  subdir-objects])
Packit Service 2723c6
AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
Packit Service 2723c6
Packit Service 2723c6
dnl POSIXCHECK is worthwhile for maintainers, but adds several seconds
Packit Service 2723c6
dnl (more than 10% execution time) to ./configure, with no benefit for
Packit Service 2723c6
dnl most users.  Using it to look for bugs requires:
Packit Service 2723c6
dnl   GNULIB_POSIXCHECK=1 autoreconf -f
Packit Service 2723c6
dnl   ./configure
Packit Service 2723c6
dnl   make
Packit Service 2723c6
dnl   make -C src clean
Packit Service 2723c6
dnl   make CFLAGS=-DGNULIB_POSIXCHECK=1
Packit Service 2723c6
dnl FIXME: Once we figure out how to avoid false positives, we should
Packit Service 2723c6
dnl have 'make my-distcheck' in dist-check.mk exercise this.
Packit Service 2723c6
m4_syscmd([test "${GNULIB_POSIXCHECK+set}" = set])
Packit Service 2723c6
m4_if(m4_sysval, [0], [], [dnl
Packit Service 2723c6
gl_ASSERT_NO_GNULIB_POSIXCHECK])
Packit Service 2723c6
Packit Service 2723c6
AC_PROG_CC_STDC
Packit Service 2723c6
AM_PROG_CC_C_O
Packit Service 2723c6
AC_PROG_CPP
Packit Service 2723c6
AC_PROG_GCC_TRADITIONAL
Packit Service 2723c6
AC_PROG_RANLIB
Packit Service 2723c6
AC_PROG_LN_S
Packit Service 2723c6
gl_EARLY
Packit Service 2723c6
gl_INIT
Packit Service 2723c6
coreutils_MACROS
Packit Service 2723c6
Packit Service 2723c6
# The test suite needs to know if we have a working perl.
Packit Service 2723c6
# FIXME: this is suboptimal.  Ideally, we would be able to call gl_PERL
Packit Service 2723c6
# with an ACTION-IF-NOT-FOUND argument ...
Packit Service 2723c6
cu_have_perl=yes
Packit Service 2723c6
case $PERL in *"/missing "*) cu_have_perl=no;; esac
Packit Service 2723c6
AM_CONDITIONAL([HAVE_PERL], [test $cu_have_perl = yes])
Packit Service 2723c6
Packit Service 2723c6
# gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found])
Packit Service 2723c6
# ------------------------------------------------
Packit Service 2723c6
# If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND.
Packit Service 2723c6
# Otherwise, run RUN-IF-NOT-FOUND.
Packit Service 2723c6
AC_DEFUN([gl_GCC_VERSION_IFELSE],
Packit Service 2723c6
  [AC_PREPROC_IFELSE(
Packit Service 2723c6
    [AC_LANG_PROGRAM(
Packit Service 2723c6
      [[
Packit Service 2723c6
#if ($1) < __GNUC__ || (($1) == __GNUC__ && ($2) <= __GNUC_MINOR__)
Packit Service 2723c6
/* ok */
Packit Service 2723c6
#else
Packit Service 2723c6
# error "your version of gcc is older than $1.$2"
Packit Service 2723c6
#endif
Packit Service 2723c6
      ]]),
Packit Service 2723c6
    ], [$3], [$4])
Packit Service 2723c6
  ]
Packit Service 2723c6
)
Packit Service 2723c6
Packit Service 2723c6
AC_ARG_ENABLE([gcc-warnings],
Packit Service 2723c6
  [AS_HELP_STRING([--enable-gcc-warnings],
Packit Service 2723c6
     [turn on many GCC warnings (for developers; best with GNU make)])],
Packit Service 2723c6
  [case $enableval in
Packit Service 2723c6
     yes|no) ;;
Packit Service 2723c6
     *)      AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
Packit Service 2723c6
   esac
Packit Service 2723c6
   gl_gcc_warnings=$enableval],
Packit Service 2723c6
  [
Packit Service 2723c6
   # GCC provides fine-grained control over diagnostics which
Packit Service 2723c6
   # is used in gnulib for example to suppress warnings from
Packit Service 2723c6
   # certain sections of code.  So if this is available and
Packit Service 2723c6
   # we're running from a git repo, then auto enable the warnings.
Packit Service 2723c6
   gl_gcc_warnings=no
Packit Service 2723c6
   gl_GCC_VERSION_IFELSE([4], [6],
Packit Service 2723c6
                         [test -d "$srcdir"/.git \
Packit Service 2723c6
                          && ! test -f "$srcdir"/.tarball-version \
Packit Service 2723c6
                          && gl_gcc_warnings=yes])]
Packit Service 2723c6
)
Packit Service 2723c6
Packit Service 2723c6
if test "$gl_gcc_warnings" = yes; then
Packit Service 2723c6
  gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
Packit Service 2723c6
  AC_SUBST([WERROR_CFLAGS])
Packit Service 2723c6
Packit Service 2723c6
  nw=
Packit Service 2723c6
  # This, $nw, is the list of warnings we disable.
Packit Service 2723c6
  nw="$nw -Wdeclaration-after-statement" # too useful to forbid
Packit Service 2723c6
  nw="$nw -Waggregate-return"       # anachronistic
Packit Service 2723c6
  nw="$nw -Wlong-long"              # C90 is anachronistic (lib/gethrxtime.h)
Packit Service 2723c6
  nw="$nw -Wc++-compat"             # We don't care about C++ compilers
Packit Service 2723c6
  nw="$nw -Wundef"                  # Warns on '#if GNULIB_FOO' etc in gnulib
Packit Service 2723c6
  nw="$nw -Wtraditional"            # Warns on #elif which we use often
Packit Service 2723c6
  nw="$nw -Wcast-qual"              # Too many warnings for now
Packit Service 2723c6
  nw="$nw -Wconversion"             # Too many warnings for now
Packit Service 2723c6
  nw="$nw -Wsystem-headers"         # Don't let system headers trigger warnings
Packit Service 2723c6
  nw="$nw -Wsign-conversion"        # Too many warnings for now
Packit Service 2723c6
  nw="$nw -Wtraditional-conversion" # Too many warnings for now
Packit Service 2723c6
  nw="$nw -Wunreachable-code"       # Too many warnings for now
Packit Service 2723c6
  nw="$nw -Wpadded"                 # Our structs are not padded
Packit Service 2723c6
  nw="$nw -Wredundant-decls"        # openat.h declares e.g., mkdirat
Packit Service 2723c6
  nw="$nw -Wlogical-op"             # Too many warnings until GCC 4.8.0
Packit Service 2723c6
  nw="$nw -Wformat-nonliteral"      # who.c and pinky.c strftime uses
Packit Service 2723c6
  nw="$nw -Wvla"                    # warnings in gettext.h
Packit Service 2723c6
  nw="$nw -Wnested-externs"         # use of XARGMATCH/verify_function__
Packit Service 2723c6
  nw="$nw -Wswitch-enum"            # Too many warnings for now
Packit Service 2723c6
  nw="$nw -Wswitch-default"         # Too many warnings for now
Packit Service 2723c6
  nw="$nw -Wstack-protector"        # not worth working around
Packit Service 2723c6
  nw="$nw -Wtype-limits"            # False alarms for portable code
Packit Service 2723c6
  nw="$nw -Wformat-overflow=2"      # False alarms due to GCC bug 80776
Packit Service 2723c6
  nw="$nw -Wformat-truncation=2"    # False alarm in ls.c, probably related
Packit Service 2723c6
  # things I might fix soon:
Packit Service 2723c6
  nw="$nw -Wfloat-equal"            # sort.c, seq.c
Packit Service 2723c6
  nw="$nw -Wmissing-format-attribute" # copy.c
Packit Service 2723c6
  nw="$nw -Wunsafe-loop-optimizations" # a few src/*.c
Packit Service 2723c6
  nw="$nw -Winline"                 # system.h's readdir_ignoring_dot_and_dotdot
Packit Service 2723c6
  nw="$nw -Wsuggest-attribute=format" # warns about copy.c and factor.c
Packit Service 2723c6
Packit Service 2723c6
  # Using -Wstrict-overflow is a pain, but the alternative is worse.
Packit Service 2723c6
  # For an example, see the code that provoked this report:
Packit Service 2723c6
  # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33498
Packit Service 2723c6
  # Code like that still infloops with gcc-4.6.0 and -O2.  Scary indeed.
Packit Service 2723c6
Packit Service 2723c6
  gl_MANYWARN_ALL_GCC([ws])
Packit Service 2723c6
  gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
Packit Service 2723c6
  for w in $ws; do
Packit Service 2723c6
    gl_WARN_ADD([$w])
Packit Service 2723c6
  done
Packit Service 2723c6
  gl_WARN_ADD([-Wno-sign-compare])     # Too many warnings for now
Packit Service 2723c6
  gl_WARN_ADD([-Wno-type-limits])      # False alarms for portable code
Packit Service 2723c6
  gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
Packit Service 2723c6
  gl_WARN_ADD([-Wno-format-nonliteral])
Packit Service 2723c6
Packit Service 2723c6
  # Enable this warning only with gcc-4.8 and newer.  Before that
Packit Service 2723c6
  # bounds checking as done in truncate.c was incorrectly flagged.
Packit Service 2723c6
  # See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43772
Packit Service 2723c6
  gl_GCC_VERSION_IFELSE([4], [8], [gl_WARN_ADD([-Wlogical-op])])
Packit Service 2723c6
Packit Service 2723c6
  # clang is unduly picky about some things.
Packit Service 2723c6
  AC_CACHE_CHECK([whether the compiler is clang], [utils_cv_clang],
Packit Service 2723c6
    [AC_COMPILE_IFELSE(
Packit Service 2723c6
       [AC_LANG_PROGRAM([[
Packit Service 2723c6
            #ifndef __clang__
Packit Service 2723c6
              #error "not clang"
Packit Service 2723c6
            #endif
Packit Service 2723c6
          ]])],
Packit Service 2723c6
       [utils_cv_clang=yes],
Packit Service 2723c6
       [utils_cv_clang=no])])
Packit Service 2723c6
  if test $utils_cv_clang = yes; then
Packit Service 2723c6
    gl_WARN_ADD([-Wno-format-extra-args])
Packit Service 2723c6
    gl_WARN_ADD([-Wno-tautological-constant-out-of-range-compare])
Packit Service 2723c6
  fi
Packit Service 2723c6
Packit Service 2723c6
  gl_WARN_ADD([-fdiagnostics-show-option])
Packit Service 2723c6
  gl_WARN_ADD([-funit-at-a-time])
Packit Service 2723c6
Packit Service 2723c6
  AC_SUBST([WARN_CFLAGS])
Packit Service 2723c6
Packit Service 2723c6
  AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
Packit Service 2723c6
  AH_VERBATIM([FORTIFY_SOURCE],
Packit Service 2723c6
  [/* Enable compile-time and run-time bounds-checking, and some warnings,
Packit Service 2723c6
      without upsetting glibc 2.15+. */
Packit Service 2723c6
   #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
Packit Service 2723c6
   # define _FORTIFY_SOURCE 2
Packit Service 2723c6
   #endif
Packit Service 2723c6
  ])
Packit Service 2723c6
  AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
Packit Service 2723c6
Packit Service 2723c6
  # We use a slightly smaller set of warning options for lib/.
Packit Service 2723c6
  # Remove the following and save the result in GNULIB_WARN_CFLAGS.
Packit Service 2723c6
  nw=
Packit Service 2723c6
  nw="$nw -Wduplicated-branches"    # Too many false alarms
Packit Service 2723c6
  nw="$nw -Wformat-truncation=2"
Packit Service 2723c6
  nw="$nw -Wstrict-overflow"
Packit Service 2723c6
  nw="$nw -Wuninitialized"
Packit Service 2723c6
  nw="$nw -Wunused-macros"
Packit Service 2723c6
  nw="$nw -Wmissing-prototypes"
Packit Service 2723c6
  nw="$nw -Wold-style-definition"
Packit Service 2723c6
  # FIXME: it may be easy to remove this, since it affects only one file:
Packit Service 2723c6
  # the snprintf call at ftoastr.c:132.
Packit Service 2723c6
  nw="$nw -Wdouble-promotion"
Packit Service 2723c6
  gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
Packit Service 2723c6
  AC_SUBST([GNULIB_WARN_CFLAGS])
Packit Service 2723c6
Packit Service 2723c6
  # For gnulib-tests, the set is slightly smaller still.
Packit Service 2723c6
  nw=
Packit Service 2723c6
  nw="$nw -Wstrict-prototypes"
Packit Service 2723c6
  # It's not worth being this picky about test programs.
Packit Service 2723c6
  nw="$nw -Wsuggest-attribute=const"
Packit Service 2723c6
  nw="$nw -Wsuggest-attribute=pure"
Packit Service 2723c6
  gl_MANYWARN_COMPLEMENT([GNULIB_TEST_WARN_CFLAGS],
Packit Service 2723c6
                         [$GNULIB_WARN_CFLAGS], [$nw])
Packit Service 2723c6
  AC_SUBST([GNULIB_TEST_WARN_CFLAGS])
Packit Service 2723c6
fi
Packit Service 2723c6
Packit Service 2723c6
AC_ARG_ENABLE([single-binary],
Packit Service 2723c6
  [AS_HELP_STRING([--enable-single-binary=[shebangs|symlinks]],
Packit Service 2723c6
     [Compile all the tools in a single binary, reducing the overall size.
Packit Service 2723c6
      When compiled this way, shebangs (default when enabled) or symlinks are
Packit Service 2723c6
      installed for each tool that points to the single binary.])],
Packit Service 2723c6
  [gl_single_binary=no ;
Packit Service 2723c6
   case $enableval in
Packit Service 2723c6
     yes) gl_single_binary=shebangs ;;
Packit Service 2723c6
     no|shebangs|symlinks) gl_single_binary=$enableval ;;
Packit Service 2723c6
     *)      AC_MSG_ERROR([bad value $enableval for single-binary option.
Packit Service 2723c6
                           Options are: symlinks, shebangs, no.]) ;;
Packit Service 2723c6
   esac],
Packit Service 2723c6
  [gl_single_binary=no]
Packit Service 2723c6
)
Packit Service 2723c6
AC_ARG_ENABLE([single-binary-exceptions],
Packit Service 2723c6
  [AS_HELP_STRING([--enable-single-binary-exceptions=PROG_LIST],
Packit Service 2723c6
     [When used with --enable-single-binary, exclude the PROG_LIST from
Packit Service 2723c6
      it, so these programs are compiled as separated files
Packit Service 2723c6
      (comma-separated, default none))])],
Packit Service 2723c6
  [gl_single_binary_exceptions=$enableval],
Packit Service 2723c6
  [gl_single_binary_exceptions=]
Packit Service 2723c6
)
Packit Service 2723c6
if test "$gl_single_binary" = 'symlinks'; then
Packit Service 2723c6
  if ! test "`echo ls | sed \"$program_transform_name\"`" = 'ls'; then
Packit Service 2723c6
    AC_MSG_ERROR([program name transformations are not currently supported
Packit Service 2723c6
                  with --enable-single-binary=symlinks.])
Packit Service 2723c6
  fi
Packit Service 2723c6
fi
Packit Service 2723c6
AM_CONDITIONAL([SINGLE_BINARY], [test "$gl_single_binary" != no])
Packit Service 2723c6
Packit Service 2723c6
AC_FUNC_FORK
Packit Service 2723c6
Packit Service 2723c6
optional_bin_progs=
Packit Service 2723c6
AC_CHECK_FUNCS([chroot],
Packit Service 2723c6
        gl_ADD_PROG([optional_bin_progs], [chroot]))
Packit Service 2723c6
AC_CHECK_FUNCS([gethostid],
Packit Service 2723c6
        gl_ADD_PROG([optional_bin_progs], [hostid]))
Packit Service 2723c6
AC_CHECK_FUNCS([sigsuspend],
Packit Service 2723c6
        gl_ADD_PROG([optional_bin_progs], [timeout]))
Packit Service 2723c6
Packit Service 2723c6
gl_WINSIZE_IN_PTEM
Packit Service 2723c6
Packit Service 2723c6
AC_MSG_CHECKING([whether localtime caches TZ])
Packit Service 2723c6
AC_CACHE_VAL([utils_cv_localtime_cache],
Packit Service 2723c6
[if test x$ac_cv_func_tzset = xyes; then
Packit Service 2723c6
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <time.h>
Packit Service 2723c6
#if STDC_HEADERS
Packit Service 2723c6
# include <stdlib.h>
Packit Service 2723c6
#endif
Packit Service 2723c6
extern char **environ;
Packit Service 2723c6
void unset_TZ (void)
Packit Service 2723c6
{
Packit Service 2723c6
  char **from, **to;
Packit Service 2723c6
  for (to = from = environ; (*to = *from); from++)
Packit Service 2723c6
    if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
Packit Service 2723c6
      to++;
Packit Service 2723c6
}
Packit Service 2723c6
int main()
Packit Service 2723c6
{
Packit Service 2723c6
  time_t now = time ((time_t *) 0);
Packit Service 2723c6
  int hour_GMT0, hour_unset;
Packit Service 2723c6
  if (putenv ("TZ=GMT0") != 0)
Packit Service 2723c6
    return 1;
Packit Service 2723c6
  hour_GMT0 = localtime (&now)->tm_hour;
Packit Service 2723c6
  unset_TZ ();
Packit Service 2723c6
  hour_unset = localtime (&now)->tm_hour;
Packit Service 2723c6
  if (putenv ("TZ=PST8") != 0)
Packit Service 2723c6
    return 1;
Packit Service 2723c6
  if (localtime (&now)->tm_hour == hour_GMT0)
Packit Service 2723c6
    return 1;
Packit Service 2723c6
  unset_TZ ();
Packit Service 2723c6
  if (localtime (&now)->tm_hour != hour_unset)
Packit Service 2723c6
    return 1;
Packit Service 2723c6
  return 0;
Packit Service 2723c6
}]])],
Packit Service 2723c6
[utils_cv_localtime_cache=no],
Packit Service 2723c6
[utils_cv_localtime_cache=yes],
Packit Service 2723c6
[# If we have tzset, assume the worst when cross-compiling.
Packit Service 2723c6
utils_cv_localtime_cache=yes])
Packit Service 2723c6
else
Packit Service 2723c6
        # If we lack tzset, report that localtime does not cache TZ,
Packit Service 2723c6
        # since we can't invalidate the cache if we don't have tzset.
Packit Service 2723c6
        utils_cv_localtime_cache=no
Packit Service 2723c6
fi])dnl
Packit Service 2723c6
AC_MSG_RESULT([$utils_cv_localtime_cache])
Packit Service 2723c6
if test $utils_cv_localtime_cache = yes; then
Packit Service 2723c6
  AC_DEFINE([LOCALTIME_CACHE], [1], [FIXME])
Packit Service 2723c6
fi
Packit Service 2723c6
Packit Service 2723c6
# Assume that if getattrat exists, it's compatible with Solaris 11.
Packit Service 2723c6
AC_CHECK_FUNCS([getattrat])
Packit Service 2723c6
if test $ac_cv_func_getattrat = yes; then
Packit Service 2723c6
  LIB_NVPAIR=-lnvpair
Packit Service 2723c6
  AC_SUBST([LIB_NVPAIR])
Packit Service 2723c6
fi
Packit Service 2723c6
Packit Service 2723c6
# SCO-ODT-3.0 is reported to need -los to link programs using initgroups
Packit Service 2723c6
AC_CHECK_FUNCS([initgroups])
Packit Service 2723c6
if test $ac_cv_func_initgroups = no; then
Packit Service 2723c6
  AC_CHECK_LIB([os], [initgroups])
Packit Service 2723c6
fi
Packit Service 2723c6
Packit Service 2723c6
AC_CHECK_FUNCS([syslog])
Packit Service 2723c6
if test $ac_cv_func_syslog = no; then
Packit Service 2723c6
  # syslog is not in the default libraries.  See if it's in some other.
Packit Service 2723c6
  for lib in bsd socket inet; do
Packit Service 2723c6
    AC_CHECK_LIB([$lib], [syslog], [AC_DEFINE([HAVE_SYSLOG], [1], [FIXME])
Packit Service 2723c6
      LIBS="$LIBS -l$lib"; break])
Packit Service 2723c6
  done
Packit Service 2723c6
fi
Packit Service 2723c6
Packit Service 2723c6
AC_CACHE_CHECK([for 3-argument setpriority function],
Packit Service 2723c6
  [utils_cv_func_setpriority],
Packit Service 2723c6
  [AC_LINK_IFELSE(
Packit Service 2723c6
    [AC_LANG_PROGRAM(
Packit Service 2723c6
       [[#include <sys/time.h>
Packit Service 2723c6
         #include <sys/resource.h>
Packit Service 2723c6
       ]],
Packit Service 2723c6
       [[setpriority (0, 0, 0);]])],
Packit Service 2723c6
    [utils_cv_func_setpriority=yes],
Packit Service 2723c6
    [utils_cv_func_setpriority=no])])
Packit Service 2723c6
if test $utils_cv_func_setpriority = no; then
Packit Service 2723c6
  AC_CHECK_FUNCS([nice])
Packit Service 2723c6
fi
Packit Service 2723c6
case $utils_cv_func_setpriority,$ac_cv_func_nice in
Packit Service 2723c6
*yes*)
Packit Service 2723c6
  gl_ADD_PROG([optional_bin_progs], [nice])
Packit Service 2723c6
esac
Packit Service 2723c6
Packit Service 2723c6
AC_DEFUN([coreutils_DUMMY_1],
Packit Service 2723c6
[
Packit Service 2723c6
  AC_REQUIRE([gl_READUTMP])
Packit Service 2723c6
  if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then
Packit Service 2723c6
    gl_ADD_PROG([optional_bin_progs], [who])
Packit Service 2723c6
    gl_ADD_PROG([optional_bin_progs], [users])
Packit Service 2723c6
    gl_ADD_PROG([optional_bin_progs], [pinky])
Packit Service 2723c6
  fi
Packit Service 2723c6
])
Packit Service 2723c6
coreutils_DUMMY_1
Packit Service 2723c6
Packit Service 2723c6
AC_MSG_CHECKING([ut_host in struct utmp])
Packit Service 2723c6
AC_CACHE_VAL([su_cv_func_ut_host_in_utmp],
Packit Service 2723c6
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
Packit Service 2723c6
                                   #include <utmp.h>
Packit Service 2723c6
                                   struct utmp ut;
Packit Service 2723c6
                                   int s = sizeof ut.ut_host;]])],
Packit Service 2723c6
  [su_cv_func_ut_host_in_utmp=yes],
Packit Service 2723c6
  [su_cv_func_ut_host_in_utmp=no])])
Packit Service 2723c6
AC_MSG_RESULT([$su_cv_func_ut_host_in_utmp])
Packit Service 2723c6
if test $su_cv_func_ut_host_in_utmp = yes; then
Packit Service 2723c6
  have_ut_host=1
Packit Service 2723c6
  AC_DEFINE([HAVE_UT_HOST], [1], [FIXME])
Packit Service 2723c6
fi
Packit Service 2723c6
Packit Service 2723c6
if test -z "$have_ut_host"; then
Packit Service 2723c6
  AC_MSG_CHECKING([ut_host in struct utmpx])
Packit Service 2723c6
  AC_CACHE_VAL([su_cv_func_ut_host_in_utmpx],
Packit Service 2723c6
  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
Packit Service 2723c6
                                     #include <utmpx.h>
Packit Service 2723c6
                                     struct utmpx ut;
Packit Service 2723c6
                                     int s = sizeof ut.ut_host;]])],
Packit Service 2723c6
    [su_cv_func_ut_host_in_utmpx=yes],
Packit Service 2723c6
    [su_cv_func_ut_host_in_utmpx=no])])
Packit Service 2723c6
  AC_MSG_RESULT([$su_cv_func_ut_host_in_utmpx])
Packit Service 2723c6
  if test $su_cv_func_ut_host_in_utmpx = yes; then
Packit Service 2723c6
    AC_DEFINE([HAVE_UTMPX_H], [1], [FIXME])
Packit Service 2723c6
    AC_DEFINE([HAVE_UT_HOST], [1], [FIXME])
Packit Service 2723c6
  fi
Packit Service 2723c6
fi
Packit Service 2723c6
Packit Service 2723c6
GNULIB_BOOT_TIME([gl_ADD_PROG([optional_bin_progs], [uptime])])
Packit Service 2723c6
Packit Service 2723c6
AC_SYS_POSIX_TERMIOS()
Packit Service 2723c6
gl_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL
Packit Service 2723c6
Packit Service 2723c6
if test $ac_cv_sys_posix_termios = yes; then
Packit Service 2723c6
  gl_ADD_PROG([optional_bin_progs], [stty])
Packit Service 2723c6
Packit Service 2723c6
  AC_MSG_CHECKING([whether termios.h needs _XOPEN_SOURCE])
Packit Service 2723c6
  AC_CACHE_VAL([su_cv_sys_termios_needs_xopen_source],
Packit Service 2723c6
  [AC_EGREP_CPP([yes], [#include <termios.h>
Packit Service 2723c6
#ifdef IUCLC
Packit Service 2723c6
yes
Packit Service 2723c6
#endif], su_cv_sys_termios_needs_xopen_source=no,
Packit Service 2723c6
   AC_EGREP_CPP([yes], [#define _XOPEN_SOURCE
Packit Service 2723c6
#include <termios.h>
Packit Service 2723c6
#ifdef IUCLC
Packit Service 2723c6
yes
Packit Service 2723c6
#endif], su_cv_sys_termios_needs_xopen_source=yes,
Packit Service 2723c6
   su_cv_sys_termios_needs_xopen_source=no))])
Packit Service 2723c6
  AC_MSG_RESULT([$su_cv_sys_termios_needs_xopen_source])
Packit Service 2723c6
  test $su_cv_sys_termios_needs_xopen_source = yes &&
Packit Service 2723c6
    AC_DEFINE([TERMIOS_NEEDS_XOPEN_SOURCE], [1], [FIXME])
Packit Service 2723c6
Packit Service 2723c6
  AC_MSG_CHECKING([c_line in struct termios])
Packit Service 2723c6
  AC_CACHE_VAL([su_cv_sys_c_line_in_termios],
Packit Service 2723c6
  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if TERMIOS_NEEDS_XOPEN_SOURCE
Packit Service 2723c6
                                      #define _XOPEN_SOURCE
Packit Service 2723c6
                                     #endif
Packit Service 2723c6
                                     #include <sys/types.h>
Packit Service 2723c6
                                     #include <termios.h>
Packit Service 2723c6
                                     struct termios t;
Packit Service 2723c6
                                     int s = sizeof t.c_line;]])],
Packit Service 2723c6
    [su_cv_sys_c_line_in_termios=yes],
Packit Service 2723c6
    [su_cv_sys_c_line_in_termios=no])])
Packit Service 2723c6
  AC_MSG_RESULT([$su_cv_sys_c_line_in_termios])
Packit Service 2723c6
  test $su_cv_sys_c_line_in_termios = yes \
Packit Service 2723c6
    && AC_DEFINE([HAVE_C_LINE], [1], [FIXME])
Packit Service 2723c6
fi
Packit Service 2723c6
Packit Service 2723c6
# FIXME: note that this macro appears above, too.
Packit Service 2723c6
# I'm leaving it here for now.  This whole thing needs to be modernized...
Packit Service 2723c6
gl_WINSIZE_IN_PTEM
Packit Service 2723c6
Packit Service 2723c6
gl_MBFILE
Packit Service 2723c6
Packit Service 2723c6
gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H
Packit Service 2723c6
Packit Service 2723c6
if test $gl_cv_sys_tiocgwinsz_needs_termios_h = no && \
Packit Service 2723c6
   test $gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h = no; then
Packit Service 2723c6
  AC_MSG_CHECKING([TIOCGWINSZ in sys/pty.h])
Packit Service 2723c6
  AC_CACHE_VAL([su_cv_sys_tiocgwinsz_in_sys_pty_h],
Packit Service 2723c6
  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
Packit Service 2723c6
#ifdef WINSIZE_IN_PTEM
Packit Service 2723c6
# include <sys/stream.h>
Packit Service 2723c6
# include <sys/ptem.h>
Packit Service 2723c6
#endif
Packit Service 2723c6
#include <sys/ioctl.h>
Packit Service 2723c6
#include <sys/tty.h>
Packit Service 2723c6
#include <sys/pty.h>]], [[int x = TIOCGWINSZ;]])],
Packit Service 2723c6
    [su_cv_sys_tiocgwinsz_in_sys_pty_h=yes],
Packit Service 2723c6
    [su_cv_sys_tiocgwinsz_in_sys_pty_h=no])])
Packit Service 2723c6
  AC_MSG_RESULT([$su_cv_sys_tiocgwinsz_in_sys_pty_h])
Packit Service 2723c6
Packit Service 2723c6
  test $su_cv_sys_tiocgwinsz_in_sys_pty_h = yes \
Packit Service 2723c6
      && AC_DEFINE([GWINSZ_IN_SYS_PTY], [1],
Packit Service 2723c6
                   [Define if your system defines TIOCGWINSZ in sys/pty.h.])
Packit Service 2723c6
fi
Packit Service 2723c6
Packit Service 2723c6
# For src/kill.c.
Packit Service 2723c6
AC_CHECK_DECLS([strsignal, sys_siglist, _sys_siglist, __sys_siglist], , ,
Packit Service 2723c6
  [AC_INCLUDES_DEFAULT
Packit Service 2723c6
#include <signal.h>])
Packit Service 2723c6
Packit Service 2723c6
cu_GMP
Packit Service 2723c6
Packit Service 2723c6
# Build df only if there's a point to it.
Packit Service 2723c6
if test $gl_cv_list_mounted_fs = yes && test $gl_cv_fs_space = yes; then
Packit Service 2723c6
  gl_ADD_PROG([optional_bin_progs], [df])
Packit Service 2723c6
fi
Packit Service 2723c6
Packit Service 2723c6
# Build stdbuf only if supported
Packit Service 2723c6
ac_save_CFLAGS=$CFLAGS
Packit Service 2723c6
ac_save_LDFLAGS=$LDFLAGS
Packit Service 2723c6
# Detect warnings about ignored "constructor" attributes.
Packit Service 2723c6
gl_WARN_ADD([-Werror], [CFLAGS])
Packit Service 2723c6
gl_WARN_ADD([-errwarn], [CFLAGS])
Packit Service 2723c6
# Put this message here, after gl_WARN_ADD's chatter.
Packit Service 2723c6
AC_MSG_CHECKING([whether this system supports stdbuf])
Packit Service 2723c6
CFLAGS="-fPIC $CFLAGS"
Packit Service 2723c6
LDFLAGS="-shared $LDFLAGS"
Packit Service 2723c6
stdbuf_supported=no
Packit Service 2723c6
# Note we only LINK here rather than RUN to support cross compilation
Packit Service 2723c6
AC_LINK_IFELSE(
Packit Service 2723c6
  [AC_LANG_PROGRAM([[
Packit Service 2723c6
    static int stdbuf = 0;
Packit Service 2723c6
Packit Service 2723c6
    void __attribute__ ((constructor))
Packit Service 2723c6
    stdbuf_init (void)
Packit Service 2723c6
    {
Packit Service 2723c6
      stdbuf = 1;
Packit Service 2723c6
    }]],[[
Packit Service 2723c6
    if (stdbuf != 1)
Packit Service 2723c6
      return 1;]])
Packit Service 2723c6
  ],
Packit Service 2723c6
  [stdbuf_supported=yes])
Packit Service 2723c6
AC_MSG_RESULT([$stdbuf_supported])
Packit Service 2723c6
if test "$stdbuf_supported" = "yes" && test -z "$EXEEXT"; then
Packit Service 2723c6
  gl_ADD_PROG([optional_bin_progs], [stdbuf])
Packit Service 2723c6
fi
Packit Service 2723c6
CFLAGS=$ac_save_CFLAGS
Packit Service 2723c6
LDFLAGS=$ac_save_LDFLAGS
Packit Service 2723c6
Packit Service 2723c6
# Detect when using xlc to determine whether to use -qinclude=
Packit Service 2723c6
AC_CACHE_CHECK([whether the system supports xlc include], [utils_cv_xlc],
Packit Service 2723c6
  [AC_COMPILE_IFELSE(
Packit Service 2723c6
     [AC_LANG_PROGRAM([[
Packit Service 2723c6
          #ifndef __xlc__
Packit Service 2723c6
            #error "not xlc"
Packit Service 2723c6
          #endif
Packit Service 2723c6
        ]])],
Packit Service 2723c6
     [utils_cv_xlc=yes],
Packit Service 2723c6
     [utils_cv_xlc=no])])
Packit Service 2723c6
AM_CONDITIONAL([USE_XLC_INCLUDE], [test "$utils_cv_xlc" = yes])
Packit Service 2723c6
Packit Service 2723c6
############################################################################
Packit Service 2723c6
Packit Service 2723c6
dnl Autogenerated by the 'gen-lists-of-programs.sh' auxiliary script.
Packit Service 2723c6
dnl Issue proper calls to the macros gl_INCLUDE_EXCLUDE_PROG and
Packit Service 2723c6
dnl gl_ADD_PROG (updating $optional_bin_progs), and generate the list
Packit Service 2723c6
dnl of coreutils programs to be built only upon explicit user request,
Packit Service 2723c6
dnl saving that list in the $no_install_progs_default shell variable.
Packit Service 2723c6
m4_include([m4/cu-progs.m4])
Packit Service 2723c6
Packit Service 2723c6
# Now that we know which programs will actually be built, determine
Packit Service 2723c6
# which optional helper progs should be compiled.
Packit Service 2723c6
# Note it adding to pkglibexec_PROGRAMS, $(transform) in src/local.mk
Packit Service 2723c6
# may need to be updated accordingly.
Packit Service 2723c6
case " $optional_bin_progs " in
Packit Service 2723c6
  *' stdbuf '*) pkglibexec_PROGRAMS='src/libstdbuf.so';;
Packit Service 2723c6
  *) pkglibexec_PROGRAMS='';;
Packit Service 2723c6
esac
Packit Service 2723c6
Packit Service 2723c6
man1_MANS=`
Packit Service 2723c6
  for p in $optional_bin_progs; do
Packit Service 2723c6
    # Change "ginstall.1" to "install.1".
Packit Service 2723c6
    test $p = ginstall && p=install
Packit Service 2723c6
    # Ignore the "[" program, since writing a portable make rule to
Packit Service 2723c6
    # generate its manpage is not practical.
Packit Service 2723c6
    dnl Use the autoconf-provided quadrigraph to represent "[",
Packit Service 2723c6
    dnl otherwise we will incur in dreadful quoting issues.
Packit Service 2723c6
    test x$p = x'@<:@' && continue
Packit Service 2723c6
    echo "man/$p.1"
Packit Service 2723c6
  done`
Packit Service 2723c6
Packit Service 2723c6
# Not installed by "make install", but must be built when creating
Packit Service 2723c6
# a distribution tarball.
Packit Service 2723c6
EXTRA_MANS=`for p in $no_install_progs_default $gl_no_install_prog; do
Packit Service 2723c6
              echo man/$p.1
Packit Service 2723c6
            done`
Packit Service 2723c6
Packit Service 2723c6
# Replace all the programs by the single binary and symlinks if specified.
Packit Service 2723c6
single_binary_progs=
Packit Service 2723c6
single_binary_libs=
Packit Service 2723c6
single_binary_deps=
Packit Service 2723c6
single_binary_install_type=
Packit Service 2723c6
if test "$gl_single_binary" != no; then
Packit Service 2723c6
  man1_MANS="$man1_MANS man/coreutils.1"
Packit Service 2723c6
  # Convert the list to a space separated list
Packit Service 2723c6
  gl_single_binary_exceptions=`echo $gl_single_binary_exceptions | tr ',' ' '`
Packit Service 2723c6
Packit Service 2723c6
  single_binary_progs=`echo $optional_bin_progs`
Packit Service 2723c6
  optional_bin_progs="coreutils"
Packit Service 2723c6
  for prog in $gl_single_binary_exceptions; do
Packit Service 2723c6
    # Fail if requested to exclude a program than was not part of coreutils.
Packit Service 2723c6
    case " $single_binary_progs " in
Packit Service 2723c6
      *" $prog "*)
Packit Service 2723c6
        gl_REMOVE_PROG([single_binary_progs], [$prog]) ;
Packit Service 2723c6
        gl_ADD_PROG([optional_bin_progs], [$prog]) ;;
Packit Service 2723c6
      *) AC_MSG_ERROR(['$prog' is not being compiled.]) ;;
Packit Service 2723c6
    esac
Packit Service 2723c6
  done
Packit Service 2723c6
Packit Service 2723c6
  # single_binary_libs holds the list of libs required by the selected
Packit Service 2723c6
  # programs, such as for example -lrt.
Packit Service 2723c6
  single_binary_libs=`
Packit Service 2723c6
    for p in $single_binary_progs; do
Packit Service 2723c6
      # Convert '[' to '_'
Packit Service 2723c6
      test x"$p" = x'@<:@' && p='_'
Packit Service 2723c6
      printf '$(src_libsinglebin_%s_a_ldadd) ' "$p"
Packit Service 2723c6
    done`
Packit Service 2723c6
  # single_binary_deps holds the list of libsinglebin_*.a files that have the
Packit Service 2723c6
  # compiled code of each selected program in a "library" format.
Packit Service 2723c6
  single_binary_deps=`
Packit Service 2723c6
    for p in $single_binary_progs; do
Packit Service 2723c6
      # Convert '[' to '_'
Packit Service 2723c6
      test x"$p" = x'@<:@' && p='_'
Packit Service 2723c6
      printf 'src/libsinglebin_%s.a ' "$p"
Packit Service 2723c6
    done`
Packit Service 2723c6
  single_binary_install_type="$gl_single_binary"
Packit Service 2723c6
fi
Packit Service 2723c6
AC_SUBST([single_binary_progs], [$single_binary_progs])
Packit Service 2723c6
AC_SUBST([single_binary_libs], [$single_binary_libs])
Packit Service 2723c6
AC_SUBST([single_binary_deps], [$single_binary_deps])
Packit Service 2723c6
AC_SUBST([single_binary_install_type], [$single_binary_install_type])
Packit Service 2723c6
Packit Service 2723c6
Packit Service 2723c6
# The programs built and installed by "make && make install".
Packit Service 2723c6
# Since this is AC_SUBST'd, Automake won't be able to perform rewrite
Packit Service 2723c6
# with $(EXEEXT) appending on it, so we have to do it ourselves -- in
Packit Service 2723c6
# this case, only for $(bin_PROGRAMS).
Packit Service 2723c6
bin_PROGRAMS=`
Packit Service 2723c6
  for p in $optional_bin_progs; do echo src/"$p"'$(EXEEXT)'; done`
Packit Service 2723c6
Packit Service 2723c6
# Normalize whitespace.
Packit Service 2723c6
man1_MANS=`echo $man1_MANS`
Packit Service 2723c6
EXTRA_MANS=`echo $EXTRA_MANS`
Packit Service 2723c6
bin_PROGRAMS=`echo $bin_PROGRAMS`
Packit Service 2723c6
pkglibexec_PROGS=`echo $pkglibexec_PROGRAMS`
Packit Service 2723c6
Packit Service 2723c6
AC_SUBST([bin_PROGRAMS])        AM_SUBST_NOTMAKE([bin_PROGRAMS])
Packit Service 2723c6
AC_SUBST([pkglibexec_PROGRAMS]) AM_SUBST_NOTMAKE([pkglibexec_PROGRAMS])
Packit Service 2723c6
AC_SUBST([man1_MANS])           AM_SUBST_NOTMAKE([man1_MANS])
Packit Service 2723c6
AC_SUBST([EXTRA_MANS])          AM_SUBST_NOTMAKE([EXTRA_MANS])
Packit Service 2723c6
Packit Service 2723c6
AC_SUBST([built_programs], [$optional_bin_progs])
Packit Service 2723c6
Packit Service 2723c6
AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
Packit Service 2723c6
Packit Service 2723c6
############################################################################
Packit Service 2723c6
Packit Service 2723c6
# As long as "grep 'PRI[diouxX]' po/*.pot" reports matches in
Packit Service 2723c6
# translatable strings, we must use need-formatstring-macros here.
Packit Service 2723c6
AM_GNU_GETTEXT([external], [need-formatstring-macros])
Packit Service 2723c6
AM_GNU_GETTEXT_VERSION([0.19.2])
Packit Service 2723c6
Packit Service 2723c6
# For a test of uniq: it uses the $LOCALE_FR envvar.
Packit Service 2723c6
gt_LOCALE_FR
Packit Service 2723c6
Packit Service 2723c6
AC_CONFIG_FILES(
Packit Service 2723c6
  Makefile
Packit Service 2723c6
  po/Makefile.in
Packit Service 2723c6
  gnulib-tests/Makefile
Packit Service 2723c6
  )
Packit Service 2723c6
AC_OUTPUT