/[pcre]/code/trunk/NON-UNIX-USE
ViewVC logotype

Contents of /code/trunk/NON-UNIX-USE

Parent Directory Parent Directory | Revision Log Revision Log


Revision 101 - (show annotations) (download)
Tue Mar 6 15:19:44 2007 UTC (7 years, 8 months ago) by ph10
File size: 11268 byte(s)
Updated the support (such as it is) for Virtual Pascal, thanks to Stefan 
Weber: (1) pcre_internal.h was missing some function renames; (2) updated 
makevp.bat for the current PCRE, using the additional files !compile.txt, 
!linklib.txt, and pcregexp.pas.

1 Compiling PCRE on non-Unix systems
2 ----------------------------------
3
4 I (Philip Hazel) have no knowledge of Windows or VMS sytems and how their
5 libraries work. The items in the PCRE distribution and Makefile that relate to
6 anything other than Unix-like systems have been contributed by PCRE users and
7 are untested by me.
8
9 There are some other comments and files in the Contrib directory on the ftp
10 site that you may find useful. See
11
12 ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/Contrib
13
14 If you want to compile PCRE for a non-Unix system (or perhaps, more strictly,
15 for a system that does not support "configure" and "make" files), note that
16 the basic PCRE library consists entirely of code written in Standard C, and so
17 should compile successfully on any system that has a Standard C compiler and
18 library. The C++ wrapper functions are a separate issue (see below).
19
20
21 GENERIC INSTRUCTIONS FOR THE C LIBRARY
22
23 The following are generic comments about building PCRE. The interspersed
24 indented commands are suggestions from Mark Tetrode as to which commands you
25 might use on a Windows system to build a static library.
26
27 (1) Copy or rename the file config.h.in as config.h, and change the macros that
28 define HAVE_STRERROR and HAVE_MEMMOVE to define them as 1 rather than 0.
29 Unfortunately, because of the way Unix autoconf works, the default setting has
30 to be 0. You may also want to make changes to other macros in config.h. In
31 particular, if you want to force a specific value for newline, you can define
32 the NEWLINE macro. The default is to use '\n', thereby using whatever value
33 your compiler gives to '\n'.
34
35 rem Mark Tetrode's commands
36 copy config.h.in config.h
37 rem Use write, because notepad cannot handle UNIX files. Change values.
38 write config.h
39
40 (2) Compile dftables.c as a stand-alone program, and then run it with
41 the single argument "pcre_chartables.c". This generates a set of standard
42 character tables and writes them to that file.
43
44 rem Mark Tetrode's commands
45 rem Compile & run
46 cl -DSUPPORT_UTF8 -DSUPPORT_UCP dftables.c
47 dftables.exe pcre_chartables.c
48
49 (3) Compile the following source files:
50
51 pcre_chartables.c
52 pcre_compile.c
53 pcre_config.c
54 pcre_dfa_exec.c
55 pcre_exec.c
56 pcre_fullinfo.c
57 pcre_get.c
58 pcre_globals.c
59 pcre_info.c
60 pcre_maketables.c
61 pcre_newline.c
62 pcre_ord2utf8.c
63 pcre_refcount.c
64 pcre_study.c
65 pcre_tables.c
66 pcre_try_flipped.c
67 pcre_ucp_searchfuncs.c
68 pcre_valid_utf8.c
69 pcre_version.c
70 pcre_xclass.c
71
72 and link them all together into an object library in whichever form your system
73 keeps such libraries. This is the pcre C library. If your system has static and
74 shared libraries, you may have to do this once for each type.
75
76 rem These comments are out-of-date, referring to a previous release which
77 rem had fewer source files. Replace with the file names from above.
78 rem Mark Tetrode's commands, for a static library
79 rem Compile & lib
80 cl -DSUPPORT_UTF8 -DSUPPORT_UCP -DPOSIX_MALLOC_THRESHOLD=10 /c maketables.c get.c study.c pcre.c
81 lib /OUT:pcre.lib maketables.obj get.obj study.obj pcre.obj
82
83 (4) Similarly, compile pcreposix.c and link it (on its own) as the pcreposix
84 library.
85
86 rem Mark Tetrode's commands, for a static library
87 rem Compile & lib
88 cl -DSUPPORT_UTF8 -DSUPPORT_UCP -DPOSIX_MALLOC_THRESHOLD=10 /c pcreposix.c
89 lib /OUT:pcreposix.lib pcreposix.obj
90
91 (5) Compile the test program pcretest.c. This needs the functions in the
92 pcre and pcreposix libraries when linking.
93
94 rem Mark Tetrode's commands
95 rem compile & link
96 cl /F0x400000 pcretest.c pcre.lib pcreposix.lib
97
98 (6) Run pcretest on the testinput files in the testdata directory, and check
99 that the output matches the corresponding testoutput files. Note that the
100 supplied files are in Unix format, with just LF characters as line terminators.
101 You may need to edit them to change this if your system uses a different
102 convention.
103
104 rem Mark Tetrode's commands
105 pcretest testdata\testinput1 testdata\myoutput1
106 windiff testdata\testoutput1 testdata\myoutput1
107 pcretest -i testdata\testinput2 testdata\myoutput2
108 windiff testdata\testoutput2 testdata\myoutput2
109 pcretest testdata\testinput3 testdata\myoutput3
110 windiff testdata\testoutput3 testdata\myoutput3
111 pcretest testdata\testinput4 testdata\myoutput4
112 windiff testdata\testoutput4 testdata\myoutput4
113 pcretest testdata\testinput5 testdata\myoutput5
114 windiff testdata\testoutput5 testdata\myoutput5
115 pcretest testdata\testinput6 testdata\myoutput6
116 windiff testdata\testoutput6 testdata\myoutput6
117
118 Note that there are now three more tests (7, 8, 9) that did not exist when Mark
119 wrote those comments. The test the new pcre_dfa_exec() function.
120
121 (7) If you want to use the pcregrep command, compile and link pcregrep.c; it
122 uses only the basic PCRE library.
123
124
125 THE C++ WRAPPER FUNCTIONS
126
127 The PCRE distribution now contains some C++ wrapper functions and tests,
128 contributed by Google Inc. On a system that can use "configure" and "make",
129 the functions are automatically built into a library called pcrecpp. It should
130 be straightforward to compile the .cc files manually on other systems. The
131 files called xxx_unittest.cc are test programs for each of the corresponding
132 xxx.cc files.
133
134
135 FURTHER REMARKS
136
137 If you have a system without "configure" but where you can use a Makefile, edit
138 Makefile.in to create Makefile, substituting suitable values for the variables
139 at the head of the file.
140
141 Stefan Weber contributed the following files in the distribution for building
142 PCRE for use with VP/Borland: !compile.txt, !linklib.txt, makevp.bat,
143 pcregexp.pas.
144
145 Michael Roy sent these comments about building PCRE under Windows with BCC5.5:
146
147 Some of the core BCC libraries have a version of PCRE from 1998 built in,
148 which can lead to pcre_exec() giving an erroneous PCRE_ERROR_NULL from a
149 version mismatch. I'm including an easy workaround below, if you'd like to
150 include it in the non-unix instructions:
151
152 When linking a project with BCC5.5, pcre.lib must be included before any of
153 the libraries cw32.lib, cw32i.lib, cw32mt.lib, and cw32mti.lib on the command
154 line.
155
156 Some help in building a Win32 DLL of PCRE in GnuWin32 environments was
157 contributed by Paul Sokolovsky. These environments are Mingw32
158 (http://www.xraylith.wisc.edu/~khan/software/gnu-win32/) and CygWin
159 (http://sourceware.cygnus.com/cygwin/). Paul comments:
160
161 For CygWin, set CFLAGS=-mno-cygwin, and do 'make dll'. You'll get
162 pcre.dll (containing pcreposix also), libpcre.dll.a, and dynamically
163 linked pgrep and pcretest. If you have /bin/sh, run RunTest (three
164 main test go ok, locale not supported).
165
166 Changes to do MinGW with autoconf 2.50 were supplied by Fred Cox
167 <sailorFred@yahoo.com>, who comments as follows:
168
169 If you are using the PCRE DLL, the normal Unix style configure && make &&
170 make check && make install should just work[*]. If you want to statically
171 link against the .a file, you must define PCRE_STATIC before including
172 pcre.h, otherwise the pcre_malloc and pcre_free exported functions will be
173 declared __declspec(dllimport), with hilarious results. See the configure.in
174 and pcretest.c for how it is done for the static test.
175
176 Also, there will only be a libpcre.la, not a libpcreposix.la, as you
177 would expect from the Unix version. The single DLL includes the pcreposix
178 interface.
179
180 [*] But note that the supplied test files are in Unix format, with just LF
181 characters as line terminators. You will have to edit them to change to CR LF
182 terminators.
183
184 A script for building PCRE using Borland's C++ compiler for use with VPASCAL
185 was contributed by Alexander Tokarev. It is called makevp.bat.
186
187 These are some further comments about Win32 builds from Mark Evans. They
188 were contributed before Fred Cox's changes were made, so it is possible that
189 they may no longer be relevant.
190
191 "The documentation for Win32 builds is a bit shy. Under MSVC6 I
192 followed their instructions to the letter, but there were still
193 some things missing.
194
195 (1) Must #define STATIC for entire project if linking statically.
196 (I see no reason to use DLLs for code this compact.) This of
197 course is a project setting in MSVC under Preprocessor.
198
199 (2) Missing some #ifdefs relating to the function pointers
200 pcre_malloc and pcre_free. See my solution below. (The stubs
201 may not be mandatory but they made me feel better.)"
202
203 =========================
204 #ifdef _WIN32
205 #include <malloc.h>
206
207 void* malloc_stub(size_t N)
208 { return malloc(N); }
209 void free_stub(void* p)
210 { free(p); }
211 void *(*pcre_malloc)(size_t) = &malloc_stub;
212 void (*pcre_free)(void *) = &free_stub;
213
214 #else
215
216 void *(*pcre_malloc)(size_t) = malloc;
217 void (*pcre_free)(void *) = free;
218
219 #endif
220 =========================
221
222
223 BUILDING PCRE ON OPENVMS
224
225 Dan Mooney sent the following comments about building PCRE on OpenVMS. They
226 relate to an older version of PCRE that used fewer source files, so the exact
227 commands will need changing. See the current list of source files above.
228
229 "It was quite easy to compile and link the library. I don't have a formal
230 make file but the attached file [reproduced below] contains the OpenVMS DCL
231 commands I used to build the library. I had to add #define
232 POSIX_MALLOC_THRESHOLD 10 to pcre.h since it was not defined anywhere.
233
234 The library was built on:
235 O/S: HP OpenVMS v7.3-1
236 Compiler: Compaq C v6.5-001-48BCD
237 Linker: vA13-01
238
239 The test results did not match 100% due to the issues you mention in your
240 documentation regarding isprint(), iscntrl(), isgraph() and ispunct(). I
241 modified some of the character tables temporarily and was able to get the
242 results to match. Tests using the fr locale did not match since I don't have
243 that locale loaded. The study size was always reported to be 3 less than the
244 value in the standard test output files."
245
246 =========================
247 $! This DCL procedure builds PCRE on OpenVMS
248 $!
249 $! I followed the instructions in the non-unix-use file in the distribution.
250 $!
251 $ COMPILE == "CC/LIST/NOMEMBER_ALIGNMENT/PREFIX_LIBRARY_ENTRIES=ALL_ENTRIES
252 $ COMPILE DFTABLES.C
253 $ LINK/EXE=DFTABLES.EXE DFTABLES.OBJ
254 $ RUN DFTABLES.EXE/OUTPUT=CHARTABLES.C
255 $ COMPILE MAKETABLES.C
256 $ COMPILE GET.C
257 $ COMPILE STUDY.C
258 $! I had to set POSIX_MALLOC_THRESHOLD to 10 in PCRE.H since the symbol
259 $! did not seem to be defined anywhere.
260 $! I edited pcre.h and added #DEFINE SUPPORT_UTF8 to enable UTF8 support.
261 $ COMPILE PCRE.C
262 $ LIB/CREATE PCRE MAKETABLES.OBJ, GET.OBJ, STUDY.OBJ, PCRE.OBJ
263 $! I had to set POSIX_MALLOC_THRESHOLD to 10 in PCRE.H since the symbol
264 $! did not seem to be defined anywhere.
265 $ COMPILE PCREPOSIX.C
266 $ LIB/CREATE PCREPOSIX PCREPOSIX.OBJ
267 $ COMPILE PCRETEST.C
268 $ LINK/EXE=PCRETEST.EXE PCRETEST.OBJ, PCRE/LIB, PCREPOSIX/LIB
269 $! C programs that want access to command line arguments must be
270 $! defined as a symbol
271 $ PCRETEST :== "$ SYS$ROADSUSERS:[DMOONEY.REGEXP]PCRETEST.EXE"
272 $! Arguments must be enclosed in quotes.
273 $ PCRETEST "-C"
274 $! Test results:
275 $!
276 $! The test results did not match 100%. The functions isprint(), iscntrl(),
277 $! isgraph() and ispunct() on OpenVMS must not produce the same results
278 $! as the system that built the test output files provided with the
279 $! distribution.
280 $!
281 $! The study size did not match and was always 3 less on OpenVMS.
282 $!
283 $! Locale could not be set to fr
284 $!
285 =========================
286
287 ****

Properties

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

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12