X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=configure.ac;fp=configure.ac;h=af6856fdac1274f2b89463babca6316d00cb1c2e;hb=d57728a6ca2413a7c564d8b7bb13d9e5a5a180f3;hp=4705ce4b386a68bfc2d730fc3ab0c77791a39905;hpb=dc84183747ce1703eb99685b5dbde1f65a143c06;p=debian%2Fgzip diff --git a/configure.ac b/configure.ac index 4705ce4..af6856f 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ # Configure template for gzip. -# Copyright (C) 1999-2002, 2006-2007, 2009-2012 Free Software Foundation, Inc. +# Copyright (C) 1999-2002, 2006-2007, 2009-2013 Free Software Foundation, Inc. # Copyright (C) 1992-1993 Jean-loup Gailly @@ -24,15 +24,31 @@ AC_INIT([gzip], m4_esyscmd([build-aux/git-version-gen .tarball-version]), [bug-gzip@gnu.org]) -AC_CONFIG_SRCDIR(gzip.c) -AC_CONFIG_AUX_DIR(build-aux) +AC_CONFIG_SRCDIR([gzip.c]) +AC_CONFIG_AUX_DIR([build-aux]) +AC_CONFIG_MACRO_DIR([m4]) 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 subdir-objects 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_PROG_GREP AC_CHECK_TOOL([NM], [nm], [nm]) AC_PROG_LN_S AC_PROG_RANLIB @@ -44,13 +60,35 @@ gl_INIT AC_ARG_ENABLE([gcc-warnings], [AS_HELP_STRING([--enable-gcc-warnings], - [turn on lots of GCC warnings (for developers)])], + [turn on many GCC warnings (for developers; best with GNU make)])], [case $enableval in yes|no) ;; *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;; esac gl_gcc_warnings=$enableval], - [gl_gcc_warnings=no] + [if test -d "$srcdir"/.git; then + gl_gcc_warnings=yes + else + gl_gcc_warnings=no + fi] +) + +# 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 @@ -85,26 +123,34 @@ if test "$gl_gcc_warnings" = yes; then 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 - # initial problems in gzip + + # Warnings that gzip runs afoul of but coreutils does not. nw="$nw -Wold-style-definition" nw="$nw -Wshadow" - nw="$nw -Wunused-macros" - # ?? -Wstrict-overflow + nw="$nw -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([-Wno-overflow]) # util.c - gl_WARN_ADD([-Wno-type-limits]) # util.c + gl_WARN_ADD([-Wsuggest-attribute=const]) + gl_WARN_ADD([-Wsuggest-attribute=noreturn]) gl_WARN_ADD([-Wno-format-nonliteral]) - gl_WARN_ADD([-Wno-unsuffixed-float-constants]) + + # 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 @@ -116,14 +162,21 @@ if test "$gl_gcc_warnings" = yes; then AC_SUBST([WARN_CFLAGS]) AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.]) - AC_DEFINE([_FORTIFY_SOURCE], [2], - [enable compile-time and run-time bounds-checking, and some warnings]) + AH_VERBATIM([FORTIFY_SOURCE], + [/* Enable compile-time and run-time bounds-checking, and some warnings, + without upsetting glibc 2.15+. */ + #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__ + # define _FORTIFY_SOURCE 2 + #endif + ]) 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" gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])