/[pcre]/code/trunk/doc/html/pcrebuild.html
ViewVC logotype

Contents of /code/trunk/doc/html/pcrebuild.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 869 - (show annotations)
Sat Jan 14 11:16:23 2012 UTC (7 years, 9 months ago) by ph10
File MIME type: text/html
File size: 18198 byte(s)
Bring HTML docs up to date.
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">BUILDING 8-BIT and 16-BIT LIBRARIES</a>
18 <li><a name="TOC3" href="#SEC3">BUILDING SHARED AND STATIC LIBRARIES</a>
19 <li><a name="TOC4" href="#SEC4">C++ SUPPORT</a>
20 <li><a name="TOC5" href="#SEC5">UTF-8 and UTF-16 SUPPORT</a>
21 <li><a name="TOC6" href="#SEC6">UNICODE CHARACTER PROPERTY SUPPORT</a>
22 <li><a name="TOC7" href="#SEC7">JUST-IN-TIME COMPILER SUPPORT</a>
23 <li><a name="TOC8" href="#SEC8">CODE VALUE OF NEWLINE</a>
24 <li><a name="TOC9" href="#SEC9">WHAT \R MATCHES</a>
25 <li><a name="TOC10" href="#SEC10">POSIX MALLOC USAGE</a>
26 <li><a name="TOC11" href="#SEC11">HANDLING VERY LARGE PATTERNS</a>
27 <li><a name="TOC12" href="#SEC12">AVOIDING EXCESSIVE STACK USAGE</a>
28 <li><a name="TOC13" href="#SEC13">LIMITING PCRE RESOURCE USAGE</a>
29 <li><a name="TOC14" href="#SEC14">CREATING CHARACTER TABLES AT BUILD TIME</a>
30 <li><a name="TOC15" href="#SEC15">USING EBCDIC CODE</a>
31 <li><a name="TOC16" href="#SEC16">PCREGREP OPTIONS FOR COMPRESSED FILE SUPPORT</a>
32 <li><a name="TOC17" href="#SEC17">PCREGREP BUFFER SIZE</a>
33 <li><a name="TOC18" href="#SEC18">PCRETEST OPTION FOR LIBREADLINE SUPPORT</a>
34 <li><a name="TOC19" href="#SEC19">SEE ALSO</a>
35 <li><a name="TOC20" href="#SEC20">AUTHOR</a>
36 <li><a name="TOC21" href="#SEC21">REVISION</a>
37 </ul>
38 <br><a name="SEC1" href="#TOC1">PCRE BUILD-TIME OPTIONS</a><br>
39 <P>
40 This document describes the optional features of PCRE that can be selected when
41 the library is compiled. It assumes use of the <b>configure</b> script, where
42 the optional features are selected or deselected by providing options to
43 <b>configure</b> before running the <b>make</b> command. However, the same
44 options can be selected in both Unix-like and non-Unix-like environments using
45 the GUI facility of <b>cmake-gui</b> if you are using <b>CMake</b> instead of
46 <b>configure</b> to build PCRE.
47 </P>
48 <P>
49 There is a lot more information about building PCRE in non-Unix-like
50 environments in the file called <i>NON_UNIX_USE</i>, which is part of the PCRE
51 distribution. You should consult this file as well as the <i>README</i> file if
52 you are building in a non-Unix-like environment.
53 </P>
54 <P>
55 The complete list of options for <b>configure</b> (which includes the standard
56 ones such as the selection of the installation directory) can be obtained by
57 running
58 <pre>
59 ./configure --help
60 </pre>
61 The following sections include descriptions of options whose names begin with
62 --enable or --disable. These settings specify changes to the defaults for the
63 <b>configure</b> command. Because of the way that <b>configure</b> works,
64 --enable and --disable always come in pairs, so the complementary option always
65 exists as well, but as it specifies the default, it is not described.
66 </P>
67 <br><a name="SEC2" href="#TOC1">BUILDING 8-BIT and 16-BIT LIBRARIES</a><br>
68 <P>
69 By default, a library called <b>libpcre</b> is built, containing functions that
70 take string arguments contained in vectors of bytes, either as single-byte
71 characters, or interpreted as UTF-8 strings. You can also build a separate
72 library, called <b>libpcre16</b>, in which strings are contained in vectors of
73 16-bit data units and interpreted either as single-unit characters or UTF-16
74 strings, by adding
75 <pre>
76 --enable-pcre16
77 </pre>
78 to the <b>configure</b> command. If you do not want the 8-bit library, add
79 <pre>
80 --disable-pcre8
81 </pre>
82 as well. At least one of the two libraries must be built. Note that the C++ and
83 POSIX wrappers are for the 8-bit library only, and that <b>pcregrep</b> is an
84 8-bit program. None of these are built if you select only the 16-bit library.
85 </P>
86 <br><a name="SEC3" href="#TOC1">BUILDING SHARED AND STATIC LIBRARIES</a><br>
87 <P>
88 The PCRE building process uses <b>libtool</b> to build both shared and static
89 Unix libraries by default. You can suppress one of these by adding one of
90 <pre>
91 --disable-shared
92 --disable-static
93 </pre>
94 to the <b>configure</b> command, as required.
95 </P>
96 <br><a name="SEC4" href="#TOC1">C++ SUPPORT</a><br>
97 <P>
98 By default, if the 8-bit library is being built, the <b>configure</b> script
99 will search for a C++ compiler and C++ header files. If it finds them, it
100 automatically builds the C++ wrapper library (which supports only 8-bit
101 strings). You can disable this by adding
102 <pre>
103 --disable-cpp
104 </pre>
105 to the <b>configure</b> command.
106 </P>
107 <br><a name="SEC5" href="#TOC1">UTF-8 and UTF-16 SUPPORT</a><br>
108 <P>
109 To build PCRE with support for UTF Unicode character strings, add
110 <pre>
111 --enable-utf
112 </pre>
113 to the <b>configure</b> command. This setting applies to both libraries, adding
114 support for UTF-8 to the 8-bit library and support for UTF-16 to the 16-bit
115 library. It is not possible to build one library with UTF support and the other
116 without in the same configuration. (For backwards compatibility, --enable-utf8
117 is a synonym of --enable-utf.)
118 </P>
119 <P>
120 Of itself, this setting does not make PCRE treat strings as UTF-8 or UTF-16. As
121 well as compiling PCRE with this option, you also have have to set the
122 PCRE_UTF8 or PCRE_UTF16 option when you call one of the pattern compiling
123 functions.
124 </P>
125 <P>
126 If you set --enable-utf when compiling in an EBCDIC environment, PCRE expects
127 its input to be either ASCII or UTF-8 (depending on the runtime option). It is
128 not possible to support both EBCDIC and UTF-8 codes in the same version of the
129 library. Consequently, --enable-utf and --enable-ebcdic are mutually
130 exclusive.
131 </P>
132 <br><a name="SEC6" href="#TOC1">UNICODE CHARACTER PROPERTY SUPPORT</a><br>
133 <P>
134 UTF support allows the libraries to process character codepoints up to 0x10ffff
135 in the strings that they handle. On its own, however, it does not provide any
136 facilities for accessing the properties of such characters. If you want to be
137 able to use the pattern escapes \P, \p, and \X, which refer to Unicode
138 character properties, you must add
139 <pre>
140 --enable-unicode-properties
141 </pre>
142 to the <b>configure</b> command. This implies UTF support, even if you have
143 not explicitly requested it.
144 </P>
145 <P>
146 Including Unicode property support adds around 30K of tables to the PCRE
147 library. Only the general category properties such as <i>Lu</i> and <i>Nd</i> are
148 supported. Details are given in the
149 <a href="pcrepattern.html"><b>pcrepattern</b></a>
150 documentation.
151 </P>
152 <br><a name="SEC7" href="#TOC1">JUST-IN-TIME COMPILER SUPPORT</a><br>
153 <P>
154 Just-in-time compiler support is included in the build by specifying
155 <pre>
156 --enable-jit
157 </pre>
158 This support is available only for certain hardware architectures. If this
159 option is set for an unsupported architecture, a compile time error occurs.
160 See the
161 <a href="pcrejit.html"><b>pcrejit</b></a>
162 documentation for a discussion of JIT usage. When JIT support is enabled,
163 pcregrep automatically makes use of it, unless you add
164 <pre>
165 --disable-pcregrep-jit
166 </pre>
167 to the "configure" command.
168 </P>
169 <br><a name="SEC8" href="#TOC1">CODE VALUE OF NEWLINE</a><br>
170 <P>
171 By default, PCRE interprets the linefeed (LF) character as indicating the end
172 of a line. This is the normal newline character on Unix-like systems. You can
173 compile PCRE to use carriage return (CR) instead, by adding
174 <pre>
175 --enable-newline-is-cr
176 </pre>
177 to the <b>configure</b> command. There is also a --enable-newline-is-lf option,
178 which explicitly specifies linefeed as the newline character.
179 <br>
180 <br>
181 Alternatively, you can specify that line endings are to be indicated by the two
182 character sequence CRLF. If you want this, add
183 <pre>
184 --enable-newline-is-crlf
185 </pre>
186 to the <b>configure</b> command. There is a fourth option, specified by
187 <pre>
188 --enable-newline-is-anycrlf
189 </pre>
190 which causes PCRE to recognize any of the three sequences CR, LF, or CRLF as
191 indicating a line ending. Finally, a fifth option, specified by
192 <pre>
193 --enable-newline-is-any
194 </pre>
195 causes PCRE to recognize any Unicode newline sequence.
196 </P>
197 <P>
198 Whatever line ending convention is selected when PCRE is built can be
199 overridden when the library functions are called. At build time it is
200 conventional to use the standard for your operating system.
201 </P>
202 <br><a name="SEC9" href="#TOC1">WHAT \R MATCHES</a><br>
203 <P>
204 By default, the sequence \R in a pattern matches any Unicode newline sequence,
205 whatever has been selected as the line ending sequence. If you specify
206 <pre>
207 --enable-bsr-anycrlf
208 </pre>
209 the default is changed so that \R matches only CR, LF, or CRLF. Whatever is
210 selected when PCRE is built can be overridden when the library functions are
211 called.
212 </P>
213 <br><a name="SEC10" href="#TOC1">POSIX MALLOC USAGE</a><br>
214 <P>
215 When the 8-bit library is called through the POSIX interface (see the
216 <a href="pcreposix.html"><b>pcreposix</b></a>
217 documentation), additional working storage is required for holding the pointers
218 to capturing substrings, because PCRE requires three integers per substring,
219 whereas the POSIX interface provides only two. If the number of expected
220 substrings is small, the wrapper function uses space on the stack, because this
221 is faster than using <b>malloc()</b> for each call. The default threshold above
222 which the stack is no longer used is 10; it can be changed by adding a setting
223 such as
224 <pre>
225 --with-posix-malloc-threshold=20
226 </pre>
227 to the <b>configure</b> command.
228 </P>
229 <br><a name="SEC11" href="#TOC1">HANDLING VERY LARGE PATTERNS</a><br>
230 <P>
231 Within a compiled pattern, offset values are used to point from one part to
232 another (for example, from an opening parenthesis to an alternation
233 metacharacter). By default, two-byte values are used for these offsets, leading
234 to a maximum size for a compiled pattern of around 64K. This is sufficient to
235 handle all but the most gigantic patterns. Nevertheless, some people do want to
236 process truly enormous patterns, so it is possible to compile PCRE to use
237 three-byte or four-byte offsets by adding a setting such as
238 <pre>
239 --with-link-size=3
240 </pre>
241 to the <b>configure</b> command. The value given must be 2, 3, or 4. For the
242 16-bit library, a value of 3 is rounded up to 4. Using longer offsets slows
243 down the operation of PCRE because it has to load additional data when handling
244 them.
245 </P>
246 <br><a name="SEC12" href="#TOC1">AVOIDING EXCESSIVE STACK USAGE</a><br>
247 <P>
248 When matching with the <b>pcre_exec()</b> function, PCRE implements backtracking
249 by making recursive calls to an internal function called <b>match()</b>. In
250 environments where the size of the stack is limited, this can severely limit
251 PCRE's operation. (The Unix environment does not usually suffer from this
252 problem, but it may sometimes be necessary to increase the maximum stack size.
253 There is a discussion in the
254 <a href="pcrestack.html"><b>pcrestack</b></a>
255 documentation.) An alternative approach to recursion that uses memory from the
256 heap to remember data, instead of using recursive function calls, has been
257 implemented to work round the problem of limited stack size. If you want to
258 build a version of PCRE that works this way, add
259 <pre>
260 --disable-stack-for-recursion
261 </pre>
262 to the <b>configure</b> command. With this configuration, PCRE will use the
263 <b>pcre_stack_malloc</b> and <b>pcre_stack_free</b> variables to call memory
264 management functions. By default these point to <b>malloc()</b> and
265 <b>free()</b>, but you can replace the pointers so that your own functions are
266 used instead.
267 </P>
268 <P>
269 Separate functions are provided rather than using <b>pcre_malloc</b> and
270 <b>pcre_free</b> because the usage is very predictable: the block sizes
271 requested are always the same, and the blocks are always freed in reverse
272 order. A calling program might be able to implement optimized functions that
273 perform better than <b>malloc()</b> and <b>free()</b>. PCRE runs noticeably more
274 slowly when built in this way. This option affects only the <b>pcre_exec()</b>
275 function; it is not relevant for <b>pcre_dfa_exec()</b>.
276 </P>
277 <br><a name="SEC13" href="#TOC1">LIMITING PCRE RESOURCE USAGE</a><br>
278 <P>
279 Internally, PCRE has a function called <b>match()</b>, which it calls repeatedly
280 (sometimes recursively) when matching a pattern with the <b>pcre_exec()</b>
281 function. By controlling the maximum number of times this function may be
282 called during a single matching operation, a limit can be placed on the
283 resources used by a single call to <b>pcre_exec()</b>. The limit can be changed
284 at run time, as described in the
285 <a href="pcreapi.html"><b>pcreapi</b></a>
286 documentation. The default is 10 million, but this can be changed by adding a
287 setting such as
288 <pre>
289 --with-match-limit=500000
290 </pre>
291 to the <b>configure</b> command. This setting has no effect on the
292 <b>pcre_dfa_exec()</b> matching function.
293 </P>
294 <P>
295 In some environments it is desirable to limit the depth of recursive calls of
296 <b>match()</b> more strictly than the total number of calls, in order to
297 restrict the maximum amount of stack (or heap, if --disable-stack-for-recursion
298 is specified) that is used. A second limit controls this; it defaults to the
299 value that is set for --with-match-limit, which imposes no additional
300 constraints. However, you can set a lower limit by adding, for example,
301 <pre>
302 --with-match-limit-recursion=10000
303 </pre>
304 to the <b>configure</b> command. This value can also be overridden at run time.
305 </P>
306 <br><a name="SEC14" href="#TOC1">CREATING CHARACTER TABLES AT BUILD TIME</a><br>
307 <P>
308 PCRE uses fixed tables for processing characters whose code values are less
309 than 256. By default, PCRE is built with a set of tables that are distributed
310 in the file <i>pcre_chartables.c.dist</i>. These tables are for ASCII codes
311 only. If you add
312 <pre>
313 --enable-rebuild-chartables
314 </pre>
315 to the <b>configure</b> command, the distributed tables are no longer used.
316 Instead, a program called <b>dftables</b> is compiled and run. This outputs the
317 source for new set of tables, created in the default locale of your C runtime
318 system. (This method of replacing the tables does not work if you are cross
319 compiling, because <b>dftables</b> is run on the local host. If you need to
320 create alternative tables when cross compiling, you will have to do so "by
321 hand".)
322 </P>
323 <br><a name="SEC15" href="#TOC1">USING EBCDIC CODE</a><br>
324 <P>
325 PCRE assumes by default that it will run in an environment where the character
326 code is ASCII (or Unicode, which is a superset of ASCII). This is the case for
327 most computer operating systems. PCRE can, however, be compiled to run in an
328 EBCDIC environment by adding
329 <pre>
330 --enable-ebcdic
331 </pre>
332 to the <b>configure</b> command. This setting implies
333 --enable-rebuild-chartables. You should only use it if you know that you are in
334 an EBCDIC environment (for example, an IBM mainframe operating system). The
335 --enable-ebcdic option is incompatible with --enable-utf.
336 </P>
337 <br><a name="SEC16" href="#TOC1">PCREGREP OPTIONS FOR COMPRESSED FILE SUPPORT</a><br>
338 <P>
339 By default, <b>pcregrep</b> reads all files as plain text. You can build it so
340 that it recognizes files whose names end in <b>.gz</b> or <b>.bz2</b>, and reads
341 them with <b>libz</b> or <b>libbz2</b>, respectively, by adding one or both of
342 <pre>
343 --enable-pcregrep-libz
344 --enable-pcregrep-libbz2
345 </pre>
346 to the <b>configure</b> command. These options naturally require that the
347 relevant libraries are installed on your system. Configuration will fail if
348 they are not.
349 </P>
350 <br><a name="SEC17" href="#TOC1">PCREGREP BUFFER SIZE</a><br>
351 <P>
352 <b>pcregrep</b> uses an internal buffer to hold a "window" on the file it is
353 scanning, in order to be able to output "before" and "after" lines when it
354 finds a match. The size of the buffer is controlled by a parameter whose
355 default value is 20K. The buffer itself is three times this size, but because
356 of the way it is used for holding "before" lines, the longest line that is
357 guaranteed to be processable is the parameter size. You can change the default
358 parameter value by adding, for example,
359 <pre>
360 --with-pcregrep-bufsize=50K
361 </pre>
362 to the <b>configure</b> command. The caller of \fPpcregrep\fP can, however,
363 override this value by specifying a run-time option.
364 </P>
365 <br><a name="SEC18" href="#TOC1">PCRETEST OPTION FOR LIBREADLINE SUPPORT</a><br>
366 <P>
367 If you add
368 <pre>
369 --enable-pcretest-libreadline
370 </pre>
371 to the <b>configure</b> command, <b>pcretest</b> is linked with the
372 <b>libreadline</b> library, and when its input is from a terminal, it reads it
373 using the <b>readline()</b> function. This provides line-editing and history
374 facilities. Note that <b>libreadline</b> is GPL-licensed, so if you distribute a
375 binary of <b>pcretest</b> linked in this way, there may be licensing issues.
376 </P>
377 <P>
378 Setting this option causes the <b>-lreadline</b> option to be added to the
379 <b>pcretest</b> build. In many operating environments with a sytem-installed
380 <b>libreadline</b> this is sufficient. However, in some environments (e.g.
381 if an unmodified distribution version of readline is in use), some extra
382 configuration may be necessary. The INSTALL file for <b>libreadline</b> says
383 this:
384 <pre>
385 "Readline uses the termcap functions, but does not link with the
386 termcap or curses library itself, allowing applications which link
387 with readline the to choose an appropriate library."
388 </pre>
389 If your environment has not been set up so that an appropriate library is
390 automatically included, you may need to add something like
391 <pre>
392 LIBS="-ncurses"
393 </pre>
394 immediately before the <b>configure</b> command.
395 </P>
396 <br><a name="SEC19" href="#TOC1">SEE ALSO</a><br>
397 <P>
398 <b>pcreapi</b>(3), <b>pcre16</b>, <b>pcre_config</b>(3).
399 </P>
400 <br><a name="SEC20" href="#TOC1">AUTHOR</a><br>
401 <P>
402 Philip Hazel
403 <br>
404 University Computing Service
405 <br>
406 Cambridge CB2 3QH, England.
407 <br>
408 </P>
409 <br><a name="SEC21" href="#TOC1">REVISION</a><br>
410 <P>
411 Last updated: 07 January 2012
412 <br>
413 Copyright &copy; 1997-2012 University of Cambridge.
414 <br>
415 <p>
416 Return to the <a href="index.html">PCRE index page</a>.
417 </p>

Properties

Name Value
svn:eol-style native
svn:keywords "Author Date Id Revision Url"

  ViewVC Help
Powered by ViewVC 1.1.5