2 dnl autoconf input file for ``GNU grep''
4 dnl Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
5 dnl 2005, 2006 the Free Software Foundation, Inc.
7 dnl This file is part of GNU grep.
9 dnl GNU grep is free software; you can redistribute it and/or modify
10 dnl it under the terms of the GNU General Public License as published by
11 dnl the Free Software Foundation; either version 2 of the License, or
12 dnl (at your option) any later version.
14 dnl GNU grep is distributed in the hope that it will be useful,
15 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
16 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 dnl GNU General Public License for more details.
19 dnl You should have received a copy of the GNU General Public License along
20 dnl with this program; if not, write to the Free Software Foundation, Inc.,
21 dnl 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 dnl Alain Magloire <alainm@gnu.org>
25 dnl Bernhard Rosenkraenzer <bero@arklinux.org>
26 dnl Stepan Kasal <kasal@gnu.org>
29 AC_INIT(GNU grep, 2.5.2, bug-grep@gnu.org, grep)
30 AC_CONFIG_SRCDIR(src/grep.c)
31 AC_DEFINE(GREP, 1, [We are building grep])
35 AM_INIT_AUTOMAKE(dist-bzip2)
36 AM_CONFIG_HEADER(config.h:config.hin)
38 dnl Check for arguments
39 AC_ARG_ENABLE(perl-regexp,
40 [ --disable-perl-regexp disable perl-regexp],
41 [case "${enableval}" in
44 *) AC_MSG_ERROR(bad value ${enableval} for --disable-perl-regexp) ;;
47 dnl Checks for programs.
54 dnl Checks for typedefs, structures, and compiler characteristics.
58 AC_CHECK_TYPE(ssize_t, int)
62 dnl Checks for header files.
64 AC_CHECK_HEADERS(string.h stdlib.h sys/param.h memory.h unistd.h libintl.h)
65 AC_CHECK_HEADERS(wctype.h wchar.h)
69 dnl Checks for functions.
74 dnl getpagesize is checked for by AC_FUNC_MMAP.
75 AC_CHECK_FUNCS(btowc isascii iswctype mbrlen memmove setmode strerror wcrtomb wcscoll wctype)
76 # We can use mbrtowc only if we have mbstate_t.
78 # Yet we need a mbstate_t stub in every case.
80 AC_REPLACE_FUNCS(memchr stpcpy strtoul atexit fnmatch)
81 jm_AC_PREREQ_XSTRTOUMAX
83 dnl Replace this with jm_CHECK_DECLS once autoconf 2.15 is out.
84 jm_CHECK_DECLARATIONS([#include <stdlib.h>], [strtoul strtoull])
85 test $jm_cv_func_decl_strtoul != yes
86 AC_DEFINE_UNQUOTED([HAVE_DECL_STRTOUL], $?,
87 [Define if <stdlib.h> declares strtoul.])
88 test $jm_cv_func_decl_strtoull != yes
89 AC_DEFINE_UNQUOTED([HAVE_DECL_STRTOULL], $?,
90 [Define if <stdlib.h> declares strtoull.])
93 case "$ac_cv_prog_CC" in
94 cl*) AC_DEFINE([alloca], _alloca, [Define if your compiler is broken]) ;;
99 ALL_LINGUAS="@ALL_LINGUAS@"
102 dnl DOS file name convention
103 dnl sets HAVE_DOS_FILE_NAMES
106 dnl check for the environ separator
111 dnl sets {EXE,OBJ}EXT
113 dnl Invoke the (capitalized) ac_objext macro without spelling its name.
114 dnl This works around a bug in automake 1.4 with ansi2knr.
115 dnl Automake looks for (capitalized) ac_objext by grepping for it,
116 dnl so it won't find it in this file.
117 ifelse(,, [AC][_OBJEXT])
119 dnl some folks ask for this, that's fine by me
120 dnl hope they know what they're doing ...
121 dnl if glibc2 regex is not included
123 dnl Many GNU/Linux people have different
124 dnl glibc versions with buggy regex.
125 jm_INCLUDED_REGEX(lib/regex.c)
127 dnl Many people on non-GNU/Linux systems don't have getopt
128 AC_CHECK_FUNC(getopt_long,
130 AC_ARG_WITH(included-getopt,
131 [ --with-included-getopt Use the included getopt rather than glibc's],
132 with_getopt=$withval,
134 if test "x$with_getopt" = xyes; then
144 dnl Some installers want to be informed if we do not use our regex.
145 dnl For example, if the host platform uses dynamic linking and the installer
146 dnl knows that the grep may be invoked on other hosts with buggy libraries,
147 dnl then the installer should configure --with-included-regex.
148 if test "$jm_with_regex" = no; then
149 AC_MSG_WARN(Included lib/regex.c not used)
152 dnl These are the prerequisite macros for GNU's error.c file.
156 dnl Determine whether malloc accepts 0 as its argument.
157 dnl If it doesn't, arrange to use the replacement function.
162 if test x"$testpcre" = x"yes"; then
163 if pcre-config --cflags >/dev/null 2>&1; then
164 CFLAGS="$CFLAGS `pcre-config --cflags`"
165 LIBS="$LIBS `pcre-config --libs`"
167 AC_CHECK_LIB(pcre, pcre_exec)
170 AC_OUTPUT(Makefile lib/Makefile lib/posix/Makefile src/Makefile tests/Makefile po/Makefile.in intl/Makefile doc/Makefile m4/Makefile vms/Makefile bootstrap/Makefile, [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile; echo timestamp > stamp-h])