1 |
Compiling PCRE on non-Unix systems |
Compiling PCRE on non-Unix systems |
2 |
---------------------------------- |
---------------------------------- |
3 |
|
|
4 |
See below for comments on Cygwin or MinGW usage. I (Philip Hazel) have no |
See below for comments on Cygwin or MinGW and OpenVMS usage. I (Philip Hazel) |
5 |
knowledge of Windows sytems and how their libraries work. The items in the |
have no knowledge of Windows or VMS sytems and how their libraries work. The |
6 |
PCRE Makefile that relate to anything other than Unix-like systems have been |
items in the PCRE Makefile that relate to anything other than Unix-like systems |
7 |
contributed by PCRE users. There are some other comments and files in the |
have been contributed by PCRE users. There are some other comments and files in |
8 |
Contrib directory on the ftp site that you may find useful. |
the Contrib directory on the ftp site that you may find useful. See |
9 |
|
|
10 |
The following are generic comments about building PCRE: |
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/Contrib |
11 |
|
|
12 |
If you want to compile PCRE for a non-Unix system (or perhaps, more strictly, |
If you want to compile PCRE for a non-Unix system (or perhaps, more strictly, |
13 |
for a system that does not support "configure" and make files), note that PCRE |
for a system that does not support "configure" and "make" files), note that |
14 |
consists entirely of code written in Standard C, and so should compile |
PCRE consists entirely of code written in Standard C, and so should compile |
15 |
successfully on any machine with a Standard C compiler and library, using |
successfully on any system that has a Standard C compiler and library. |
16 |
normal compiling commands to do the following: |
|
17 |
|
|
18 |
|
GENERIC INSTRUCTIONS |
19 |
|
|
20 |
|
The following are generic comments about building PCRE. The interspersed |
21 |
|
indented commands are suggestions from Mark Tetrode as to which commands you |
22 |
|
might use on a Windows system to build a static library. |
23 |
|
|
24 |
(1) Copy or rename the file config.in as config.h, and change the macros that |
(1) Copy or rename the file config.in as config.h, and change the macros that |
25 |
define HAVE_STRERROR and HAVE_MEMMOVE to define them as 1 rather than 0. |
define HAVE_STRERROR and HAVE_MEMMOVE to define them as 1 rather than 0. |
29 |
the NEWLINE macro. The default is to use '\n', thereby using whatever value |
the NEWLINE macro. The default is to use '\n', thereby using whatever value |
30 |
your compiler gives to '\n'. |
your compiler gives to '\n'. |
31 |
|
|
32 |
|
rem Mark Tetrode's commands |
33 |
|
copy config.in config.h |
34 |
|
rem Use write, because notepad cannot handle UNIX files. Change values. |
35 |
|
write config.h |
36 |
|
|
37 |
(2) Copy or rename the file pcre.in as pcre.h, and change the macro definitions |
(2) Copy or rename the file pcre.in as pcre.h, and change the macro definitions |
38 |
for PCRE_MAJOR, PCRE_MINOR, and PCRE_DATE near its start to the values set in |
for PCRE_MAJOR, PCRE_MINOR, and PCRE_DATE near its start to the values set in |
39 |
configure.in. |
configure.in. |
40 |
|
|
41 |
|
rem Mark Tetrode's commands |
42 |
|
copy pcre.in pcre.h |
43 |
|
rem Read values from configure.in |
44 |
|
write configure.in |
45 |
|
rem Change values |
46 |
|
write pcre.h |
47 |
|
|
48 |
(3) Compile dftables.c as a stand-alone program, and then run it with |
(3) Compile dftables.c as a stand-alone program, and then run it with |
49 |
the single argument "chartables.c". This generates a set of standard |
the single argument "chartables.c". This generates a set of standard |
50 |
character tables and writes them to that file. |
character tables and writes them to that file. |
51 |
|
|
52 |
|
rem Mark Tetrode's commands |
53 |
|
rem Compile & run |
54 |
|
cl -DSUPPORT_UTF8 dftables.c |
55 |
|
dftables.exe > chartables.c |
56 |
|
|
57 |
(4) Compile maketables.c, get.c, study.c and pcre.c and link them all |
(4) Compile maketables.c, get.c, study.c and pcre.c and link them all |
58 |
together into an object library in whichever form your system keeps such |
together into an object library in whichever form your system keeps such |
59 |
libraries. This is the pcre library (chartables.c is included by means of an |
libraries. This is the pcre library (chartables.c is included by means of an |
60 |
#include directive). If your system has static and shared libraries, you may |
#include directive). If your system has static and shared libraries, you may |
61 |
have to do this once for each type. |
have to do this once for each type. |
62 |
|
|
63 |
|
rem Mark Tetrode's commands, for a static library |
64 |
|
rem Compile & lib |
65 |
|
cl -DSUPPORT_UTF8 -DPOSIX_MALLOC_THRESHOLD=10 /c maketables.c get.c study.c pcre.c |
66 |
|
lib /OUT:pcre.lib maketables.obj get.obj study.obj pcre.obj |
67 |
|
|
68 |
(5) Similarly, compile pcreposix.c and link it (on its own) as the pcreposix |
(5) Similarly, compile pcreposix.c and link it (on its own) as the pcreposix |
69 |
library. |
library. |
70 |
|
|
71 |
|
rem Mark Tetrode's commands, for a static library |
72 |
|
rem Compile & lib |
73 |
|
cl -DSUPPORT_UTF8 -DPOSIX_MALLOC_THRESHOLD=10 /c pcreposix.c |
74 |
|
lib /OUT:pcreposix.lib pcreposix.obj |
75 |
|
|
76 |
(6) Compile the test program pcretest.c. This needs the functions in the |
(6) Compile the test program pcretest.c. This needs the functions in the |
77 |
pcre and pcreposix libraries when linking. |
pcre and pcreposix libraries when linking. |
78 |
|
|
79 |
|
rem Mark Tetrode's commands |
80 |
|
rem compile & link |
81 |
|
cl pcretest.c pcre.lib pcreposix.lib |
82 |
|
|
83 |
(7) Run pcretest on the testinput files in the testdata directory, and check |
(7) Run pcretest on the testinput files in the testdata directory, and check |
84 |
that the output matches the corresponding testoutput files. You must use the |
that the output matches the corresponding testoutput files. You must use the |
85 |
-i option when checking testinput2. Note that the supplied files are in Unix |
-i option when checking testinput2. Note that the supplied files are in Unix |
86 |
format, with just LF characters as line terminators. You may need to edit them |
format, with just LF characters as line terminators. You may need to edit them |
87 |
to change this if your system uses a different convention. |
to change this if your system uses a different convention. |
88 |
|
|
89 |
|
rem Mark Tetrode's commands |
90 |
|
rem Make a change, i.e. space, backspace, and save again - do this for all |
91 |
|
rem to change UNIX to Win, \n to \n\r |
92 |
|
write testoutput1 |
93 |
|
write testoutput2 |
94 |
|
write testoutput3 |
95 |
|
write testoutput4 |
96 |
|
write testoutput5 |
97 |
|
pcretest testdata\testinput1 testdata\myoutput1 |
98 |
|
windiff testdata\testoutput1 testdata\myoutput1 |
99 |
|
pcretest -i testdata\testinput2 testdata\myoutput2 |
100 |
|
windiff testdata\testoutput2 testdata\myoutput2 |
101 |
|
pcretest testdata\testinput3 testdata\myoutput3 |
102 |
|
windiff testdata\testoutput3 testdata\myoutput3 |
103 |
|
pcretest testdata\testinput4 testdata\myoutput4 |
104 |
|
windiff testdata\testoutput4 testdata\myoutput4 |
105 |
|
pcretest testdata\testinput5 testdata\myoutput5 |
106 |
|
windiff testdata\testoutput5 testdata\myoutput5 |
107 |
|
|
108 |
|
|
109 |
|
FURTHER REMARKS |
110 |
|
|
111 |
If you have a system without "configure" but where you can use a Makefile, edit |
If you have a system without "configure" but where you can use a Makefile, edit |
112 |
Makefile.in to create Makefile, substituting suitable values for the variables |
Makefile.in to create Makefile, substituting suitable values for the variables |
113 |
at the head of the file. |
at the head of the file. |
178 |
#endif |
#endif |
179 |
========================= |
========================= |
180 |
|
|
181 |
|
|
182 |
|
BUILDING PCRE ON OPENVMS |
183 |
|
|
184 |
|
Dan Mooney sent the following comments about building PCRE on OpenVMS: |
185 |
|
|
186 |
|
"It was quite easy to compile and link the library. I don't have a formal |
187 |
|
make file but the attached file [reproduced below] contains the OpenVMS DCL |
188 |
|
commands I used to build the library. I had to add #define |
189 |
|
POSIX_MALLOC_THRESHOLD 10 to pcre.h since it was not defined anywhere. |
190 |
|
|
191 |
|
The library was built on: |
192 |
|
O/S: HP OpenVMS v7.3-1 |
193 |
|
Compiler: Compaq C v6.5-001-48BCD |
194 |
|
Linker: vA13-01 |
195 |
|
|
196 |
|
The test results did not match 100% due to the issues you mention in your |
197 |
|
documentation regarding isprint(), iscntrl(), isgraph() and ispunct(). I |
198 |
|
modified some of the character tables temporarily and was able to get the |
199 |
|
results to match. Tests using the fr locale did not match since I don't have |
200 |
|
that locale loaded. The study size was always reported to be 3 less than the |
201 |
|
value in the standard test output files." |
202 |
|
|
203 |
|
========================= |
204 |
|
$! This DCL procedure builds PCRE on OpenVMS |
205 |
|
$! |
206 |
|
$! I followed the instructions in the non-unix-use file in the distribution. |
207 |
|
$! |
208 |
|
$ COMPILE == "CC/LIST/NOMEMBER_ALIGNMENT/PREFIX_LIBRARY_ENTRIES=ALL_ENTRIES |
209 |
|
$ COMPILE DFTABLES.C |
210 |
|
$ LINK/EXE=DFTABLES.EXE DFTABLES.OBJ |
211 |
|
$ RUN DFTABLES.EXE/OUTPUT=CHARTABLES.C |
212 |
|
$ COMPILE MAKETABLES.C |
213 |
|
$ COMPILE GET.C |
214 |
|
$ COMPILE STUDY.C |
215 |
|
$! I had to set POSIX_MALLOC_THRESHOLD to 10 in PCRE.H since the symbol |
216 |
|
$! did not seem to be defined anywhere. |
217 |
|
$! I edited pcre.h and added #DEFINE SUPPORT_UTF8 to enable UTF8 support. |
218 |
|
$ COMPILE PCRE.C |
219 |
|
$ LIB/CREATE PCRE MAKETABLES.OBJ, GET.OBJ, STUDY.OBJ, PCRE.OBJ |
220 |
|
$! I had to set POSIX_MALLOC_THRESHOLD to 10 in PCRE.H since the symbol |
221 |
|
$! did not seem to be defined anywhere. |
222 |
|
$ COMPILE PCREPOSIX.C |
223 |
|
$ LIB/CREATE PCREPOSIX PCREPOSIX.OBJ |
224 |
|
$ COMPILE PCRETEST.C |
225 |
|
$ LINK/EXE=PCRETEST.EXE PCRETEST.OBJ, PCRE/LIB, PCREPOSIX/LIB |
226 |
|
$! C programs that want access to command line arguments must be |
227 |
|
$! defined as a symbol |
228 |
|
$ PCRETEST :== "$ SYS$ROADSUSERS:[DMOONEY.REGEXP]PCRETEST.EXE" |
229 |
|
$! Arguments must be enclosed in quotes. |
230 |
|
$ PCRETEST "-C" |
231 |
|
$! Test results: |
232 |
|
$! |
233 |
|
$! The test results did not match 100%. The functions isprint(), iscntrl(), |
234 |
|
$! isgraph() and ispunct() on OpenVMS must not produce the same results |
235 |
|
$! as the system that built the test output files provided with the |
236 |
|
$! distribution. |
237 |
|
$! |
238 |
|
$! The study size did not match and was always 3 less on OpenVMS. |
239 |
|
$! |
240 |
|
$! Locale could not be set to fr |
241 |
|
$! |
242 |
|
========================= |
243 |
|
|
244 |
**** |
**** |