1 |
<html>
|
2 |
<head>
|
3 |
<title>pcrebuild specification</title>
|
4 |
</head>
|
5 |
<body bgcolor="#FFFFFF" text="#00005A" link="#0066FF" alink="#3399FF" vlink="#2222BB">
|
6 |
<h1>pcrebuild man page</h1>
|
7 |
<p>
|
8 |
Return to the <a href="index.html">PCRE index page</a>.
|
9 |
</p>
|
10 |
<p>
|
11 |
This page is part of the PCRE HTML documentation. It was generated automatically
|
12 |
from the original man page. If there is any nonsense in it, please consult the
|
13 |
man page, in case the conversion went wrong.
|
14 |
<br>
|
15 |
<ul>
|
16 |
<li><a name="TOC1" href="#SEC1">PCRE BUILD-TIME OPTIONS</a>
|
17 |
<li><a name="TOC2" href="#SEC2">C++ SUPPORT</a>
|
18 |
<li><a name="TOC3" href="#SEC3">UTF-8 SUPPORT</a>
|
19 |
<li><a name="TOC4" href="#SEC4">UNICODE CHARACTER PROPERTY SUPPORT</a>
|
20 |
<li><a name="TOC5" href="#SEC5">CODE VALUE OF NEWLINE</a>
|
21 |
<li><a name="TOC6" href="#SEC6">BUILDING SHARED AND STATIC LIBRARIES</a>
|
22 |
<li><a name="TOC7" href="#SEC7">POSIX MALLOC USAGE</a>
|
23 |
<li><a name="TOC8" href="#SEC8">HANDLING VERY LARGE PATTERNS</a>
|
24 |
<li><a name="TOC9" href="#SEC9">AVOIDING EXCESSIVE STACK USAGE</a>
|
25 |
<li><a name="TOC10" href="#SEC10">LIMITING PCRE RESOURCE USAGE</a>
|
26 |
<li><a name="TOC11" href="#SEC11">CREATING CHARACTER TABLES AT BUILD TIME</a>
|
27 |
<li><a name="TOC12" href="#SEC12">USING EBCDIC CODE</a>
|
28 |
<li><a name="TOC13" href="#SEC13">SEE ALSO</a>
|
29 |
<li><a name="TOC14" href="#SEC14">AUTHOR</a>
|
30 |
<li><a name="TOC15" href="#SEC15">REVISION</a>
|
31 |
</ul>
|
32 |
<br><a name="SEC1" href="#TOC1">PCRE BUILD-TIME OPTIONS</a><br>
|
33 |
<P>
|
34 |
This document describes the optional features of PCRE that can be selected when
|
35 |
the library is compiled. They are all selected, or deselected, by providing
|
36 |
options to the <b>configure</b> script that is run before the <b>make</b>
|
37 |
command. The complete list of options for <b>configure</b> (which includes the
|
38 |
standard ones such as the selection of the installation directory) can be
|
39 |
obtained by running
|
40 |
<pre>
|
41 |
./configure --help
|
42 |
</pre>
|
43 |
The following sections include descriptions of options whose names begin with
|
44 |
--enable or --disable. These settings specify changes to the defaults for the
|
45 |
<b>configure</b> command. Because of the way that <b>configure</b> works,
|
46 |
--enable and --disable always come in pairs, so the complementary option always
|
47 |
exists as well, but as it specifies the default, it is not described.
|
48 |
</P>
|
49 |
<br><a name="SEC2" href="#TOC1">C++ SUPPORT</a><br>
|
50 |
<P>
|
51 |
By default, the <b>configure</b> script will search for a C++ compiler and C++
|
52 |
header files. If it finds them, it automatically builds the C++ wrapper library
|
53 |
for PCRE. You can disable this by adding
|
54 |
<pre>
|
55 |
--disable-cpp
|
56 |
</pre>
|
57 |
to the <b>configure</b> command.
|
58 |
</P>
|
59 |
<br><a name="SEC3" href="#TOC1">UTF-8 SUPPORT</a><br>
|
60 |
<P>
|
61 |
To build PCRE with support for UTF-8 character strings, add
|
62 |
<pre>
|
63 |
--enable-utf8
|
64 |
</pre>
|
65 |
to the <b>configure</b> command. Of itself, this does not make PCRE treat
|
66 |
strings as UTF-8. As well as compiling PCRE with this option, you also have
|
67 |
have to set the PCRE_UTF8 option when you call the <b>pcre_compile()</b>
|
68 |
function.
|
69 |
</P>
|
70 |
<br><a name="SEC4" href="#TOC1">UNICODE CHARACTER PROPERTY SUPPORT</a><br>
|
71 |
<P>
|
72 |
UTF-8 support allows PCRE to process character values greater than 255 in the
|
73 |
strings that it handles. On its own, however, it does not provide any
|
74 |
facilities for accessing the properties of such characters. If you want to be
|
75 |
able to use the pattern escapes \P, \p, and \X, which refer to Unicode
|
76 |
character properties, you must add
|
77 |
<pre>
|
78 |
--enable-unicode-properties
|
79 |
</pre>
|
80 |
to the <b>configure</b> command. This implies UTF-8 support, even if you have
|
81 |
not explicitly requested it.
|
82 |
</P>
|
83 |
<P>
|
84 |
Including Unicode property support adds around 30K of tables to the PCRE
|
85 |
library. Only the general category properties such as <i>Lu</i> and <i>Nd</i> are
|
86 |
supported. Details are given in the
|
87 |
<a href="pcrepattern.html"><b>pcrepattern</b></a>
|
88 |
documentation.
|
89 |
</P>
|
90 |
<br><a name="SEC5" href="#TOC1">CODE VALUE OF NEWLINE</a><br>
|
91 |
<P>
|
92 |
By default, PCRE interprets character 10 (linefeed, LF) as indicating the end
|
93 |
of a line. This is the normal newline character on Unix-like systems. You can
|
94 |
compile PCRE to use character 13 (carriage return, CR) instead, by adding
|
95 |
<pre>
|
96 |
--enable-newline-is-cr
|
97 |
</pre>
|
98 |
to the <b>configure</b> command. There is also a --enable-newline-is-lf option,
|
99 |
which explicitly specifies linefeed as the newline character.
|
100 |
<br>
|
101 |
<br>
|
102 |
Alternatively, you can specify that line endings are to be indicated by the two
|
103 |
character sequence CRLF. If you want this, add
|
104 |
<pre>
|
105 |
--enable-newline-is-crlf
|
106 |
</pre>
|
107 |
to the <b>configure</b> command. There is a fourth option, specified by
|
108 |
<pre>
|
109 |
--enable-newline-is-anycrlf
|
110 |
</pre>
|
111 |
which causes PCRE to recognize any of the three sequences CR, LF, or CRLF as
|
112 |
indicating a line ending. Finally, a fifth option, specified by
|
113 |
<pre>
|
114 |
--enable-newline-is-any
|
115 |
</pre>
|
116 |
causes PCRE to recognize any Unicode newline sequence.
|
117 |
</P>
|
118 |
<P>
|
119 |
Whatever line ending convention is selected when PCRE is built can be
|
120 |
overridden when the library functions are called. At build time it is
|
121 |
conventional to use the standard for your operating system.
|
122 |
</P>
|
123 |
<br><a name="SEC6" href="#TOC1">BUILDING SHARED AND STATIC LIBRARIES</a><br>
|
124 |
<P>
|
125 |
The PCRE building process uses <b>libtool</b> to build both shared and static
|
126 |
Unix libraries by default. You can suppress one of these by adding one of
|
127 |
<pre>
|
128 |
--disable-shared
|
129 |
--disable-static
|
130 |
</pre>
|
131 |
to the <b>configure</b> command, as required.
|
132 |
</P>
|
133 |
<br><a name="SEC7" href="#TOC1">POSIX MALLOC USAGE</a><br>
|
134 |
<P>
|
135 |
When PCRE is called through the POSIX interface (see the
|
136 |
<a href="pcreposix.html"><b>pcreposix</b></a>
|
137 |
documentation), additional working storage is required for holding the pointers
|
138 |
to capturing substrings, because PCRE requires three integers per substring,
|
139 |
whereas the POSIX interface provides only two. If the number of expected
|
140 |
substrings is small, the wrapper function uses space on the stack, because this
|
141 |
is faster than using <b>malloc()</b> for each call. The default threshold above
|
142 |
which the stack is no longer used is 10; it can be changed by adding a setting
|
143 |
such as
|
144 |
<pre>
|
145 |
--with-posix-malloc-threshold=20
|
146 |
</pre>
|
147 |
to the <b>configure</b> command.
|
148 |
</P>
|
149 |
<br><a name="SEC8" href="#TOC1">HANDLING VERY LARGE PATTERNS</a><br>
|
150 |
<P>
|
151 |
Within a compiled pattern, offset values are used to point from one part to
|
152 |
another (for example, from an opening parenthesis to an alternation
|
153 |
metacharacter). By default, two-byte values are used for these offsets, leading
|
154 |
to a maximum size for a compiled pattern of around 64K. This is sufficient to
|
155 |
handle all but the most gigantic patterns. Nevertheless, some people do want to
|
156 |
process enormous patterns, so it is possible to compile PCRE to use three-byte
|
157 |
or four-byte offsets by adding a setting such as
|
158 |
<pre>
|
159 |
--with-link-size=3
|
160 |
</pre>
|
161 |
to the <b>configure</b> command. The value given must be 2, 3, or 4. Using
|
162 |
longer offsets slows down the operation of PCRE because it has to load
|
163 |
additional bytes when handling them.
|
164 |
</P>
|
165 |
<br><a name="SEC9" href="#TOC1">AVOIDING EXCESSIVE STACK USAGE</a><br>
|
166 |
<P>
|
167 |
When matching with the <b>pcre_exec()</b> function, PCRE implements backtracking
|
168 |
by making recursive calls to an internal function called <b>match()</b>. In
|
169 |
environments where the size of the stack is limited, this can severely limit
|
170 |
PCRE's operation. (The Unix environment does not usually suffer from this
|
171 |
problem, but it may sometimes be necessary to increase the maximum stack size.
|
172 |
There is a discussion in the
|
173 |
<a href="pcrestack.html"><b>pcrestack</b></a>
|
174 |
documentation.) An alternative approach to recursion that uses memory from the
|
175 |
heap to remember data, instead of using recursive function calls, has been
|
176 |
implemented to work round the problem of limited stack size. If you want to
|
177 |
build a version of PCRE that works this way, add
|
178 |
<pre>
|
179 |
--disable-stack-for-recursion
|
180 |
</pre>
|
181 |
to the <b>configure</b> command. With this configuration, PCRE will use the
|
182 |
<b>pcre_stack_malloc</b> and <b>pcre_stack_free</b> variables to call memory
|
183 |
management functions. By default these point to <b>malloc()</b> and
|
184 |
<b>free()</b>, but you can replace the pointers so that your own functions are
|
185 |
used.
|
186 |
</P>
|
187 |
<P>
|
188 |
Separate functions are provided rather than using <b>pcre_malloc</b> and
|
189 |
<b>pcre_free</b> because the usage is very predictable: the block sizes
|
190 |
requested are always the same, and the blocks are always freed in reverse
|
191 |
order. A calling program might be able to implement optimized functions that
|
192 |
perform better than <b>malloc()</b> and <b>free()</b>. PCRE runs noticeably more
|
193 |
slowly when built in this way. This option affects only the <b>pcre_exec()</b>
|
194 |
function; it is not relevant for the the <b>pcre_dfa_exec()</b> function.
|
195 |
</P>
|
196 |
<br><a name="SEC10" href="#TOC1">LIMITING PCRE RESOURCE USAGE</a><br>
|
197 |
<P>
|
198 |
Internally, PCRE has a function called <b>match()</b>, which it calls repeatedly
|
199 |
(sometimes recursively) when matching a pattern with the <b>pcre_exec()</b>
|
200 |
function. By controlling the maximum number of times this function may be
|
201 |
called during a single matching operation, a limit can be placed on the
|
202 |
resources used by a single call to <b>pcre_exec()</b>. The limit can be changed
|
203 |
at run time, as described in the
|
204 |
<a href="pcreapi.html"><b>pcreapi</b></a>
|
205 |
documentation. The default is 10 million, but this can be changed by adding a
|
206 |
setting such as
|
207 |
<pre>
|
208 |
--with-match-limit=500000
|
209 |
</pre>
|
210 |
to the <b>configure</b> command. This setting has no effect on the
|
211 |
<b>pcre_dfa_exec()</b> matching function.
|
212 |
</P>
|
213 |
<P>
|
214 |
In some environments it is desirable to limit the depth of recursive calls of
|
215 |
<b>match()</b> more strictly than the total number of calls, in order to
|
216 |
restrict the maximum amount of stack (or heap, if --disable-stack-for-recursion
|
217 |
is specified) that is used. A second limit controls this; it defaults to the
|
218 |
value that is set for --with-match-limit, which imposes no additional
|
219 |
constraints. However, you can set a lower limit by adding, for example,
|
220 |
<pre>
|
221 |
--with-match-limit-recursion=10000
|
222 |
</pre>
|
223 |
to the <b>configure</b> command. This value can also be overridden at run time.
|
224 |
</P>
|
225 |
<br><a name="SEC11" href="#TOC1">CREATING CHARACTER TABLES AT BUILD TIME</a><br>
|
226 |
<P>
|
227 |
PCRE uses fixed tables for processing characters whose code values are less
|
228 |
than 256. By default, PCRE is built with a set of tables that are distributed
|
229 |
in the file <i>pcre_chartables.c.dist</i>. These tables are for ASCII codes
|
230 |
only. If you add
|
231 |
<pre>
|
232 |
--enable-rebuild-chartables
|
233 |
</pre>
|
234 |
to the <b>configure</b> command, the distributed tables are no longer used.
|
235 |
Instead, a program called <b>dftables</b> is compiled and run. This outputs the
|
236 |
source for new set of tables, created in the default locale of your C runtime
|
237 |
system. (This method of replacing the tables does not work if you are cross
|
238 |
compiling, because <b>dftables</b> is run on the local host. If you need to
|
239 |
create alternative tables when cross compiling, you will have to do so "by
|
240 |
hand".)
|
241 |
</P>
|
242 |
<br><a name="SEC12" href="#TOC1">USING EBCDIC CODE</a><br>
|
243 |
<P>
|
244 |
PCRE assumes by default that it will run in an environment where the character
|
245 |
code is ASCII (or Unicode, which is a superset of ASCII). PCRE can, however, be
|
246 |
compiled to run in an EBCDIC environment by adding
|
247 |
<pre>
|
248 |
--enable-ebcdic
|
249 |
</pre>
|
250 |
to the <b>configure</b> command. This setting implies
|
251 |
--enable-rebuild-chartables.
|
252 |
</P>
|
253 |
<br><a name="SEC13" href="#TOC1">SEE ALSO</a><br>
|
254 |
<P>
|
255 |
<b>pcreapi</b>(3), <b>pcre_config</b>(3).
|
256 |
</P>
|
257 |
<br><a name="SEC14" href="#TOC1">AUTHOR</a><br>
|
258 |
<P>
|
259 |
Philip Hazel
|
260 |
<br>
|
261 |
University Computing Service
|
262 |
<br>
|
263 |
Cambridge CB2 3QH, England.
|
264 |
<br>
|
265 |
</P>
|
266 |
<br><a name="SEC15" href="#TOC1">REVISION</a><br>
|
267 |
<P>
|
268 |
Last updated: 05 June 2007
|
269 |
<br>
|
270 |
Copyright © 1997-2007 University of Cambridge.
|
271 |
<br>
|
272 |
<p>
|
273 |
Return to the <a href="index.html">PCRE index page</a>.
|
274 |
</p>
|