/[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 73 - (hide annotations) (download) (as text)
Sat Feb 24 21:40:30 2007 UTC (6 years, 2 months ago) by nigel
File MIME type: text/html
File size: 7078 byte(s)
Load pcre-4.5 into code/trunk.

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     This HTML document has been generated automatically from the original man page.
7     If there is any nonsense in it, please consult the man page, in case the
8     conversion went wrong.<br>
9     <ul>
10     <li><a name="TOC1" href="#SEC1">PCRE BUILD-TIME OPTIONS</a>
11     <li><a name="TOC2" href="#SEC2">UTF-8 SUPPORT</a>
12     <li><a name="TOC3" href="#SEC3">CODE VALUE OF NEWLINE</a>
13     <li><a name="TOC4" href="#SEC4">BUILDING SHARED AND STATIC LIBRARIES</a>
14     <li><a name="TOC5" href="#SEC5">POSIX MALLOC USAGE</a>
15     <li><a name="TOC6" href="#SEC6">LIMITING PCRE RESOURCE USAGE</a>
16     <li><a name="TOC7" href="#SEC7">HANDLING VERY LARGE PATTERNS</a>
17 nigel 73 <li><a name="TOC8" href="#SEC8">AVOIDING EXCESSIVE STACK USAGE</a>
18     <li><a name="TOC9" href="#SEC9">USING EBCDIC CODE</a>
19 nigel 63 </ul>
20     <br><a name="SEC1" href="#TOC1">PCRE BUILD-TIME OPTIONS</a><br>
21     <P>
22     This document describes the optional features of PCRE that can be selected when
23     the library is compiled. They are all selected, or deselected, by providing
24     options to the <b>configure</b> script which is run before the <b>make</b>
25     command. The complete list of options for <b>configure</b> (which includes the
26     standard ones such as the selection of the installation directory) can be
27     obtained by running
28     </P>
29     <P>
30     <pre>
31     ./configure --help
32     </PRE>
33     </P>
34     <P>
35     The following sections describe certain options whose names begin with --enable
36     or --disable. These settings specify changes to the defaults for the
37     <b>configure</b> command. Because of the way that <b>configure</b> works,
38     --enable and --disable always come in pairs, so the complementary option always
39     exists as well, but as it specifies the default, it is not described.
40     </P>
41     <br><a name="SEC2" href="#TOC1">UTF-8 SUPPORT</a><br>
42     <P>
43     To build PCRE with support for UTF-8 character strings, add
44     </P>
45     <P>
46     <pre>
47     --enable-utf8
48     </PRE>
49     </P>
50     <P>
51     to the <b>configure</b> command. Of itself, this does not make PCRE treat
52     strings as UTF-8. As well as compiling PCRE with this option, you also have
53     have to set the PCRE_UTF8 option when you call the <b>pcre_compile()</b>
54     function.
55     </P>
56     <br><a name="SEC3" href="#TOC1">CODE VALUE OF NEWLINE</a><br>
57     <P>
58     By default, PCRE treats character 10 (linefeed) as the newline character. This
59     is the normal newline character on Unix-like systems. You can compile PCRE to
60     use character 13 (carriage return) instead by adding
61     </P>
62     <P>
63     <pre>
64     --enable-newline-is-cr
65     </PRE>
66     </P>
67     <P>
68     to the <b>configure</b> command. For completeness there is also a
69     --enable-newline-is-lf option, which explicitly specifies linefeed as the
70     newline character.
71     </P>
72     <br><a name="SEC4" href="#TOC1">BUILDING SHARED AND STATIC LIBRARIES</a><br>
73     <P>
74     The PCRE building process uses <b>libtool</b> to build both shared and static
75     Unix libraries by default. You can suppress one of these by adding one of
76     </P>
77     <P>
78     <pre>
79     --disable-shared
80     --disable-static
81     </PRE>
82     </P>
83     <P>
84     to the <b>configure</b> command, as required.
85     </P>
86     <br><a name="SEC5" href="#TOC1">POSIX MALLOC USAGE</a><br>
87     <P>
88     When PCRE is called through the POSIX interface (see the <b>pcreposix</b>
89     documentation), additional working storage is required for holding the pointers
90     to capturing substrings because PCRE requires three integers per substring,
91     whereas the POSIX interface provides only two. If the number of expected
92     substrings is small, the wrapper function uses space on the stack, because this
93     is faster than using <b>malloc()</b> for each call. The default threshold above
94     which the stack is no longer used is 10; it can be changed by adding a setting
95     such as
96     </P>
97     <P>
98     <pre>
99     --with-posix-malloc-threshold=20
100     </PRE>
101     </P>
102     <P>
103     to the <b>configure</b> command.
104     </P>
105     <br><a name="SEC6" href="#TOC1">LIMITING PCRE RESOURCE USAGE</a><br>
106     <P>
107     Internally, PCRE has a function called <b>match()</b> which it calls repeatedly
108     (possibly recursively) when performing a matching operation. By limiting the
109     number of times this function may be called, a limit can be placed on the
110     resources used by a single call to <b>pcre_exec()</b>. The limit can be changed
111     at run time, as described in the <b>pcreapi</b> documentation. The default is 10
112     million, but this can be changed by adding a setting such as
113     </P>
114     <P>
115     <pre>
116     --with-match-limit=500000
117     </PRE>
118     </P>
119     <P>
120     to the <b>configure</b> command.
121     </P>
122     <br><a name="SEC7" href="#TOC1">HANDLING VERY LARGE PATTERNS</a><br>
123     <P>
124     Within a compiled pattern, offset values are used to point from one part to
125     another (for example, from an opening parenthesis to an alternation
126     metacharacter). By default two-byte values are used for these offsets, leading
127     to a maximum size for a compiled pattern of around 64K. This is sufficient to
128     handle all but the most gigantic patterns. Nevertheless, some people do want to
129     process enormous patterns, so it is possible to compile PCRE to use three-byte
130     or four-byte offsets by adding a setting such as
131     </P>
132     <P>
133     <pre>
134     --with-link-size=3
135     </PRE>
136     </P>
137     <P>
138     to the <b>configure</b> command. The value given must be 2, 3, or 4. Using
139     longer offsets slows down the operation of PCRE because it has to load
140     additional bytes when handling them.
141     </P>
142     <P>
143     If you build PCRE with an increased link size, test 2 (and test 5 if you are
144     using UTF-8) will fail. Part of the output of these tests is a representation
145     of the compiled pattern, and this changes with the link size.
146     </P>
147 nigel 73 <br><a name="SEC8" href="#TOC1">AVOIDING EXCESSIVE STACK USAGE</a><br>
148 nigel 63 <P>
149 nigel 73 PCRE implements backtracking while matching by making recursive calls to an
150     internal function called <b>match()</b>. In environments where the size of the
151     stack is limited, this can severely limit PCRE's operation. (The Unix
152     environment does not usually suffer from this problem.) An alternative approach
153     that uses memory from the heap to remember data, instead of using recursive
154     function calls, has been implemented to work round this problem. If you want to
155     build a version of PCRE that works this way, add
156     </P>
157     <P>
158     <pre>
159     --disable-stack-for-recursion
160     </PRE>
161     </P>
162     <P>
163     to the <b>configure</b> command. With this configuration, PCRE will use the
164     <b>pcre_stack_malloc</b> and <b>pcre_stack_free</b> variables to call memory
165     management functions. Separate functions are provided because the usage is very
166     predictable: the block sizes requested are always the same, and the blocks are
167     always freed in reverse order. A calling program might be able to implement
168     optimized functions that perform better than the standard <b>malloc()</b> and
169     <b>free()</b> functions. PCRE runs noticeably more slowly when built in this
170     way.
171     </P>
172     <br><a name="SEC9" href="#TOC1">USING EBCDIC CODE</a><br>
173     <P>
174     PCRE assumes by default that it will run in an environment where the character
175     code is ASCII (or UTF-8, which is a superset of ASCII). PCRE can, however, be
176     compiled to run in an EBCDIC environment by adding
177     </P>
178     <P>
179     <pre>
180     --enable-ebcdic
181     </PRE>
182     </P>
183     <P>
184     to the <b>configure</b> command.
185     </P>
186     <P>
187     Last updated: 09 December 2003
188 nigel 63 <br>
189     Copyright &copy; 1997-2003 University of Cambridge.

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12