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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.5