source: vendor/grep/2.12/configure.ac@ 2893

Last change on this file since 2893 was 2595, checked in by bird, 13 years ago

gnu grep version 2.12 (grep-2.12.tar.xz, md5sum=8d2f0346d08b13c18afb81f0e8aa1e2f)

File size: 7.6 KB
Line 
1dnl
2dnl autoconf input file for ``GNU grep''
3dnl
4dnl Copyright (C) 1997-2006, 2009-2012 Free Software Foundation, Inc.
5dnl
6dnl This file is part of GNU grep.
7dnl
8dnl This program is free software; you can redistribute it and/or modify
9dnl it under the terms of the GNU General Public License as published by
10dnl the Free Software Foundation; either version 3, or (at your option)
11dnl any later version.
12dnl
13dnl This program is distributed in the hope that it will be useful,
14dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
15dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16dnl GNU General Public License for more details.
17dnl
18dnl You should have received a copy of the GNU General Public License
19dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
20
21AC_INIT([GNU grep],
22 m4_esyscmd([build-aux/git-version-gen .tarball-version]),
23 [bug-grep@gnu.org])
24
25# Set the GREP and EGREP variables to a dummy replacement for the 'grep'
26# command, so that AC_PROG_GREP and AC_PROG_EGREP don't fail when no good
27# 'grep' program is found. This makes it possible to build GNU grep on a
28# Solaris machine that has only /usr/bin/grep and no /usr/xpg4/bin/grep.
29# This function supports only restricted arguments:
30# - No file names as arguments, process only standard input.
31# - Only literal strings without backslashes, no regular expressions.
32# - The only options are -e and -E (and -Ee).
33# This function also does not support long lines beyond what the shell
34# supports), and backslash-processes the input.
35fn_grep () {
36 test "$1" = -E && shift
37 case $@%:@:$1 in
38 0:*) AC_MSG_ERROR([fn_grep: expected pattern]) ;;
39 1:-*) AC_MSG_ERROR([fn_grep: invalid command line]) ;;
40 1:*) pattern=$1 ;;
41 2:--|2:-e|2:-Ee) pattern=$2 ;;
42 *) AC_MSG_ERROR([fn_grep: invalid command line]) ;;
43 esac
44
45 case $pattern in
46 [*[].^$\\*[]*]) dnl The outer brackets are for M4.
47 AC_MSG_ERROR([fn_grep: regular expressions not supported]) ;;
48 esac
49
50 rc=1
51 while read line; do
52 case $line in
53 *$pattern*)
54 rc=0
55 AS_ECHO([$line]) ;;
56 esac
57 done
58 return $rc
59}
60
61test -n "$GREP" || GREP=fn_grep
62test -n "$EGREP" || EGREP=fn_grep
63ac_cv_path_EGREP=$EGREP
64
65AC_CONFIG_AUX_DIR(build-aux)
66AC_CONFIG_SRCDIR(src/grep.c)
67AC_DEFINE([GREP], 1, [We are building grep])
68AC_PREREQ(2.59)
69
70dnl Automake stuff.
71AM_INIT_AUTOMAKE([1.11 no-dist-gzip dist-xz color-tests parallel-tests])
72AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
73
74AC_CONFIG_HEADERS([config.h:config.hin])
75
76dnl Checks for programs.
77AC_CANONICAL_HOST
78AC_PROG_AWK
79AC_PROG_INSTALL
80AC_PROG_CC
81gl_EARLY
82AC_PROG_RANLIB
83
84dnl Checks for typedefs, structures, and compiler characteristics.
85AC_TYPE_SIZE_T
86AC_C_CONST
87gl_INIT
88
89AC_ARG_ENABLE([gcc-warnings],
90 [AS_HELP_STRING([--enable-gcc-warnings],
91 [turn on lots of GCC warnings (for developers)])],
92 [case $enableval in
93 yes|no) ;;
94 *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
95 esac
96 gl_gcc_warnings=$enableval],
97 [gl_gcc_warnings=no]
98)
99
100if test "$gl_gcc_warnings" = yes; then
101 gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
102 AC_SUBST([WERROR_CFLAGS])
103
104 nw=
105 # This, $nw, is the list of warnings we disable.
106 nw="$nw -Wdeclaration-after-statement" # too useful to forbid
107 nw="$nw -Waggregate-return" # anachronistic
108 nw="$nw -Wlong-long" # C90 is anachronistic (lib/gethrxtime.h)
109 nw="$nw -Wc++-compat" # We don't care about C++ compilers
110 nw="$nw -Wundef" # Warns on '#if GNULIB_FOO' etc in gnulib
111 nw="$nw -Wtraditional" # Warns on #elif which we use often
112 nw="$nw -Wcast-qual" # Too many warnings for now
113 nw="$nw -Wconversion" # Too many warnings for now
114 nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings
115 nw="$nw -Wsign-conversion" # Too many warnings for now
116 nw="$nw -Wtraditional-conversion" # Too many warnings for now
117 nw="$nw -Wunreachable-code" # Too many warnings for now
118 nw="$nw -Wpadded" # Our structs are not padded
119 nw="$nw -Wredundant-decls" # openat.h declares e.g., mkdirat
120 nw="$nw -Wlogical-op" # any use of fwrite provokes this
121 nw="$nw -Wformat-nonliteral" # who.c and pinky.c strftime uses
122 nw="$nw -Wvla" # warnings in gettext.h
123 nw="$nw -Wnested-externs" # use of XARGMATCH/verify_function__
124 nw="$nw -Wswitch-enum" # Too many warnings for now
125 nw="$nw -Wswitch-default" # Too many warnings for now
126 nw="$nw -Wstack-protector" # not worth working around
127 # things I might fix soon:
128 nw="$nw -Wfloat-equal" # sort.c, seq.c
129 nw="$nw -Wmissing-format-attribute" # copy.c
130 nw="$nw -Wunsafe-loop-optimizations" # a few src/*.c
131 nw="$nw -Winline" # system.h's readdir_ignoring_dot_and_dotdot
132 nw="$nw -Wstrict-overflow" # expr.c, pr.c, tr.c, factor.c
133 # ?? -Wstrict-overflow
134
135 gl_MANYWARN_ALL_GCC([ws])
136 gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
137 for w in $ws; do
138 gl_WARN_ADD([$w])
139 done
140 gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
141 gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now
142 gl_WARN_ADD([-Wno-pointer-sign]) # Too many warnings for now
143 gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
144
145 # In spite of excluding -Wlogical-op above, it is enabled, as of
146 # gcc 4.5.0 20090517, and it provokes warnings in cat.c, dd.c, truncate.c
147 gl_WARN_ADD([-Wno-logical-op])
148
149 gl_WARN_ADD([-fdiagnostics-show-option])
150 gl_WARN_ADD([-funit-at-a-time])
151
152 AC_SUBST([WARN_CFLAGS])
153
154 AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
155 AC_DEFINE([_FORTIFY_SOURCE], [2],
156 [enable compile-time and run-time bounds-checking, and some warnings])
157 AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
158
159 # We use a slightly smaller set of warning options for lib/.
160 # Remove the following and save the result in GNULIB_WARN_CFLAGS.
161 nw=
162 #nw="$nw -Wuninitialized"
163 nw="$nw -Wunused-macros"
164 #nw="$nw -Wmissing-prototypes"
165 nw="$nw -Wold-style-definition"
166 nw="$nw -Wcast-align"
167 nw="$nw -Wunsuffixed-float-constants"
168 gl_WARN_ADD([-Wno-format-nonliteral])
169 gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
170 AC_SUBST([GNULIB_WARN_CFLAGS])
171fi
172
173# By default, argmatch should fail calling usage (EXIT_FAILURE).
174AC_DEFINE([ARGMATCH_DIE], [usage (EXIT_FAILURE)],
175 [Define to the function xargmatch calls on failures.])
176AC_DEFINE([ARGMATCH_DIE_DECL], [void usage (int _e)],
177 [Define to the declaration of the xargmatch failure function.])
178
179dnl Checks for header files.
180AC_HEADER_STDC
181AC_HEADER_DIRENT
182
183dnl Checks for functions.
184AC_FUNC_CLOSEDIR_VOID
185
186AC_CHECK_FUNCS_ONCE(isascii setlocale)
187
188dnl I18N feature
189AM_GNU_GETTEXT_VERSION([0.18])
190AM_GNU_GETTEXT([external])
191
192dnl Some installers want to be informed if we do not use our regex.
193dnl For example, if the host platform uses dynamic linking and the installer
194dnl knows that the grep may be invoked on other hosts with buggy libraries,
195dnl then the installer should configure --with-included-regex.
196AM_CONDITIONAL([USE_INCLUDED_REGEX], [test "$ac_use_included_regex" = yes])
197if test "$ac_use_included_regex" = no; then
198 AC_MSG_WARN([Included lib/regex.c not used])
199fi
200
201gl_FUNC_PCRE
202
203case $host_os in
204 mingw*) suffix=w32 ;;
205 *) suffix=posix ;;
206esac
207AC_CONFIG_LINKS([lib/colorize.c:lib/colorize-$suffix.c])
208
209AC_CONFIG_FILES([
210 Makefile
211 lib/Makefile
212 src/Makefile
213 tests/Makefile
214 po/Makefile.in
215 doc/Makefile
216 gnulib-tests/Makefile
217])
218GREP="$ac_abs_top_builddir/src/grep"
219EGREP="$ac_abs_top_builddir/src/grep -E"
220AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.