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