|
Packit |
709fb3 |
dnl
|
|
Packit |
709fb3 |
dnl autoconf input file for GNU grep
|
|
Packit |
709fb3 |
dnl
|
|
Packit |
709fb3 |
dnl Copyright (C) 1997-2006, 2009-2017 Free Software Foundation, Inc.
|
|
Packit |
709fb3 |
dnl
|
|
Packit |
709fb3 |
dnl This file is part of GNU grep.
|
|
Packit |
709fb3 |
dnl
|
|
Packit |
709fb3 |
dnl This program is free software; you can redistribute it and/or modify
|
|
Packit |
709fb3 |
dnl it under the terms of the GNU General Public License as published by
|
|
Packit |
709fb3 |
dnl the Free Software Foundation; either version 3, or (at your option)
|
|
Packit |
709fb3 |
dnl any later version.
|
|
Packit |
709fb3 |
dnl
|
|
Packit |
709fb3 |
dnl This program is distributed in the hope that it will be useful,
|
|
Packit |
709fb3 |
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
709fb3 |
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
709fb3 |
dnl GNU General Public License for more details.
|
|
Packit |
709fb3 |
dnl
|
|
Packit |
709fb3 |
dnl You should have received a copy of the GNU General Public License
|
|
Packit |
709fb3 |
dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
AC_INIT([GNU grep],
|
|
Packit |
709fb3 |
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
|
|
Packit |
709fb3 |
[bug-grep@gnu.org])
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
# Set the GREP and EGREP variables to a dummy replacement for the 'grep'
|
|
Packit |
709fb3 |
# command, so that AC_PROG_GREP and AC_PROG_EGREP don't fail when no good
|
|
Packit |
709fb3 |
# 'grep' program is found. This makes it possible to build GNU grep on a
|
|
Packit |
709fb3 |
# Solaris machine that has only /usr/bin/grep and no /usr/xpg4/bin/grep.
|
|
Packit |
709fb3 |
# This function supports only restricted arguments:
|
|
Packit |
709fb3 |
# - No file names as arguments, process only standard input.
|
|
Packit |
709fb3 |
# - Only literal strings without backslashes, no regular expressions.
|
|
Packit |
709fb3 |
# - The only options are -e and -E (and -Ee).
|
|
Packit |
709fb3 |
# This function also does not support long lines beyond what the shell
|
|
Packit |
709fb3 |
# supports), and backslash-processes the input.
|
|
Packit |
709fb3 |
fn_grep () {
|
|
Packit |
709fb3 |
test "$1" = -E && shift
|
|
Packit |
709fb3 |
case $@%:@:$1 in
|
|
Packit |
709fb3 |
0:*) AC_MSG_ERROR([fn_grep: expected pattern]) ;;
|
|
Packit |
709fb3 |
1:-*) AC_MSG_ERROR([fn_grep: invalid command line]) ;;
|
|
Packit |
709fb3 |
1:*) pattern=$1 ;;
|
|
Packit |
709fb3 |
2:--|2:-e|2:-Ee) pattern=$2 ;;
|
|
Packit |
709fb3 |
*) AC_MSG_ERROR([fn_grep: invalid command line]) ;;
|
|
Packit |
709fb3 |
esac
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
case $pattern in
|
|
Packit |
709fb3 |
[*['].^$\*[']*]) dnl The outer brackets are for M4.
|
|
Packit |
709fb3 |
AC_MSG_ERROR([fn_grep: regular expressions not supported]) ;;
|
|
Packit |
709fb3 |
esac
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
rc=1
|
|
Packit |
709fb3 |
while read line; do
|
|
Packit |
709fb3 |
case $line in
|
|
Packit |
709fb3 |
*$pattern*)
|
|
Packit |
709fb3 |
rc=0
|
|
Packit |
709fb3 |
AS_ECHO([$line]) ;;
|
|
Packit |
709fb3 |
esac
|
|
Packit |
709fb3 |
done
|
|
Packit |
709fb3 |
return $rc
|
|
Packit |
709fb3 |
}
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
test -n "$GREP" || GREP=fn_grep
|
|
Packit |
709fb3 |
test -n "$EGREP" || EGREP=fn_grep
|
|
Packit |
709fb3 |
ac_cv_path_EGREP=$EGREP
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
AC_CONFIG_AUX_DIR(build-aux)
|
|
Packit |
709fb3 |
AC_CONFIG_SRCDIR(src/grep.c)
|
|
Packit |
709fb3 |
AC_DEFINE([GREP], 1, [We are building grep])
|
|
Packit |
709fb3 |
AC_PREREQ(2.59)
|
|
Packit |
709fb3 |
AC_CONFIG_MACRO_DIRS([m4])
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
dnl Automake stuff.
|
|
Packit |
709fb3 |
AM_INIT_AUTOMAKE([1.11 no-dist-gzip dist-xz color-tests parallel-tests
|
|
Packit |
709fb3 |
subdir-objects])
|
|
Packit |
709fb3 |
AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
AC_CONFIG_HEADERS([config.h:config.hin])
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
dnl Checks for programs.
|
|
Packit |
709fb3 |
AC_CANONICAL_HOST
|
|
Packit |
709fb3 |
AC_PROG_AWK
|
|
Packit |
709fb3 |
AC_PROG_INSTALL
|
|
Packit |
709fb3 |
AC_PROG_CC
|
|
Packit |
709fb3 |
gl_EARLY
|
|
Packit |
709fb3 |
AC_PROG_RANLIB
|
|
Packit |
709fb3 |
PKG_PROG_PKG_CONFIG([0.9.0])
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
# grep never invokes mbrtowc or mbrlen on empty input,
|
|
Packit |
709fb3 |
# so don't worry about this common bug,
|
|
Packit |
709fb3 |
# as working around it would merely slow grep down.
|
|
Packit |
709fb3 |
gl_cv_func_mbrtowc_empty_input='assume yes'
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
dnl Checks for typedefs, structures, and compiler characteristics.
|
|
Packit |
709fb3 |
AC_TYPE_SIZE_T
|
|
Packit |
709fb3 |
AC_C_CONST
|
|
Packit |
709fb3 |
gl_INIT
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
# The test suite needs to know if we have a working perl.
|
|
Packit |
709fb3 |
# FIXME: this is suboptimal. Ideally, we would be able to call gl_PERL
|
|
Packit |
709fb3 |
# with an ACTION-IF-NOT-FOUND argument ...
|
|
Packit |
709fb3 |
cu_have_perl=yes
|
|
Packit |
709fb3 |
case $PERL in *"/missing "*) cu_have_perl=no;; esac
|
|
Packit |
709fb3 |
AM_CONDITIONAL([HAVE_PERL], [test $cu_have_perl = yes])
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
AC_ARG_ENABLE([gcc-warnings],
|
|
Packit |
709fb3 |
[AS_HELP_STRING([--enable-gcc-warnings],
|
|
Packit |
709fb3 |
[turn on lots of GCC warnings (for developers)])],
|
|
Packit |
709fb3 |
[case $enableval in
|
|
Packit |
709fb3 |
yes|no) ;;
|
|
Packit |
709fb3 |
*) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
|
|
Packit |
709fb3 |
esac
|
|
Packit |
709fb3 |
gl_gcc_warnings=$enableval],
|
|
Packit |
709fb3 |
[gl_gcc_warnings=no
|
|
Packit |
709fb3 |
if test "$GCC" = yes && test -d "$srcdir"/.git; then
|
|
Packit |
709fb3 |
AC_COMPILE_IFELSE(
|
|
Packit |
709fb3 |
[AC_LANG_PROGRAM([[
|
|
Packit |
709fb3 |
#if ! (6 < __GNUC__ + (2 <= __GNUC_MINOR__))
|
|
Packit |
709fb3 |
#error "--enable-gcc-warnings defaults to 'no' on older GCC"
|
|
Packit |
709fb3 |
#endif
|
|
Packit |
709fb3 |
]])],
|
|
Packit |
709fb3 |
[gl_gcc_warnings=yes])
|
|
Packit |
709fb3 |
fi]
|
|
Packit |
709fb3 |
)
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
if test "$gl_gcc_warnings" = yes; then
|
|
Packit |
709fb3 |
gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
|
|
Packit |
709fb3 |
AC_SUBST([WERROR_CFLAGS])
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
nw=
|
|
Packit |
709fb3 |
# This, $nw, is the list of warnings we disable.
|
|
Packit |
709fb3 |
nw="$nw -Wdeclaration-after-statement" # too useful to forbid
|
|
Packit |
709fb3 |
nw="$nw -Waggregate-return" # anachronistic
|
|
Packit |
709fb3 |
nw="$nw -Wlong-long" # C90 is anachronistic (lib/gethrxtime.h)
|
|
Packit |
709fb3 |
nw="$nw -Wc++-compat" # We don't care about C++ compilers
|
|
Packit |
709fb3 |
nw="$nw -Wundef" # Warns on '#if GNULIB_FOO' etc in gnulib
|
|
Packit |
709fb3 |
nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings
|
|
Packit |
709fb3 |
nw="$nw -Wpadded" # Our structs are not padded
|
|
Packit |
709fb3 |
nw="$nw -Wvla" # warnings in gettext.h
|
|
Packit |
709fb3 |
nw="$nw -Wstack-protector" # generates false alarms for useful code
|
|
Packit |
709fb3 |
nw="$nw -Wswitch-default" # Too many warnings for now
|
|
Packit |
709fb3 |
nw="$nw -Wunsafe-loop-optimizations" # OK to suppress unsafe optimizations
|
|
Packit |
709fb3 |
nw="$nw -Winline" # streq.h's streq4, streq6 and strcaseeq6
|
|
Packit |
709fb3 |
nw="$nw -Wstrict-overflow" # regexec.c
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
gl_MANYWARN_ALL_GCC([ws])
|
|
Packit |
709fb3 |
gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
|
|
Packit |
709fb3 |
for w in $ws; do
|
|
Packit |
709fb3 |
gl_WARN_ADD([$w])
|
|
Packit |
709fb3 |
done
|
|
Packit |
709fb3 |
gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
|
|
Packit |
709fb3 |
gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now
|
|
Packit |
709fb3 |
gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
# In spite of excluding -Wlogical-op above, it is enabled, as of
|
|
Packit |
709fb3 |
# gcc 4.5.0 20090517, and it provokes warnings in cat.c, dd.c, truncate.c
|
|
Packit |
709fb3 |
gl_WARN_ADD([-Wno-logical-op])
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
AC_SUBST([WARN_CFLAGS])
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
|
|
Packit |
709fb3 |
AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
|
|
Packit |
709fb3 |
AH_VERBATIM([GNULIB_PORTCHECK_FORTIFY_SOURCE],
|
|
Packit |
709fb3 |
[/* Enable compile-time and run-time bounds-checking, and some warnings,
|
|
Packit |
709fb3 |
without upsetting glibc 2.15+. */
|
|
Packit |
709fb3 |
#if (defined GNULIB_PORTCHECK && !defined _FORTIFY_SOURCE \
|
|
Packit |
709fb3 |
&& defined __OPTIMIZE__ && __OPTIMIZE__)
|
|
Packit |
709fb3 |
# define _FORTIFY_SOURCE 2
|
|
Packit |
709fb3 |
#endif
|
|
Packit |
709fb3 |
])
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
# We use a slightly smaller set of warning options for lib/.
|
|
Packit |
709fb3 |
# Remove the following and save the result in GNULIB_WARN_CFLAGS.
|
|
Packit |
709fb3 |
nw=
|
|
Packit |
709fb3 |
nw="$nw -Wunused-macros"
|
|
Packit |
709fb3 |
gl_WARN_ADD([-Wno-format-nonliteral])
|
|
Packit |
709fb3 |
gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
|
|
Packit |
709fb3 |
AC_SUBST([GNULIB_WARN_CFLAGS])
|
|
Packit |
709fb3 |
fi
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
# By default, argmatch should fail calling usage (EXIT_FAILURE).
|
|
Packit |
709fb3 |
AC_DEFINE([ARGMATCH_DIE], [usage (EXIT_FAILURE)],
|
|
Packit |
709fb3 |
[Define to the function xargmatch calls on failures.])
|
|
Packit |
709fb3 |
AC_DEFINE([ARGMATCH_DIE_DECL], [void usage (int _e)],
|
|
Packit |
709fb3 |
[Define to the declaration of the xargmatch failure function.])
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
dnl Checks for header files.
|
|
Packit |
709fb3 |
AC_HEADER_STDC
|
|
Packit |
709fb3 |
AC_HEADER_DIRENT
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
dnl Checks for functions.
|
|
Packit |
709fb3 |
AC_FUNC_CLOSEDIR_VOID
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
AC_CHECK_FUNCS_ONCE(isascii setlocale)
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
dnl I18N feature
|
|
Packit |
709fb3 |
AM_GNU_GETTEXT_VERSION([0.18.2])
|
|
Packit |
709fb3 |
AM_GNU_GETTEXT([external])
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
dnl Some installers want to be informed if we do not use our regex.
|
|
Packit |
709fb3 |
dnl For example, if the host platform uses dynamic linking and the installer
|
|
Packit |
709fb3 |
dnl knows that the grep may be invoked on other hosts with buggy libraries,
|
|
Packit |
709fb3 |
dnl then the installer should configure --with-included-regex.
|
|
Packit |
709fb3 |
AM_CONDITIONAL([USE_INCLUDED_REGEX], [test "$ac_use_included_regex" = yes])
|
|
Packit |
709fb3 |
if test "$ac_use_included_regex" = no; then
|
|
Packit |
709fb3 |
AC_MSG_WARN([Included lib/regex.c not used])
|
|
Packit |
709fb3 |
fi
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
gl_FUNC_PCRE
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
case $host_os in
|
|
Packit |
709fb3 |
mingw*) suffix=w32 ;;
|
|
Packit |
709fb3 |
*) suffix=posix ;;
|
|
Packit |
709fb3 |
esac
|
|
Packit |
709fb3 |
COLORIZE_SOURCE=colorize-$suffix.c
|
|
Packit |
709fb3 |
AC_SUBST([COLORIZE_SOURCE])
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
AC_CONFIG_FILES([
|
|
Packit |
709fb3 |
Makefile
|
|
Packit |
709fb3 |
lib/Makefile
|
|
Packit |
709fb3 |
src/Makefile
|
|
Packit |
709fb3 |
tests/Makefile
|
|
Packit |
709fb3 |
po/Makefile.in
|
|
Packit |
709fb3 |
doc/Makefile
|
|
Packit |
709fb3 |
gnulib-tests/Makefile
|
|
Packit |
709fb3 |
])
|
|
Packit |
709fb3 |
GREP="$ac_abs_top_builddir/src/grep"
|
|
Packit |
709fb3 |
EGREP="$ac_abs_top_builddir/src/grep -E"
|
|
Packit |
709fb3 |
AC_OUTPUT
|