1 | # Configuration for grep
|
---|
2 | #
|
---|
3 | # Alain Magloire <alainm@gnu.org>
|
---|
4 | # Bernhard Rosenkraenzer <bero@arklinux.org>
|
---|
5 | #
|
---|
6 | dnl Process this file with autoconf to produce a configure script
|
---|
7 | AC_INIT(src/grep.c)
|
---|
8 | AC_DEFINE(GREP, 1, [We are building grep])
|
---|
9 | AC_PREREQ(2.53)
|
---|
10 |
|
---|
11 | dnl Automake stuff.
|
---|
12 | AM_INIT_AUTOMAKE(grep, 2.5.1)
|
---|
13 | AM_CONFIG_HEADER(config.h:config.hin)
|
---|
14 |
|
---|
15 | dnl Check for arguments
|
---|
16 | AC_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 |
|
---|
24 | dnl Checks for programs.
|
---|
25 | AC_CANONICAL_HOST
|
---|
26 | AC_PROG_AWK
|
---|
27 | AC_PROG_CC
|
---|
28 | AC_PROG_INSTALL
|
---|
29 | AC_PROG_RANLIB
|
---|
30 |
|
---|
31 | dnl Checks for typedefs, structures, and compiler characteristics.
|
---|
32 | AC_SYS_LARGEFILE
|
---|
33 | AM_C_PROTOTYPES
|
---|
34 | AC_TYPE_SIZE_T
|
---|
35 | AC_CHECK_TYPE(ssize_t, int)
|
---|
36 | AC_C_CONST
|
---|
37 | jm_AC_TYPE_UINTMAX_T
|
---|
38 |
|
---|
39 | dnl Checks for header files.
|
---|
40 | AC_HEADER_STDC
|
---|
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)
|
---|
43 | AC_HEADER_DIRENT
|
---|
44 | AC_HEADER_STAT
|
---|
45 | AC_MBSTATE_T
|
---|
46 |
|
---|
47 | dnl Checks for functions.
|
---|
48 | AC_FUNC_ALLOCA
|
---|
49 | AC_FUNC_CLOSEDIR_VOID
|
---|
50 | AC_FUNC_MMAP
|
---|
51 |
|
---|
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
|
---|
56 |
|
---|
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.])
|
---|
65 |
|
---|
66 | dnl for VC++
|
---|
67 | case "$ac_cv_prog_CC" in
|
---|
68 | cl*) AC_DEFINE([alloca], _alloca, [Define if your compiler is broken]) ;;
|
---|
69 | *) ;;
|
---|
70 | esac
|
---|
71 |
|
---|
72 | dnl I18N feature
|
---|
73 | ALL_LINGUAS="cs de el eo es et fr gl hr id it ja ko nl no pl pt_BR ru sl sv"
|
---|
74 | AM_GNU_GETTEXT
|
---|
75 |
|
---|
76 | dnl DOS file name convention
|
---|
77 | dnl sets HAVE_DOS_FILE_NAMES
|
---|
78 | AC_DOSFILE
|
---|
79 |
|
---|
80 | dnl check for the environ separator
|
---|
81 | dnl sets SEP
|
---|
82 | AM_SEP
|
---|
83 |
|
---|
84 | dnl OS specifics
|
---|
85 | dnl sets {EXE,OBJ}EXT
|
---|
86 | AC_EXEEXT
|
---|
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])
|
---|
92 |
|
---|
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
|
---|
96 |
|
---|
97 | dnl Many GNU/Linux people have different
|
---|
98 | dnl glibc versions with buggy regex.
|
---|
99 | jm_INCLUDED_REGEX(lib/regex.c)
|
---|
100 |
|
---|
101 | dnl Many people on non-GNU/Linux systems don't have getopt
|
---|
102 | AC_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 |
|
---|
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)
|
---|
124 | fi
|
---|
125 |
|
---|
126 | dnl These are the prerequisite macros for GNU's error.c file.
|
---|
127 | AC_FUNC_STRERROR_R
|
---|
128 | jm_PREREQ_ERROR
|
---|
129 |
|
---|
130 | dnl Determine whether malloc accepts 0 as its argument.
|
---|
131 | dnl If it doesn't, arrange to use the replacement function.
|
---|
132 | jm_FUNC_MALLOC
|
---|
133 | jm_FUNC_REALLOC
|
---|
134 |
|
---|
135 | # support for pcre
|
---|
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`"
|
---|
140 | fi
|
---|
141 | AC_CHECK_LIB(pcre, pcre_exec)
|
---|
142 | fi
|
---|
143 |
|
---|
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])
|
---|