bottleneck testcase based on rubbos
[bottlenecks.git] / rubbos / app / tomcat-connectors-1.2.32-src / native / iis / pcre / NON-UNIX-USE
1 Compiling PCRE on non-Unix systems
2 ----------------------------------
3
4 See below for comments on Cygwin or MinGW and OpenVMS usage. I (Philip Hazel)
5 have no knowledge of Windows or VMS sytems and how their libraries work. The
6 items in the PCRE Makefile that relate to anything other than Unix-like systems
7 have been contributed by PCRE users. There are some other comments and files in
8 the Contrib directory on the ftp site that you may find useful. See
9
10   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,
13 for a system that does not support "configure" and "make" files), note that
14 PCRE consists entirely of code written in Standard C, and so should compile
15 successfully on any system that has a Standard C compiler and library.
16
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
25 define HAVE_STRERROR and HAVE_MEMMOVE to define them as 1 rather than 0.
26 Unfortunately, because of the way Unix autoconf works, the default setting has
27 to be 0. You may also want to make changes to other macros in config.h. In
28 particular, if you want to force a specific value for newline, you can define
29 the NEWLINE macro. The default is to use '\n', thereby using whatever value
30 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
38 for PCRE_MAJOR, PCRE_MINOR, and PCRE_DATE near its start to the values set in
39 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
49 the single argument "chartables.c". This generates a set of standard
50 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
58 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
60 #include directive). If your system has static and shared libraries, you may
61 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
69 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
77 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
84 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
86 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.
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
112 Makefile.in to create Makefile, substituting suitable values for the variables
113 at the head of the file.
114
115 Some help in building a Win32 DLL of PCRE in GnuWin32 environments was
116 contributed by Paul Sokolovsky. These environments are Mingw32
117 (http://www.xraylith.wisc.edu/~khan/software/gnu-win32/) and CygWin
118 (http://sourceware.cygnus.com/cygwin/). Paul comments:
119
120   For CygWin, set CFLAGS=-mno-cygwin, and do 'make dll'. You'll get
121   pcre.dll (containing pcreposix also), libpcre.dll.a, and dynamically
122   linked pgrep and pcretest. If you have /bin/sh, run RunTest (three
123   main test go ok, locale not supported).
124
125 Changes to do MinGW with autoconf 2.50 were supplied by Fred Cox
126 <sailorFred@yahoo.com>, who comments as follows:
127
128   If you are using the PCRE DLL, the normal Unix style configure && make &&
129   make check && make install should just work[*]. If you want to statically
130   link against the .a file, you must define PCRE_STATIC before including
131   pcre.h, otherwise the pcre_malloc and pcre_free exported functions will be
132   declared __declspec(dllimport), with hilarious results.  See the configure.in
133   and pcretest.c for how it is done for the static test.
134
135   Also, there will only be a libpcre.la, not a libpcreposix.la, as you
136   would expect from the Unix version. The single DLL includes the pcreposix
137   interface.
138
139 [*] But note that the supplied test files are in Unix format, with just LF
140 characters as line terminators. You will have to edit them to change to CR LF
141 terminators.
142
143 A script for building PCRE using Borland's C++ compiler for use with VPASCAL
144 was contributed by Alexander Tokarev. It is called makevp.bat.
145
146 These are some further comments about Win32 builds from Mark Evans. They
147 were contributed before Fred Cox's changes were made, so it is possible that
148 they may no longer be relevant.
149
150 "The documentation for Win32 builds is a bit shy.  Under MSVC6 I
151 followed their instructions to the letter, but there were still
152 some things missing.
153
154 (1) Must #define STATIC for entire project if linking statically.
155     (I see no reason to use DLLs for code this compact.)  This of
156     course is a project setting in MSVC under Preprocessor.
157
158 (2) Missing some #ifdefs relating to the function pointers
159     pcre_malloc and pcre_free.  See my solution below.  (The stubs
160     may not be mandatory but they made me feel better.)"
161
162 =========================
163 #ifdef _WIN32
164 #include <malloc.h>
165
166 void* malloc_stub(size_t N)
167 { return malloc(N); }
168 void free_stub(void* p)
169 { free(p); }
170 void *(*pcre_malloc)(size_t) = &malloc_stub;
171 void  (*pcre_free)(void *) = &free_stub;
172
173 #else
174
175 void *(*pcre_malloc)(size_t) = malloc;
176 void  (*pcre_free)(void *) = free;
177
178 #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 ****