dnl dnl autoconf input file for ``GNU grep'' dnl dnl Copyright (C) 1997-2006, 2009-2010 Free Software Foundation, Inc. dnl dnl This file is part of GNU grep. dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 3, or (at your option) dnl any later version. dnl dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program. If not, see . AC_INIT([GNU grep], m4_esyscmd([build-aux/git-version-gen .tarball-version]), [bug-grep@gnu.org]) AC_CONFIG_AUX_DIR(build-aux) AC_CONFIG_SRCDIR(src/grep.c) AC_DEFINE(GREP, 1, [We are building grep]) AC_PREREQ(2.59) dnl Automake stuff. AM_INIT_AUTOMAKE([1.11 dist-xz color-tests parallel-tests]) AM_SILENT_RULES([yes]) # make --enable-silent-rules the default. AC_CONFIG_HEADERS([config.h:config.hin]) dnl Check for arguments AC_ARG_ENABLE(perl-regexp, [ --disable-perl-regexp disable perl-regexp], [case "${enableval}" in yes) testpcre=yes ;; no) testpcre=no ;; *) AC_MSG_ERROR(bad value ${enableval} for --disable-perl-regexp) ;; esac],[testpcre=yes]) dnl Checks for programs. AC_CANONICAL_HOST AC_PROG_AWK AC_PROG_INSTALL AC_PROG_CC gl_EARLY AC_PROG_RANLIB dnl Checks for typedefs, structures, and compiler characteristics. AC_SYS_LARGEFILE AC_TYPE_SIZE_T AC_C_CONST gl_INIT AC_ARG_ENABLE([gcc-warnings], [AS_HELP_STRING([--enable-gcc-warnings], [turn on lots of GCC warnings (for developers)])], [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 "$gl_gcc_warnings" = yes; then gl_WARN_ADD([-Werror], [WERROR_CFLAGS]) AC_SUBST([WERROR_CFLAGS]) nw= # This, $nw, is the list of warnings we disable. nw="$nw -Wdeclaration-after-statement" # too useful to forbid nw="$nw -Waggregate-return" # anachronistic nw="$nw -Wlong-long" # C90 is anachronistic (lib/gethrxtime.h) nw="$nw -Wc++-compat" # We don't care about C++ compilers nw="$nw -Wundef" # Warns on '#if GNULIB_FOO' etc in gnulib nw="$nw -Wtraditional" # Warns on #elif which we use often nw="$nw -Wcast-qual" # Too many warnings for now nw="$nw -Wconversion" # Too many warnings for now nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings nw="$nw -Wsign-conversion" # Too many warnings for now nw="$nw -Wtraditional-conversion" # Too many warnings for now nw="$nw -Wunreachable-code" # Too many warnings for now nw="$nw -Wpadded" # Our structs are not padded nw="$nw -Wredundant-decls" # openat.h declares e.g., mkdirat nw="$nw -Wlogical-op" # any use of fwrite provokes this nw="$nw -Wformat-nonliteral" # who.c and pinky.c strftime uses nw="$nw -Wvla" # warnings in gettext.h 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 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 # 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([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]) 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 -Wuninitialized" #nw="$nw -Wunused-macros" #nw="$nw -Wmissing-prototypes" nw="$nw -Wold-style-definition" gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw]) AC_SUBST([GNULIB_WARN_CFLAGS]) fi dnl Checks for header files. AC_HEADER_STDC AC_HEADER_DIRENT dnl Checks for functions. AC_FUNC_CLOSEDIR_VOID AC_FUNC_MMAP AC_CHECK_FUNCS_ONCE(isascii iswctype setlocale wcscoll) dnl I18N feature AM_GNU_GETTEXT_VERSION([0.17]) AM_GNU_GETTEXT([external]) dnl Some installers want to be informed if we do not use our regex. dnl For example, if the host platform uses dynamic linking and the installer dnl knows that the grep may be invoked on other hosts with buggy libraries, dnl then the installer should configure --with-included-regex. if test "$ac_use_included_regex" = no; then AC_MSG_WARN([Included lib/regex.c not used]) fi # support for pcre PKG_PROG_PKG_CONFIG if test x"$testpcre" = x"yes"; then PKG_CHECK_MODULES(PCRE, [libpcre], [AC_DEFINE([HAVE_LIBPCRE], 1, [Define to 1 if you have the `pcre' library (-lpcre).]) CPPFLAGS="$CPPFLAGS $PCRE_CFLAGS"], [:]) fi AC_CONFIG_FILES([ Makefile lib/Makefile src/Makefile tests/Makefile po/Makefile.in doc/Makefile vms/Makefile gnulib-tests/Makefile ]) AC_OUTPUT