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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.5