| 37 |
|
|
| 38 |
The PCRE distribution includes a "configure" file for use by the Configure/Make |
The PCRE distribution includes a "configure" file for use by the Configure/Make |
| 39 |
build system, as found in many Unix-like environments. There is also support |
build system, as found in many Unix-like environments. There is also support |
| 40 |
support for CMake, which some users prefer, especially in Windows environments. |
for CMake, which some users prefer, especially in Windows environments. There |
| 41 |
There are some instructions for CMake under Windows in the section entitled |
are some instructions for CMake under Windows in the section entitled "Building |
| 42 |
"Building PCRE with CMake" below. CMake can also be used to build PCRE in |
PCRE with CMake" below. CMake can also be used to build PCRE in Unix-like |
| 43 |
Unix-like systems. |
systems. |
| 44 |
|
|
| 45 |
|
|
| 46 |
GENERIC INSTRUCTIONS FOR THE PCRE C LIBRARY |
GENERIC INSTRUCTIONS FOR THE PCRE C LIBRARY |
| 47 |
|
|
| 48 |
The following are generic comments about building the PCRE C library "by hand". |
The following are generic instructions for building the PCRE C library "by |
| 49 |
|
hand": |
| 50 |
|
|
| 51 |
(1) Copy or rename the file config.h.generic as config.h, and edit the macro |
(1) Copy or rename the file config.h.generic as config.h, and edit the macro |
| 52 |
settings that it contains to whatever is appropriate for your environment. |
settings that it contains to whatever is appropriate for your environment. |
| 122 |
an unusual compiler) so that all included PCRE header files are first |
an unusual compiler) so that all included PCRE header files are first |
| 123 |
sought in the current directory. Otherwise you run the risk of picking up |
sought in the current directory. Otherwise you run the risk of picking up |
| 124 |
a previously-installed file from somewhere else. |
a previously-installed file from somewhere else. |
| 125 |
|
|
| 126 |
|
(7) If you have defined SUPPORT_JIT in config.h, you must also compile |
| 127 |
|
|
| 128 |
|
pcre_jit_compile.c |
| 129 |
|
|
| 130 |
|
This file #includes sources from the sljit subdirectory, where there |
| 131 |
|
should be 16 files, all of whose names begin with "sljit". |
| 132 |
|
|
| 133 |
(7) Now link all the compiled code into an object library in whichever form |
(8) Now link all the compiled code into an object library in whichever form |
| 134 |
your system keeps such libraries. This is the basic PCRE C library. If |
your system keeps such libraries. This is the basic PCRE C library. If |
| 135 |
your system has static and shared libraries, you may have to do this once |
your system has static and shared libraries, you may have to do this once |
| 136 |
for each type. |
for each type. |
| 137 |
|
|
| 138 |
(8) Similarly, if you want to build the POSIX wrapper functions, ensure that |
(9) Similarly, if you want to build the POSIX wrapper functions, ensure that |
| 139 |
you have the pcreposix.h file and then compile pcreposix.c (remembering |
you have the pcreposix.h file and then compile pcreposix.c (remembering |
| 140 |
-DHAVE_CONFIG_H if necessary). Link the result (on its own) as the |
-DHAVE_CONFIG_H if necessary). Link the result (on its own) as the |
| 141 |
pcreposix library. |
pcreposix library. |
| 142 |
|
|
| 143 |
(9) Compile the test program pcretest.c (again, don't forget -DHAVE_CONFIG_H). |
(10) Compile the test program pcretest.c (again, don't forget -DHAVE_CONFIG_H). |
| 144 |
This needs the functions in the PCRE library when linking. It also needs |
This needs the functions in the PCRE library when linking. It also needs |
| 145 |
the pcreposix wrapper functions unless you compile it with -DNOPOSIX. The |
the pcreposix wrapper functions unless you compile it with -DNOPOSIX. The |
| 146 |
pcretest.c program also needs the pcre_printint.src source file, which it |
pcretest.c program also needs the pcre_printint.src source file, which it |
| 147 |
#includes. |
#includes. |
| 148 |
|
|
| 149 |
(10) Run pcretest on the testinput files in the testdata directory, and check |
(11) Run pcretest on the testinput files in the testdata directory, and check |
| 150 |
that the output matches the corresponding testoutput files. Note that the |
that the output matches the corresponding testoutput files. Some tests are |
| 151 |
supplied files are in Unix format, with just LF characters as line |
relevant only when certain build-time options are selected. For example, |
| 152 |
terminators. You may need to edit them to change this if your system uses |
test 4 is for UTF-8 support, and will not run if you have build PCRE |
| 153 |
a different convention. If you are using Windows, you probably should use |
without it. See the comments at the start of each testinput file. If you |
| 154 |
the wintestinput3 file instead of testinput3 (and the corresponding output |
have a suitable Unix-like shell, the RunTest script will run the |
| 155 |
file). This is a locale test; wintestinput3 sets the locale to "french" |
appropriate tests for you. |
| 156 |
rather than "fr_FR", and there some minor output differences. |
|
| 157 |
|
Note that the supplied files are in Unix format, with just LF characters |
| 158 |
|
as line terminators. You may need to edit them to change this if your |
| 159 |
|
system uses a different convention. If you are using Windows, you probably |
| 160 |
|
should use the wintestinput3 file instead of testinput3 (and the |
| 161 |
|
corresponding output file). This is a locale test; wintestinput3 sets the |
| 162 |
|
locale to "french" rather than "fr_FR", and there some minor output |
| 163 |
|
differences. |
| 164 |
|
|
| 165 |
|
(12) If you have built PCRE with SUPPORT_JIT, the JIT features will be tested |
| 166 |
|
by the testdata files. However, you might also like to build and run |
| 167 |
|
the JIT test program, pcre_jit_test.c. |
| 168 |
|
|
| 169 |
(11) If you want to use the pcregrep command, compile and link pcregrep.c; it |
(13) If you want to use the pcregrep command, compile and link pcregrep.c; it |
| 170 |
uses only the basic PCRE library (it does not need the pcreposix library). |
uses only the basic PCRE library (it does not need the pcreposix library). |
| 171 |
|
|
| 172 |
|
|
| 257 |
|
|
| 258 |
This should create two libraries called libpcre and libpcreposix, and, if you |
This should create two libraries called libpcre and libpcreposix, and, if you |
| 259 |
have enabled building the C++ wrapper, a third one called libpcrecpp. These are |
have enabled building the C++ wrapper, a third one called libpcrecpp. These are |
| 260 |
independent libraries: when you like with libpcreposix or libpcrecpp you must |
independent libraries: when you link with libpcreposix or libpcrecpp you must |
| 261 |
also link with libpcre, which contains the basic functions. (Some earlier |
also link with libpcre, which contains the basic functions. (Some earlier |
| 262 |
releases of PCRE included the basic libpcre functions in libpcreposix. This no |
releases of PCRE included the basic libpcre functions in libpcreposix. This no |
| 263 |
longer happens.) |
longer happens.) |
| 516 |
|
|
| 517 |
|
|
| 518 |
========================= |
========================= |
| 519 |
Last Updated: 26 May 2010 |
Last Updated: 23 August 2011 |
| 520 |
**** |
**** |