5 |
|
|
6 |
AC_INIT(dftables.c) |
AC_INIT(dftables.c) |
7 |
|
|
8 |
|
dnl A safety precaution |
9 |
|
|
10 |
|
AC_PREREQ(2.57) |
11 |
|
|
12 |
|
dnl Arrange to build config.h from config.in. Note that pcre.h is |
13 |
|
dnl built differently, as it is just a "substitution" file. |
14 |
|
dnl Manual says this macro should come right after AC_INIT. |
15 |
|
AC_CONFIG_HEADER(config.h:config.in) |
16 |
|
|
17 |
|
dnl Provide the current PCRE version information. Do not use numbers |
18 |
|
dnl with leading zeros for the minor version, as they end up in a C |
19 |
|
dnl macro, and may be treated as octal constants. Stick to single |
20 |
|
dnl digits for minor numbers less than 10. There are unlikely to be |
21 |
|
dnl that many releases anyway. |
22 |
|
|
23 |
|
PCRE_MAJOR=6 |
24 |
|
PCRE_MINOR=0 |
25 |
|
PCRE_DATE=07-Jun-2005 |
26 |
|
PCRE_VERSION=${PCRE_MAJOR}.${PCRE_MINOR} |
27 |
|
|
28 |
|
dnl Default values for miscellaneous macros |
29 |
|
|
30 |
|
POSIX_MALLOC_THRESHOLD=-DPOSIX_MALLOC_THRESHOLD=10 |
31 |
|
|
32 |
|
dnl Provide versioning information for libtool shared libraries that |
33 |
|
dnl are built by default on Unix systems. |
34 |
|
|
35 |
|
PCRE_LIB_VERSION=0:1:0 |
36 |
|
PCRE_POSIXLIB_VERSION=0:0:0 |
37 |
|
PCRE_CPPLIB_VERSION=0:0:0 |
38 |
|
|
39 |
dnl Checks for programs. |
dnl Checks for programs. |
40 |
|
|
41 |
AC_PROG_CC |
AC_PROG_CC |
42 |
AC_PROG_RANLIB |
|
43 |
|
dnl For the C++ wrapper libpcrecpp. |
44 |
|
|
45 |
|
AC_PROG_CXX |
46 |
|
|
47 |
|
if test -n "$ac_cv_prog_ac_ct_CXX"; then |
48 |
|
MAYBE_CPP_TARGETS='$(CPP_TARGETS)' |
49 |
|
fi |
50 |
|
echo "Maybe-cpp-targets: '$ac_cv_prog_CXX' '$MAYBE_CPP_TARGETS'" #!! |
51 |
|
AC_SUBST(MAYBE_CPP_TARGETS) |
52 |
|
|
53 |
|
dnl The icc compiler has the same options as gcc, so let the rest of the |
54 |
|
dnl configure script think it has gcc when setting up dnl options etc. |
55 |
|
dnl This is a nasty hack which no longer seems necessary with the update |
56 |
|
dnl to the latest libtool files, so I have commented it out. |
57 |
|
dnl |
58 |
|
dnl if test "$CC" = "icc" ; then GCC=yes ; fi |
59 |
|
|
60 |
|
AC_PROG_INSTALL |
61 |
|
AC_LIBTOOL_WIN32_DLL |
62 |
|
AC_PROG_LIBTOOL |
63 |
|
|
64 |
|
dnl We need to find a compiler for compiling a program to run on the local host |
65 |
|
dnl while building. It needs to be different from CC when cross-compiling. |
66 |
|
dnl There is a macro called AC_PROG_CC_FOR_BUILD in the GNU archive for |
67 |
|
dnl figuring this out automatically. Unfortunately, it does not work with the |
68 |
|
dnl latest versions of autoconf. So for the moment, we just default to the |
69 |
|
dnl same values as the "main" compiler. People who are corss-compiling will |
70 |
|
dnl just have to adjust the Makefile by hand or set these values when they |
71 |
|
dnl run "configure". |
72 |
|
|
73 |
|
CC_FOR_BUILD=${CC_FOR_BUILD:-'$(CC)'} |
74 |
|
CXX_FOR_BUILD=${CXX_FOR_BUILD:-'$(CXX)'} |
75 |
|
CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD:-'$(CFLAGS)'} |
76 |
|
CPPFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD:-'$(CPPFLAGS)'} |
77 |
|
CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD:-'$(CXXFLAGS)'} |
78 |
|
BUILD_EXEEXT=${BUILD_EXEEXT:-'$(EXEEXT)'} |
79 |
|
BUILD_OBJEXT=${BUILD_OBJEXT:-'$(OBJEXT)'} |
80 |
|
|
81 |
dnl Checks for header files. |
dnl Checks for header files. |
82 |
|
|
83 |
AC_HEADER_STDC |
AC_HEADER_STDC |
84 |
AC_CHECK_HEADERS(limits.h) |
AC_CHECK_HEADERS(limits.h) |
85 |
|
|
86 |
|
dnl These are C++ header files |
87 |
|
|
88 |
|
AC_LANG_SAVE |
89 |
|
AC_LANG_CPLUSPLUS |
90 |
|
dnl I could be more clever here, given I'm doing AC_SUBST with this |
91 |
|
dnl (eg set a var to be the name of the include file I want). But I'm not |
92 |
|
dnl so it's easy to change back to 'regular' autoconf vars if we needed to. |
93 |
|
AC_CHECK_HEADERS(bits/type_traits.h, [pcre_has_bits_type_traits="1"], |
94 |
|
[pcre_has_bits_type_traits="0"]) |
95 |
|
AC_CHECK_HEADERS(type_traits.h, [pcre_has_type_traits="1"], |
96 |
|
[pcre_has_type_traits="0"]) |
97 |
|
dnl Using AC_SUBST eliminates the need to include config.h in a public .h file |
98 |
|
AC_SUBST(pcre_has_bits_type_traits) |
99 |
|
AC_SUBST(pcre_has_type_traits) |
100 |
|
AC_LANG_RESTORE |
101 |
|
|
102 |
dnl Checks for typedefs, structures, and compiler characteristics. |
dnl Checks for typedefs, structures, and compiler characteristics. |
103 |
|
|
104 |
AC_C_CONST |
AC_C_CONST |
105 |
AC_TYPE_SIZE_T |
AC_TYPE_SIZE_T |
106 |
|
|
107 |
|
AC_CHECK_TYPES([long long], [pcre_has_long_long="1"], [pcre_has_long_long="0"]) |
108 |
|
AC_CHECK_TYPES([unsigned long long], [pcre_has_ulong_long="1"], [pcre_has_ulong_long="0"]) |
109 |
|
AC_SUBST(pcre_has_long_long) |
110 |
|
AC_SUBST(pcre_has_ulong_long) |
111 |
|
|
112 |
dnl Checks for library functions. |
dnl Checks for library functions. |
|
AC_CHECK_FUNCS(memmove strerror) |
|
113 |
|
|
114 |
dnl Arrange to build config.h from config.in |
AC_CHECK_FUNCS(bcopy memmove strerror strtoq strtoll) |
115 |
AC_CONFIG_HEADER(config.h:config.in) |
|
116 |
|
dnl Handle --enable-utf8 |
117 |
|
|
118 |
|
AC_ARG_ENABLE(utf8, |
119 |
|
[ --enable-utf8 enable UTF8 support], |
120 |
|
if test "$enableval" = "yes"; then |
121 |
|
UTF8=-DSUPPORT_UTF8 |
122 |
|
fi |
123 |
|
) |
124 |
|
|
125 |
|
dnl Handle --enable-unicode-properties |
126 |
|
|
127 |
|
AC_ARG_ENABLE(unicode-properties, |
128 |
|
[ --enable-unicode-properties enable Unicode properties support], |
129 |
|
if test "$enableval" = "yes"; then |
130 |
|
UCP=-DSUPPORT_UCP |
131 |
|
fi |
132 |
|
) |
133 |
|
|
134 |
|
dnl Handle --enable-newline-is-cr |
135 |
|
|
136 |
dnl Handle --enable-shared-libraries |
AC_ARG_ENABLE(newline-is-cr, |
137 |
LIBTOOL= |
[ --enable-newline-is-cr use CR as the newline character], |
|
LIBSUFFIX=a |
|
|
AC_ARG_ENABLE(shared, |
|
|
[ --enable-shared build PCRE as a shared library (using libtool)], |
|
138 |
if test "$enableval" = "yes"; then |
if test "$enableval" = "yes"; then |
139 |
LIBTOOL=libtool |
NEWLINE=-DNEWLINE=13 |
|
LIBSUFFIX=la |
|
140 |
fi |
fi |
141 |
) |
) |
|
AC_SUBST(LIBTOOL) |
|
|
AC_SUBST(LIBSUFFIX) |
|
142 |
|
|
143 |
dnl This must be last; it determines what files are written |
dnl Handle --enable-newline-is-lf |
144 |
AC_OUTPUT(Makefile) |
|
145 |
|
AC_ARG_ENABLE(newline-is-lf, |
146 |
|
[ --enable-newline-is-lf use LF as the newline character], |
147 |
|
if test "$enableval" = "yes"; then |
148 |
|
NEWLINE=-DNEWLINE=10 |
149 |
|
fi |
150 |
|
) |
151 |
|
|
152 |
|
dnl Handle --enable-ebcdic |
153 |
|
|
154 |
|
AC_ARG_ENABLE(ebcdic, |
155 |
|
[ --enable-ebcdic assume EBCDIC coding rather than ASCII], |
156 |
|
if test "$enableval" == "yes"; then |
157 |
|
EBCDIC=-DEBCDIC=1 |
158 |
|
fi |
159 |
|
) |
160 |
|
|
161 |
|
dnl Handle --disable-stack-for-recursion |
162 |
|
|
163 |
|
AC_ARG_ENABLE(stack-for-recursion, |
164 |
|
[ --disable-stack-for-recursion disable use of stack recursion when matching], |
165 |
|
if test "$enableval" = "no"; then |
166 |
|
NO_RECURSE=-DNO_RECURSE |
167 |
|
fi |
168 |
|
) |
169 |
|
|
170 |
|
dnl There doesn't seem to be a straightforward way of having parameters |
171 |
|
dnl that set values, other than fudging the --with thing. So that's what |
172 |
|
dnl I've done. |
173 |
|
|
174 |
|
dnl Handle --with-posix-malloc-threshold=n |
175 |
|
|
176 |
|
AC_ARG_WITH(posix-malloc-threshold, |
177 |
|
[ --with-posix-malloc-threshold=5 threshold for POSIX malloc usage], |
178 |
|
POSIX_MALLOC_THRESHOLD=-DPOSIX_MALLOC_THRESHOLD=$withval |
179 |
|
) |
180 |
|
|
181 |
|
dnl Handle --with-link-size=n |
182 |
|
|
183 |
|
AC_ARG_WITH(link-size, |
184 |
|
[ --with-link-size=2 internal link size (2, 3, or 4 allowed)], |
185 |
|
LINK_SIZE=-DLINK_SIZE=$withval |
186 |
|
) |
187 |
|
|
188 |
|
dnl Handle --with-match_limit=n |
189 |
|
|
190 |
|
AC_ARG_WITH(match-limit, |
191 |
|
[ --with-match-limit=10000000 default limit on internal looping)], |
192 |
|
MATCH_LIMIT=-DMATCH_LIMIT=$withval |
193 |
|
) |
194 |
|
|
195 |
|
dnl Unicode character property support implies UTF-8 support |
196 |
|
|
197 |
|
if test "$UCP" != "" ; then |
198 |
|
UTF8=-DSUPPORT_UTF8 |
199 |
|
fi |
200 |
|
|
201 |
|
dnl "Export" these variables |
202 |
|
|
203 |
|
AC_SUBST(BUILD_EXEEXT) |
204 |
|
AC_SUBST(BUILD_OBJEXT) |
205 |
|
AC_SUBST(CC_FOR_BUILD) |
206 |
|
AC_SUBST(CXX_FOR_BUILD) |
207 |
|
AC_SUBST(CFLAGS_FOR_BUILD) |
208 |
|
AC_SUBST(CXXFLAGS_FOR_BUILD) |
209 |
|
AC_SUBST(EBCDIC) |
210 |
|
AC_SUBST(HAVE_MEMMOVE) |
211 |
|
AC_SUBST(HAVE_STRERROR) |
212 |
|
AC_SUBST(LINK_SIZE) |
213 |
|
AC_SUBST(MATCH_LIMIT) |
214 |
|
AC_SUBST(NEWLINE) |
215 |
|
AC_SUBST(NO_RECURSE) |
216 |
|
AC_SUBST(PCRE_MAJOR) |
217 |
|
AC_SUBST(PCRE_MINOR) |
218 |
|
AC_SUBST(PCRE_DATE) |
219 |
|
AC_SUBST(PCRE_VERSION) |
220 |
|
AC_SUBST(PCRE_LIB_VERSION) |
221 |
|
AC_SUBST(PCRE_POSIXLIB_VERSION) |
222 |
|
AC_SUBST(PCRE_CPPLIB_VERSION) |
223 |
|
AC_SUBST(POSIX_MALLOC_THRESHOLD) |
224 |
|
AC_SUBST(UCP) |
225 |
|
AC_SUBST(UTF8) |
226 |
|
|
227 |
|
dnl Stuff to make MinGW work better. Special treatment is no longer |
228 |
|
dnl needed for Cygwin. |
229 |
|
|
230 |
|
case $host_os in |
231 |
|
mingw* ) |
232 |
|
POSIX_OBJ=pcreposix.o |
233 |
|
POSIX_LOBJ=pcreposix.lo |
234 |
|
POSIX_LIB= |
235 |
|
ON_WINDOWS= |
236 |
|
NOT_ON_WINDOWS="#" |
237 |
|
WIN_PREFIX= |
238 |
|
;; |
239 |
|
* ) |
240 |
|
ON_WINDOWS="#" |
241 |
|
NOT_ON_WINDOWS= |
242 |
|
POSIX_OBJ= |
243 |
|
POSIX_LOBJ= |
244 |
|
POSIX_LIB=libpcreposix.la |
245 |
|
WIN_PREFIX= |
246 |
|
;; |
247 |
|
esac |
248 |
|
AC_SUBST(WIN_PREFIX) |
249 |
|
AC_SUBST(ON_WINDOWS) |
250 |
|
AC_SUBST(NOT_ON_WINDOWS) |
251 |
|
AC_SUBST(POSIX_OBJ) |
252 |
|
AC_SUBST(POSIX_LOBJ) |
253 |
|
AC_SUBST(POSIX_LIB) |
254 |
|
|
255 |
|
if test "x$enable_shared" = "xno" ; then |
256 |
|
AC_DEFINE([PCRE_STATIC],[1],[to link statically]) |
257 |
|
fi |
258 |
|
|
259 |
|
dnl This must be last; it determines what files are written as well as config.h |
260 |
|
AC_OUTPUT(Makefile pcre.h:pcre.in pcre-config:pcre-config.in libpcre.pc:libpcre.pc.in pcrecpp.h:pcrecpp.h.in pcre_stringpiece.h:pcre_stringpiece.h.in RunGrepTest:RunGrepTest.in RunTest:RunTest.in,[chmod a+x RunTest RunGrepTest pcre-config]) |