17 |
uses the POSIX API, it will have to be renamed or pointed at by a link. |
uses the POSIX API, it will have to be renamed or pointed at by a link. |
18 |
|
|
19 |
|
|
20 |
|
Contributions by users of PCRE |
21 |
|
------------------------------ |
22 |
|
|
23 |
|
You can find contributions from PCRE users in the directory |
24 |
|
|
25 |
|
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/Contrib |
26 |
|
|
27 |
|
where there is also a README file giving brief descriptions of what they are. |
28 |
|
Several of them provide support for compiling PCRE on various flavours of |
29 |
|
Windows systems (I myself do not use Windows). Some are complete in themselves; |
30 |
|
others are pointers to URLs containing relevant files. |
31 |
|
|
32 |
|
|
33 |
Building PCRE on a Unix system |
Building PCRE on a Unix system |
34 |
------------------------------ |
------------------------------ |
35 |
|
|
36 |
To build PCRE on a Unix system, run the "configure" command in the PCRE |
To build PCRE on a Unix system, first run the "configure" command from the PCRE |
37 |
distribution directory. This is a standard GNU "autoconf" configuration script, |
distribution directory, with your current directory set to the directory where |
38 |
for which generic instructions are supplied in INSTALL. On many systems just |
you want the files to be created. This command is a standard GNU "autoconf" |
39 |
running "./configure" is sufficient, but the usual methods of changing standard |
configuration script, for which generic instructions are supplied in INSTALL. |
40 |
defaults are available. For example, |
|
41 |
|
Most commonly, people build PCRE within its own distribution directory, and in |
42 |
|
this case, on many systems, just running "./configure" is sufficient, but the |
43 |
|
usual methods of changing standard defaults are available. For example, |
44 |
|
|
45 |
CFLAGS='-O2 -Wall' ./configure --prefix=/opt/local |
CFLAGS='-O2 -Wall' ./configure --prefix=/opt/local |
46 |
|
|
48 |
of the default, and that "make install" should install PCRE under /opt/local |
of the default, and that "make install" should install PCRE under /opt/local |
49 |
instead of the default /usr/local. |
instead of the default /usr/local. |
50 |
|
|
51 |
|
If you want to build in a different directory, just run "configure" with that |
52 |
|
directory as current. For example, suppose you have unpacked the PCRE source |
53 |
|
into /source/pcre/pcre-xxx, but you want to build it in /build/pcre/pcre-xxx: |
54 |
|
|
55 |
|
cd /build/pcre/pcre-xxx |
56 |
|
/source/pcre/pcre-xxx/configure |
57 |
|
|
58 |
If you want to make use of the experimential, incomplete support for UTF-8 |
If you want to make use of the experimential, incomplete support for UTF-8 |
59 |
character strings in PCRE, you must add --enable-utf8 to the "configure" |
character strings in PCRE, you must add --enable-utf8 to the "configure" |
60 |
command. Without it, the code for handling UTF-8 is not included in the |
command. Without it, the code for handling UTF-8 is not included in the |
61 |
library. (Even when included, it still has to be enabled by an option at run |
library. (Even when included, it still has to be enabled by an option at run |
62 |
time.) |
time.) |
63 |
|
|
64 |
The "configure" script builds four files: |
The "configure" script builds five files: |
65 |
|
|
66 |
|
. libtool is a script that builds shared and/or static libraries |
67 |
. Makefile is built by copying Makefile.in and making substitutions. |
. Makefile is built by copying Makefile.in and making substitutions. |
68 |
. config.h is built by copying config.in and making substitutions. |
. config.h is built by copying config.in and making substitutions. |
69 |
. pcre-config is built by copying pcre-config.in and making substitutions. |
. pcre-config is built by copying pcre-config.in and making substitutions. |
71 |
|
|
72 |
Once "configure" has run, you can run "make". It builds two libraries called |
Once "configure" has run, you can run "make". It builds two libraries called |
73 |
libpcre and libpcreposix, a test program called pcretest, and the pcregrep |
libpcre and libpcreposix, a test program called pcretest, and the pcregrep |
74 |
command. You can use "make install" to copy these, and the public header file |
command. You can use "make install" to copy these, the public header files |
75 |
pcre.h, to appropriate live directories on your system, in the normal way. |
pcre.h and pcreposix.h, and the man pages to appropriate live directories on |
76 |
|
your system, in the normal way. |
77 |
|
|
78 |
Running "make install" also installs the command pcre-config, which can be used |
Running "make install" also installs the command pcre-config, which can be used |
79 |
to recall information about the PCRE configuration and installation. For |
to recall information about the PCRE configuration and installation. For |
89 |
included in makefiles for programs that use PCRE, saving the programmer from |
included in makefiles for programs that use PCRE, saving the programmer from |
90 |
having to remember too many details. |
having to remember too many details. |
91 |
|
|
92 |
|
There is one esoteric feature that is controlled by "configure". It concerns |
93 |
|
the character value used for "newline", and is something that you probably do |
94 |
|
not want to change on a Unix system. The default is to use whatever value your |
95 |
|
compiler gives to '\n'. By using --enable-newline-is-cr or |
96 |
|
--enable-newline-is-lf you can force the value to be CR (13) or LF (10) if you |
97 |
|
really want to. |
98 |
|
|
99 |
|
|
100 |
Shared libraries on Unix systems |
Shared libraries on Unix systems |
101 |
-------------------------------- |
-------------------------------- |
102 |
|
|
103 |
The default distribution builds PCRE as two shared libraries. This support is |
The default distribution builds PCRE as two shared libraries and two static |
104 |
new and experimental and may not work on all systems. It relies on the |
libraries, as long as the operating system supports shared libraries. Shared |
105 |
"libtool" scripts - these are distributed with PCRE. It should build a |
library support relies on the "libtool" script which is built as part of the |
106 |
"libtool" script and use this to compile and link shared libraries, which are |
"configure" process. |
107 |
placed in a subdirectory called .libs. The programs pcretest and pcregrep are |
|
108 |
built to use these uninstalled libraries by means of wrapper scripts. When you |
The libtool script is used to compile and link both shared and static |
109 |
use "make install" to install shared libraries, pcregrep and pcretest are |
libraries. They are placed in a subdirectory called .libs when they are newly |
110 |
automatically re-built to use the newly installed libraries. However, only |
built. The programs pcretest and pcregrep are built to use these uninstalled |
111 |
pcregrep is installed, as pcretest is really just a test program. |
libraries (by means of wrapper scripts in the case of shared libraries). When |
112 |
|
you use "make install" to install shared libraries, pcregrep and pcretest are |
113 |
|
automatically re-built to use the newly installed shared libraries before being |
114 |
|
installed themselves. However, the versions left in the source directory still |
115 |
|
use the uninstalled libraries. |
116 |
|
|
117 |
To build PCRE using static libraries you must use --disable-shared when |
To build PCRE using static libraries only you must use --disable-shared when |
118 |
configuring it. For example |
configuring it. For example |
119 |
|
|
120 |
./configure --prefix=/usr/gnu --disable-shared |
./configure --prefix=/usr/gnu --disable-shared |
121 |
|
|
122 |
Then run "make" in the usual way. |
Then run "make" in the usual way. Similarly, you can use --disable-static to |
123 |
|
build only shared libraries. |
124 |
|
|
125 |
|
|
126 |
Building on non-Unix systems |
Building on non-Unix systems |
136 |
Testing PCRE |
Testing PCRE |
137 |
------------ |
------------ |
138 |
|
|
139 |
To test PCRE on a Unix system, run the RunTest script in the pcre directory. |
To test PCRE on a Unix system, run the RunTest script that is created by the |
140 |
(This can also be run by "make runtest", "make check", or "make test".) For |
configuring process. (This can also be run by "make runtest", "make check", or |
141 |
other systems, see the instruction in NON-UNIX-USE. |
"make test".) For other systems, see the instruction in NON-UNIX-USE. |
142 |
|
|
143 |
The script runs the pcretest test program (which is documented in |
The script runs the pcretest test program (which is documented in the doc |
144 |
doc/pcretest.txt) on each of the testinput files (in the testdata directory) in |
directory) on each of the testinput files (in the testdata directory) in turn, |
145 |
turn, and compares the output with the contents of the corresponding testoutput |
and compares the output with the contents of the corresponding testoutput file. |
146 |
file. A file called testtry is used to hold the output from pcretest. To run |
A file called testtry is used to hold the output from pcretest. To run pcretest |
147 |
pcretest on just one of the test files, give its number as an argument to |
on just one of the test files, give its number as an argument to RunTest, for |
148 |
RunTest, for example: |
example: |
149 |
|
|
150 |
RunTest 3 |
RunTest 3 |
151 |
|
|
278 |
doc/pcregrep.html HTML version |
doc/pcregrep.html HTML version |
279 |
doc/pcregrep.txt plain text version |
doc/pcregrep.txt plain text version |
280 |
install-sh a shell script for installing files |
install-sh a shell script for installing files |
281 |
ltconfig ) files used to build "libtool", |
ltmain.sh file used to build a libtool script |
282 |
ltmain.sh ) used only when building a shared library |
pcretest.c comprehensive test program |
283 |
pcretest.c test program |
pcredemo.c simple demonstration of coding calls to PCRE |
284 |
perltest Perl test program |
perltest Perl test program |
285 |
perltest8 Perl test program for UTF-8 tests |
perltest8 Perl test program for UTF-8 tests |
286 |
pcregrep.c source of a grep utility that uses PCRE |
pcregrep.c source of a grep utility that uses PCRE |
304 |
pcre.def |
pcre.def |
305 |
|
|
306 |
Philip Hazel <ph10@cam.ac.uk> |
Philip Hazel <ph10@cam.ac.uk> |
307 |
August 2000 |
August 2001 |