1 # Configuration for grep
3 # Alain Magloire <alainm@gnu.org>
4 # Bernhard Rosenkraenzer <bero@redhat.com>
6 dnl Process this file with autoconf to produce a configure script
8 AC_DEFINE(GREP, 1, [We are building grep])
12 AM_INIT_AUTOMAKE(grep, 2.5.1)
13 AM_CONFIG_HEADER(config.h:config.hin)
15 dnl Check for arguments
16 AC_ARG_ENABLE(perl-regexp,
17 [ --disable-perl-regexp disable perl-regexp],
18 [case "${enableval}" in
21 *) AC_MSG_ERROR(bad value ${enableval} for --disable-perl-regexp) ;;
24 dnl Checks for programs.
31 dnl Checks for typedefs, structures, and compiler characteristics.
35 AC_CHECK_TYPE(ssize_t, int)
39 dnl Checks for header files.
41 AC_CHECK_HEADERS(string.h stdlib.h sys/param.h memory.h unistd.h libintl.h)
42 AC_CHECK_HEADERS(wctype.h wchar.h)
47 dnl Checks for functions.
52 dnl getpagesize is checked for by AC_FUNC_MMAP.
53 AC_CHECK_FUNCS(btowc isascii memmove setmode strerror wctype mbrtowc)
54 AC_REPLACE_FUNCS(memchr stpcpy strtoul atexit fnmatch)
55 jm_AC_PREREQ_XSTRTOUMAX
57 dnl Replace this with jm_CHECK_DECLS once autoconf 2.15 is out.
58 jm_CHECK_DECLARATIONS([#include <stdlib.h>], [strtoul strtoull])
59 test $jm_cv_func_decl_strtoul != yes
60 AC_DEFINE_UNQUOTED([HAVE_DECL_STRTOUL], $?,
61 [Define if <stdlib.h> declares strtoul.])
62 test $jm_cv_func_decl_strtoull != yes
63 AC_DEFINE_UNQUOTED([HAVE_DECL_STRTOULL], $?,
64 [Define if <stdlib.h> declares strtoull.])
67 case "$ac_cv_prog_CC" in
68 cl*) AC_DEFINE([alloca], _alloca, [Define if your compiler is broken]) ;;
73 ALL_LINGUAS="cs de el eo es et fr gl hr id it ja ko nl no pl pt_BR ru sl sv"
76 dnl DOS file name convention
77 dnl sets HAVE_DOS_FILE_NAMES
80 dnl check for the environ separator
87 dnl Invoke the (capitalized) ac_objext macro without spelling its name.
88 dnl This works around a bug in automake 1.4 with ansi2knr.
89 dnl Automake looks for (capitalized) ac_objext by grepping for it,
90 dnl so it won't find it in this file.
91 ifelse(,, [AC][_OBJEXT])
93 dnl some folks ask for this, that's fine by me
94 dnl hope they know what they're doing ...
95 dnl if glibc2 regex is not included
97 dnl Many GNU/Linux people have different
98 dnl glibc versions with buggy regex.
99 jm_INCLUDED_REGEX(lib/regex.c)
101 dnl Many people on non-GNU/Linux systems don't have getopt
102 AC_CHECK_FUNC(getopt_long,
104 AC_ARG_WITH(included-getopt,
105 [ --with-included-getopt Use the included getopt rather than glibc's],
106 with_getopt=$withval,
108 if test "x$with_getopt" = xyes; then
118 dnl Some installers want to be informed if we do not use our regex.
119 dnl For example, if the host platform uses dynamic linking and the installer
120 dnl knows that the grep may be invoked on other hosts with buggy libraries,
121 dnl then the installer should configure --with-included-regex.
122 if test "$jm_with_regex" = no; then
123 AC_MSG_WARN(Included lib/regex.c not used)
126 dnl These are the prerequisite macros for GNU's error.c file.
130 dnl Determine whether malloc accepts 0 as its argument.
131 dnl If it doesn't, arrange to use the replacement function.
136 if test x"$testpcre" = x"yes"; then
137 if pcre-config --cflags >/dev/null 2>&1; then
138 CFLAGS="$CFLAGS `pcre-config --cflags`"
139 LIBS="$LIBS `pcre-config --libs`"
141 AC_CHECK_LIB(pcre, pcre_exec)
144 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])