# -*- autoconf -*-
# Process this file with autoconf to produce a configure script.
-# Copyright (C) 1991, 1993-2009 Free Software Foundation, Inc.
+# Copyright (C) 1991-2012 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
dnl Written by Jim Meyering.
-AC_PREREQ([2.61])
+AC_PREREQ([2.64])
# Make inter-release version strings look like, e.g., v6.9-219-g58ddd, which
# indicates that it is built from the 219th delta (in _some_ repository)
# following the v6.9 tag, and that 58ddd is a prefix of the commit SHA1.
AC_INIT([GNU coreutils],
- m4_esyscmd([build-aux/git-version-gen .tarball-version]),
- [bug-coreutils@gnu.org])
+ m4_esyscmd([build-aux/git-version-gen .tarball-version]),
+ [bug-coreutils@gnu.org])
AC_CONFIG_SRCDIR([src/ls.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
-AM_INIT_AUTOMAKE([1.11 dist-xz color-tests parallel-tests])
+AM_INIT_AUTOMAKE([1.11.1 no-dist-gzip dist-xz color-tests parallel-tests])
AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
+dnl POSIXCHECK is worthwhile for maintainers, but adds several seconds
+dnl (more than 10% execution time) to ./configure, with no benefit for
+dnl most users. Using it to look for bugs requires:
+dnl GNULIB_POSIXCHECK=1 autoreconf -f
+dnl ./configure
+dnl make
+dnl make -C src clean
+dnl make CFLAGS=-DGNULIB_POSIXCHECK=1
+dnl FIXME: Once we figure out how to avoid false positives, we should
+dnl have 'make my-distcheck' in dist-check.mk exercise this.
+m4_syscmd([test "${GNULIB_POSIXCHECK+set}" = set])
+m4_if(m4_sysval, [0], [], [dnl
+gl_ASSERT_NO_GNULIB_POSIXCHECK])
+
AC_PROG_CC_STDC
AM_PROG_CC_C_O
AC_PROG_CPP
AC_ARG_ENABLE([gcc-warnings],
[AS_HELP_STRING([--enable-gcc-warnings],
- [turn on lots of GCC warnings (for developers)])],
+ [turn on lots of GCC warnings (for developers)])],
[case $enableval in
yes|no) ;;
*) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
[gl_gcc_warnings=no]
)
+# gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found])
+# ------------------------------------------------
+# If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND.
+# Otherwise, run RUN-IF-NOT-FOUND.
+AC_DEFUN([gl_GCC_VERSION_IFELSE],
+ [AC_PREPROC_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#if ($1) < __GNUC__ || (($1) == __GNUC__ && ($2) <= __GNUC_MINOR__)
+/* ok */
+#else
+# error "your version of gcc is older than $1.$2"
+#endif
+ ]]),
+ ], [$3], [$4])
+ ]
+)
+
if test "$gl_gcc_warnings" = yes; then
gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
AC_SUBST([WERROR_CFLAGS])
nw="$nw -Wnested-externs" # use of XARGMATCH/verify_function__
nw="$nw -Wswitch-enum" # Too many warnings for now
nw="$nw -Wswitch-default" # Too many warnings for now
+ nw="$nw -Wstack-protector" # not worth working around
# things I might fix soon:
nw="$nw -Wfloat-equal" # sort.c, seq.c
nw="$nw -Wmissing-format-attribute" # copy.c
nw="$nw -Wunsafe-loop-optimizations" # a few src/*.c
nw="$nw -Winline" # system.h's readdir_ignoring_dot_and_dotdot
- nw="$nw -Wstrict-overflow" # expr.c, pr.c, tr.c, factor.c
- # ?? -Wstrict-overflow
+
+ # Using -Wstrict-overflow is a pain, but the alternative is worse.
+ # For an example, see the code that provoked this report:
+ # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33498
+ # Code like that still infloops with gcc-4.6.0 and -O2. Scary indeed.
gl_MANYWARN_ALL_GCC([ws])
gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
for w in $ws; do
gl_WARN_ADD([$w])
done
- gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now
- gl_WARN_ADD([-Wno-pointer-sign]) # Too many warnings for now
gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
+ gl_WARN_ADD([-Wsuggest-attribute=const])
+ gl_WARN_ADD([-Wsuggest-attribute=noreturn])
+ gl_WARN_ADD([-Wno-format-nonliteral])
+
+ # Enable this warning only with gcc-4.7 and newer. With 4.6.2 20111027,
+ # it suggests test.c's advance function may be pure, even though it
+ # increments a global variable. Oops.
+ # Normally we'd write code to test for the precise failure, but that
+ # requires a relatively large input to make gcc exhibit the failure.
+ gl_GCC_VERSION_IFELSE([4], [7], [gl_WARN_ADD([-Wsuggest-attribute=pure])])
# In spite of excluding -Wlogical-op above, it is enabled, as of
# gcc 4.5.0 20090517, and it provokes warnings in cat.c, dd.c, truncate.c
gl_WARN_ADD([-Wno-logical-op])
gl_WARN_ADD([-fdiagnostics-show-option])
+ gl_WARN_ADD([-funit-at-a-time])
AC_SUBST([WARN_CFLAGS])
AC_DEFINE([_FORTIFY_SOURCE], [2],
[enable compile-time and run-time bounds-checking, and some warnings])
AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
+
+ # We use a slightly smaller set of warning options for lib/.
+ # Remove the following and save the result in GNULIB_WARN_CFLAGS.
+ nw=
+ nw="$nw -Wstrict-overflow"
+ nw="$nw -Wuninitialized"
+ nw="$nw -Wunused-macros"
+ nw="$nw -Wmissing-prototypes"
+ nw="$nw -Wold-style-definition"
+ # FIXME: it may be easy to remove this, since it affects only one file:
+ # the snprintf call at ftoastr.c:132.
+ nw="$nw -Wdouble-promotion"
+ gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
+ AC_SUBST([GNULIB_WARN_CFLAGS])
+
+ # For gnulib-tests, the set is slightly smaller still.
+ nw=
+ nw="$nw -Wstrict-prototypes"
+ # It's not worth being this picky about test programs.
+ nw="$nw -Wsuggest-attribute=const"
+ nw="$nw -Wsuggest-attribute=pure"
+ gl_MANYWARN_COMPLEMENT([GNULIB_TEST_WARN_CFLAGS],
+ [$GNULIB_WARN_CFLAGS], [$nw])
+ AC_SUBST([GNULIB_TEST_WARN_CFLAGS])
fi
AC_FUNC_FORK
optional_bin_progs=
-AC_CHECK_FUNCS([uname],
- gl_ADD_PROG([optional_bin_progs], [uname]))
AC_CHECK_FUNCS([chroot],
- gl_ADD_PROG([optional_bin_progs], [chroot]))
+ gl_ADD_PROG([optional_bin_progs], [chroot]))
AC_CHECK_FUNCS([gethostid],
- gl_ADD_PROG([optional_bin_progs], [hostid]))
+ gl_ADD_PROG([optional_bin_progs], [hostid]))
gl_WINSIZE_IN_PTEM
time_t now = time ((time_t *) 0);
int hour_GMT0, hour_unset;
if (putenv ("TZ=GMT0") != 0)
- exit (1);
+ return 1;
hour_GMT0 = localtime (&now)->tm_hour;
unset_TZ ();
hour_unset = localtime (&now)->tm_hour;
if (putenv ("TZ=PST8") != 0)
- exit (1);
+ return 1;
if (localtime (&now)->tm_hour == hour_GMT0)
- exit (1);
+ return 1;
unset_TZ ();
if (localtime (&now)->tm_hour != hour_unset)
- exit (1);
- exit (0);
+ return 1;
+ return 0;
}]])],
[utils_cv_localtime_cache=no],
[utils_cv_localtime_cache=yes],
[# If we have tzset, assume the worst when cross-compiling.
utils_cv_localtime_cache=yes])
else
- # If we lack tzset, report that localtime does not cache TZ,
- # since we can't invalidate the cache if we don't have tzset.
- utils_cv_localtime_cache=no
+ # If we lack tzset, report that localtime does not cache TZ,
+ # since we can't invalidate the cache if we don't have tzset.
+ utils_cv_localtime_cache=no
fi])dnl
AC_MSG_RESULT([$utils_cv_localtime_cache])
if test $utils_cv_localtime_cache = yes; then
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <sys/time.h>
- #include <sys/resource.h>
+ #include <sys/resource.h>
]],
[[setpriority (0, 0, 0);]])],
[utils_cv_func_setpriority=yes],
fi
# Limit stdbuf to ELF systems with GCC
-optional_pkglib_progs=
AC_MSG_CHECKING([whether this is an ELF system])
AC_EGREP_CPP([yes], [#if __ELF__
yes
if test "$elf_sys" = "yes" && \
test "$GCC" = "yes"; then
gl_ADD_PROG([optional_bin_progs], [stdbuf])
- gl_ADD_PROG([optional_pkglib_progs], [libstdbuf.so])
fi
############################################################################
$no_install_progs_default) ;;
*) AC_MSG_ERROR([[internal error: g'l_INCLUDE_EXCLUDE_PROG's 2nd arg, $t,
does not match the list of default-not-installed programs
- ($no_install_progs_default) also recorded in $mk]],
- 1) ;;
+ ($no_install_progs_default) also recorded in $mk]],
+ 1) ;;
esac
# Given the name of a variable containing a space-separated list of
# corresponding ./configure option argument is comma-separated on input.
gl_INCLUDE_EXCLUDE_PROG([optional_bin_progs], [arch,hostname,su])
+# Now that we know which programs will actually be built up, figure out
+# which optional helper progs should be compiled.
+optional_pkglib_progs=
+case " $optional_bin_progs " in
+ *' stdbuf '*) gl_ADD_PROG([optional_pkglib_progs], [libstdbuf.so]) ;;
+esac
+
# Set INSTALL_SU if su installation has been requested via
# --enable-install-program=su.
AC_SUBST([INSTALL_SU])
MAN=`echo "$optional_bin_progs "|sed 's/ /.1 /g;s/ $//'|tr -d '\\015\\012'`
-# Change ginstall.1 to "install.h" in $MAN.
+# Change "ginstall.1" to "install.1" in $MAN.
MAN=`for m in $MAN; do test $m = ginstall.1 && m=install.1; echo $m; done \
| tr '\015\012' ' '; echo`
AC_SUBST([CONFIG_STATUS_DEPENDENCIES])
############################################################################
+# As long as "grep 'PRI[diouxX]' po/*.pot" reports matches in
+# translatable strings, we must use need-formatstring-macros here.
AM_GNU_GETTEXT([external], [need-formatstring-macros])
-AM_GNU_GETTEXT_VERSION([0.15])
+AM_GNU_GETTEXT_VERSION([0.18.1])
# For a test of uniq: it uses the $LOCALE_FR envvar.
gt_LOCALE_FR