1# Configuration for grep 2# 3# Alain Magloire <alainm@gnu.org> 4# Bernhard Rosenkraenzer <bero@arklinux.org> 5# 6dnl Process this file with autoconf to produce a configure script 7AC_INIT(src/grep.c) 8AC_DEFINE(GREP, 1, [We are building grep]) 9AC_PREREQ(2.53) 10 11dnl Automake stuff. 12AM_INIT_AUTOMAKE(grep, 2.5.1) 13AM_CONFIG_HEADER(config.h:config.hin) 14 15dnl Check for arguments 16AC_ARG_ENABLE(perl-regexp, 17 [ --disable-perl-regexp disable perl-regexp], 18 [case "${enableval}" in 19 yes) testpcre=yes ;; 20 no) testpcre=no ;; 21 *) AC_MSG_ERROR(bad value ${enableval} for --disable-perl-regexp) ;; 22 esac],[testpcre=yes]) 23 24dnl Checks for programs. 25AC_CANONICAL_HOST 26AC_PROG_AWK 27AC_PROG_CC 28AC_PROG_INSTALL 29AC_PROG_RANLIB 30 31dnl Checks for typedefs, structures, and compiler characteristics. 32AC_SYS_LARGEFILE 33AM_C_PROTOTYPES 34AC_TYPE_SIZE_T 35AC_CHECK_TYPE(ssize_t, int) 36AC_C_CONST 37jm_AC_TYPE_UINTMAX_T 38 39dnl Checks for header files. 40AC_HEADER_STDC 41AC_CHECK_HEADERS(string.h stdlib.h sys/param.h memory.h unistd.h libintl.h) 42AC_CHECK_HEADERS(wctype.h wchar.h) 43AC_HEADER_DIRENT 44AC_HEADER_STAT 45AC_MBSTATE_T 46 47dnl Checks for functions. 48AC_FUNC_ALLOCA 49AC_FUNC_CLOSEDIR_VOID 50AC_FUNC_MMAP 51 52dnl getpagesize is checked for by AC_FUNC_MMAP. 53AC_CHECK_FUNCS(btowc isascii memmove setmode strerror wctype mbrtowc) 54AC_REPLACE_FUNCS(memchr stpcpy strtoul atexit fnmatch) 55jm_AC_PREREQ_XSTRTOUMAX 56 57dnl Replace this with jm_CHECK_DECLS once autoconf 2.15 is out. 58jm_CHECK_DECLARATIONS([#include <stdlib.h>], [strtoul strtoull]) 59test $jm_cv_func_decl_strtoul != yes 60AC_DEFINE_UNQUOTED([HAVE_DECL_STRTOUL], $?, 61 [Define if <stdlib.h> declares strtoul.]) 62test $jm_cv_func_decl_strtoull != yes 63AC_DEFINE_UNQUOTED([HAVE_DECL_STRTOULL], $?, 64 [Define if <stdlib.h> declares strtoull.]) 65 66dnl for VC++ 67case "$ac_cv_prog_CC" in 68 cl*) AC_DEFINE([alloca], _alloca, [Define if your compiler is broken]) ;; 69 *) ;; 70esac 71 72dnl I18N feature 73ALL_LINGUAS="cs de el eo es et fr gl hr id it ja ko nl no pl pt_BR ru sl sv" 74AM_GNU_GETTEXT 75 76dnl DOS file name convention 77dnl sets HAVE_DOS_FILE_NAMES 78AC_DOSFILE 79 80dnl check for the environ separator 81dnl sets SEP 82AM_SEP 83 84dnl OS specifics 85dnl sets {EXE,OBJ}EXT 86AC_EXEEXT 87dnl Invoke the (capitalized) ac_objext macro without spelling its name. 88dnl This works around a bug in automake 1.4 with ansi2knr. 89dnl Automake looks for (capitalized) ac_objext by grepping for it, 90dnl so it won't find it in this file. 91ifelse(,, [AC][_OBJEXT]) 92 93dnl some folks ask for this, that's fine by me 94dnl hope they know what they're doing ... 95dnl if glibc2 regex is not included 96 97dnl Many GNU/Linux people have different 98dnl glibc versions with buggy regex. 99jm_INCLUDED_REGEX(lib/regex.c) 100 101dnl Many people on non-GNU/Linux systems don't have getopt 102AC_CHECK_FUNC(getopt_long, 103 [ 104 AC_ARG_WITH(included-getopt, 105 [ --with-included-getopt Use the included getopt rather than glibc's], 106 with_getopt=$withval, 107 with_getopt=$no) 108 if test "x$with_getopt" = xyes; then 109 AC_LIBOBJ(getopt) 110 AC_LIBOBJ(getopt1) 111 fi 112 ], 113 [ 114 AC_LIBOBJ(getopt) 115 AC_LIBOBJ(getopt1) 116 ]) 117 118dnl Some installers want to be informed if we do not use our regex. 119dnl For example, if the host platform uses dynamic linking and the installer 120dnl knows that the grep may be invoked on other hosts with buggy libraries, 121dnl then the installer should configure --with-included-regex. 122if test "$jm_with_regex" = no; then 123 AC_MSG_WARN(Included lib/regex.c not used) 124fi 125 126dnl These are the prerequisite macros for GNU's error.c file. 127AC_FUNC_STRERROR_R 128jm_PREREQ_ERROR 129 130dnl Determine whether malloc accepts 0 as its argument. 131dnl If it doesn't, arrange to use the replacement function. 132jm_FUNC_MALLOC 133jm_FUNC_REALLOC 134 135# support for pcre 136if 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`" 140 fi 141 AC_CHECK_LIB(pcre, pcre_exec) 142fi 143 144AC_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]) 145