/[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 - (hide annotations) (download)
Tue Mar 6 15:19:44 2007 UTC (7 years, 6 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 nigel 41 Compiling PCRE on non-Unix systems
2     ----------------------------------
3    
4 ph10 101 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 nigel 63
9 ph10 101 There are some other comments and files in the Contrib directory on the ftp
10     site that you may find useful. See
11    
12 nigel 75 ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/Contrib
13 nigel 41
14 nigel 73 If you want to compile PCRE for a non-Unix system (or perhaps, more strictly,
15 nigel 75 for a system that does not support "configure" and "make" files), note that
16 nigel 87 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 nigel 73
20 nigel 75
21 nigel 79 GENERIC INSTRUCTIONS FOR THE C LIBRARY
22 nigel 75
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 nigel 93 (1) Copy or rename the file config.h.in as config.h, and change the macros that
28 nigel 43 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 nigel 53 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 nigel 41
35 nigel 75 rem Mark Tetrode's commands
36 nigel 93 copy config.h.in config.h
37 nigel 75 rem Use write, because notepad cannot handle UNIX files. Change values.
38     write config.h
39    
40 nigel 87 (2) Compile dftables.c as a stand-alone program, and then run it with
41 nigel 85 the single argument "pcre_chartables.c". This generates a set of standard
42 nigel 73 character tables and writes them to that file.
43 nigel 41
44 nigel 75 rem Mark Tetrode's commands
45     rem Compile & run
46 nigel 77 cl -DSUPPORT_UTF8 -DSUPPORT_UCP dftables.c
47 nigel 87 dftables.exe pcre_chartables.c
48 nigel 75
49 nigel 87 (3) Compile the following source files:
50 nigel 41
51 nigel 79 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 nigel 93 pcre_newline.c
62 nigel 79 pcre_ord2utf8.c
63     pcre_refcount.c
64     pcre_study.c
65     pcre_tables.c
66     pcre_try_flipped.c
67 nigel 87 pcre_ucp_searchfuncs.c
68 nigel 79 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 nigel 75 rem Mark Tetrode's commands, for a static library
79     rem Compile & lib
80 nigel 77 cl -DSUPPORT_UTF8 -DSUPPORT_UCP -DPOSIX_MALLOC_THRESHOLD=10 /c maketables.c get.c study.c pcre.c
81 nigel 75 lib /OUT:pcre.lib maketables.obj get.obj study.obj pcre.obj
82    
83 nigel 87 (4) Similarly, compile pcreposix.c and link it (on its own) as the pcreposix
84 nigel 73 library.
85 nigel 41
86 nigel 75 rem Mark Tetrode's commands, for a static library
87     rem Compile & lib
88 nigel 77 cl -DSUPPORT_UTF8 -DSUPPORT_UCP -DPOSIX_MALLOC_THRESHOLD=10 /c pcreposix.c
89 nigel 75 lib /OUT:pcreposix.lib pcreposix.obj
90    
91 nigel 87 (5) Compile the test program pcretest.c. This needs the functions in the
92 nigel 41 pcre and pcreposix libraries when linking.
93    
94 nigel 75 rem Mark Tetrode's commands
95     rem compile & link
96 nigel 77 cl /F0x400000 pcretest.c pcre.lib pcreposix.lib
97 nigel 75
98 nigel 87 (6) Run pcretest on the testinput files in the testdata directory, and check
99 nigel 93 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 nigel 41
104 nigel 75 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 nigel 77 pcretest testdata\testinput6 testdata\myoutput6
116     windiff testdata\testoutput6 testdata\myoutput6
117 nigel 75
118 nigel 79 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 nigel 75
121 nigel 87 (7) If you want to use the pcregrep command, compile and link pcregrep.c; it
122     uses only the basic PCRE library.
123 nigel 79
124 nigel 87
125 nigel 79 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 nigel 75 FURTHER REMARKS
136    
137 nigel 41 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 ph10 101 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 nigel 93 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 nigel 41 Some help in building a Win32 DLL of PCRE in GnuWin32 environments was
157 nigel 63 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 nigel 41
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 nigel 63 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 nigel 73 "The documentation for Win32 builds is a bit shy. Under MSVC6 I
192 nigel 63 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 nigel 73 may not be mandatory but they made me feel better.)"
202 nigel 63
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 nigel 75
223     BUILDING PCRE ON OPENVMS
224    
225 nigel 79 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 nigel 75
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 nigel 41 ****

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