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