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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 456 - (hide annotations) (download)
Fri Oct 2 08:53:31 2009 UTC (4 years, 6 months ago) by ph10
File size: 12880 byte(s)
Documentation update

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

Properties

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

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12