ViewVC logotype

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

Parent Directory Parent Directory | Revision Log Revision Log

Revision 231 - (hide annotations) (download) (as text)
Tue Sep 11 11:15:33 2007 UTC (7 years, 7 months ago) by ph10
File MIME type: text/html
File size: 12290 byte(s)
Add facility to make \R match only CR, LF, or CRLF.

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


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

ViewVC Help
Powered by ViewVC 1.1.12