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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 128 - (hide annotations) (download)
Tue Mar 20 11:46:50 2007 UTC (7 years, 4 months ago) by ph10
File size: 10052 byte(s)
Make the use of dftables optional, and not the default. Further tidies to 
documentation.

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 ph10 122 anything other than Unix-like systems are untested by me.
7 nigel 63
8 ph10 101 There are some other comments and files in the Contrib directory on the ftp
9 ph10 128 site that you may find useful. See
10 ph10 101
11 nigel 75 ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/Contrib
12 nigel 41
13 nigel 73 If you want to compile PCRE for a non-Unix system (or perhaps, more strictly,
14 nigel 75 for a system that does not support "configure" and "make" files), note that
15 nigel 87 the basic PCRE library consists entirely of code written in Standard C, and so
16     should compile successfully on any system that has a Standard C compiler and
17     library. The C++ wrapper functions are a separate issue (see below).
18 nigel 73
19 nigel 75
20 nigel 79 GENERIC INSTRUCTIONS FOR THE C LIBRARY
21 nigel 75
22 ph10 111 The following are generic comments about building the PCRE C library "by hand".
23 nigel 75
24 ph10 111 (1) Copy or rename the file config.h.generic as config.h, and edit the macro
25     settings that it contains to whatever is appropriate for your environment.
26     In particular, if you want to force a specific value for newline, you can
27     define the NEWLINE macro.
28 nigel 41
29 ph10 111 An alternative approach is not to edit config.h, but to use -D on the
30     compiler command line to make any changes that you need.
31 nigel 75
32 ph10 122 (2) Copy or rename the file pcre.h.generic as pcre.h.
33 nigel 41
34 ph10 128 (3) EITHER:
35     Copy or rename file pcre_chartables.c.dist as pcre_chartables.c.
36 nigel 75
37 ph10 128 OR:
38     Compile dftables.c as a stand-alone program, and then run it with the
39     single argument "pcre_chartables.c". This generates a set of standard
40     character tables and writes them to that file. The tables are generated
41     using the default C locale for your system. If you want to use a locale
42     that is specified by LC_xxx environment variables, add the -L option to
43     the dftables command. You must use this method if you are building on
44     a system that uses EBCDIC code.
45    
46     The tables in pcre_chartables.c are defaults. The caller of PCRE can
47     specify alternative tables at run time.
48    
49 ph10 111 (4) Compile the following source files:
50 nigel 41
51 ph10 111 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 nigel 79
72 ph10 111 Now link them all together into an object library in whichever form your
73     system keeps such libraries. This is the basic PCRE C library. If your
74     system has static and shared libraries, you may have to do this once for
75     each type.
76 nigel 79
77 ph10 111 (5) Similarly, compile pcreposix.c and link it (on its own) as the pcreposix
78     library.
79 nigel 75
80 ph10 111 (6) Compile the test program pcretest.c. This needs the functions in the
81     pcre and pcreposix libraries when linking.
82 nigel 41
83 ph10 111 (7) Run pcretest on the testinput files in the testdata directory, and check
84     that the output matches the corresponding testoutput files. Note that the
85     supplied files are in Unix format, with just LF characters as line
86     terminators. You may need to edit them to change this if your system uses a
87     different convention.
88 nigel 75
89 ph10 111 (8) If you want to use the pcregrep command, compile and link pcregrep.c; it
90     uses only the basic PCRE library (it does not need the pcreposix library).
91 nigel 41
92 nigel 75
93 nigel 79 THE C++ WRAPPER FUNCTIONS
94    
95 ph10 111 The PCRE distribution also contains some C++ wrapper functions and tests,
96 nigel 79 contributed by Google Inc. On a system that can use "configure" and "make",
97     the functions are automatically built into a library called pcrecpp. It should
98     be straightforward to compile the .cc files manually on other systems. The
99     files called xxx_unittest.cc are test programs for each of the corresponding
100     xxx.cc files.
101    
102    
103 ph10 111 BUILDING FOR VIRTUAL PASCAL
104 nigel 75
105 ph10 128 A script for building PCRE using Borland's C++ compiler for use with VPASCAL
106     was contributed by Alexander Tokarev. Stefan Weber updated the script and added
107     additional files. The following files in the distribution are for building PCRE
108     for use with VP/Borland: makevp-compile.txt, makevp-linklib.txt, makevp.bat,
109     pcregexp.pas.
110 ph10 101
111 ph10 111
112     BUILDING UNDER WINDOWS WITH BCC5.5
113    
114 nigel 93 Michael Roy sent these comments about building PCRE under Windows with BCC5.5:
115    
116     Some of the core BCC libraries have a version of PCRE from 1998 built in,
117     which can lead to pcre_exec() giving an erroneous PCRE_ERROR_NULL from a
118     version mismatch. I'm including an easy workaround below, if you'd like to
119     include it in the non-unix instructions:
120    
121     When linking a project with BCC5.5, pcre.lib must be included before any of
122     the libraries cw32.lib, cw32i.lib, cw32mt.lib, and cw32mti.lib on the command
123     line.
124    
125 ph10 111
126     OUT-OF-DATE COMMENTS ABOUT WIN32 BUILDS
127    
128     [These comments need looking at by someone who knows about Windows.]
129    
130 nigel 41 Some help in building a Win32 DLL of PCRE in GnuWin32 environments was
131 nigel 63 contributed by Paul Sokolovsky. These environments are Mingw32
132     (http://www.xraylith.wisc.edu/~khan/software/gnu-win32/) and CygWin
133     (http://sourceware.cygnus.com/cygwin/). Paul comments:
134 nigel 41
135     For CygWin, set CFLAGS=-mno-cygwin, and do 'make dll'. You'll get
136     pcre.dll (containing pcreposix also), libpcre.dll.a, and dynamically
137     linked pgrep and pcretest. If you have /bin/sh, run RunTest (three
138     main test go ok, locale not supported).
139    
140 nigel 63 Changes to do MinGW with autoconf 2.50 were supplied by Fred Cox
141     <sailorFred@yahoo.com>, who comments as follows:
142    
143     If you are using the PCRE DLL, the normal Unix style configure && make &&
144     make check && make install should just work[*]. If you want to statically
145     link against the .a file, you must define PCRE_STATIC before including
146     pcre.h, otherwise the pcre_malloc and pcre_free exported functions will be
147     declared __declspec(dllimport), with hilarious results. See the configure.in
148     and pcretest.c for how it is done for the static test.
149    
150     Also, there will only be a libpcre.la, not a libpcreposix.la, as you
151     would expect from the Unix version. The single DLL includes the pcreposix
152     interface.
153    
154     [*] But note that the supplied test files are in Unix format, with just LF
155     characters as line terminators. You will have to edit them to change to CR LF
156     terminators.
157    
158     These are some further comments about Win32 builds from Mark Evans. They
159     were contributed before Fred Cox's changes were made, so it is possible that
160     they may no longer be relevant.
161    
162 nigel 73 "The documentation for Win32 builds is a bit shy. Under MSVC6 I
163 nigel 63 followed their instructions to the letter, but there were still
164     some things missing.
165    
166     (1) Must #define STATIC for entire project if linking statically.
167     (I see no reason to use DLLs for code this compact.) This of
168     course is a project setting in MSVC under Preprocessor.
169    
170     (2) Missing some #ifdefs relating to the function pointers
171     pcre_malloc and pcre_free. See my solution below. (The stubs
172 nigel 73 may not be mandatory but they made me feel better.)"
173 nigel 63
174     =========================
175     #ifdef _WIN32
176     #include <malloc.h>
177    
178     void* malloc_stub(size_t N)
179     { return malloc(N); }
180     void free_stub(void* p)
181     { free(p); }
182     void *(*pcre_malloc)(size_t) = &malloc_stub;
183     void (*pcre_free)(void *) = &free_stub;
184    
185     #else
186    
187     void *(*pcre_malloc)(size_t) = malloc;
188     void (*pcre_free)(void *) = free;
189    
190     #endif
191     =========================
192    
193 nigel 75
194     BUILDING PCRE ON OPENVMS
195    
196 nigel 79 Dan Mooney sent the following comments about building PCRE on OpenVMS. They
197     relate to an older version of PCRE that used fewer source files, so the exact
198     commands will need changing. See the current list of source files above.
199 nigel 75
200     "It was quite easy to compile and link the library. I don't have a formal
201     make file but the attached file [reproduced below] contains the OpenVMS DCL
202     commands I used to build the library. I had to add #define
203     POSIX_MALLOC_THRESHOLD 10 to pcre.h since it was not defined anywhere.
204    
205     The library was built on:
206     O/S: HP OpenVMS v7.3-1
207     Compiler: Compaq C v6.5-001-48BCD
208     Linker: vA13-01
209    
210     The test results did not match 100% due to the issues you mention in your
211     documentation regarding isprint(), iscntrl(), isgraph() and ispunct(). I
212     modified some of the character tables temporarily and was able to get the
213     results to match. Tests using the fr locale did not match since I don't have
214     that locale loaded. The study size was always reported to be 3 less than the
215     value in the standard test output files."
216    
217     =========================
218     $! This DCL procedure builds PCRE on OpenVMS
219     $!
220     $! I followed the instructions in the non-unix-use file in the distribution.
221     $!
222     $ COMPILE == "CC/LIST/NOMEMBER_ALIGNMENT/PREFIX_LIBRARY_ENTRIES=ALL_ENTRIES
223     $ COMPILE DFTABLES.C
224     $ LINK/EXE=DFTABLES.EXE DFTABLES.OBJ
225     $ RUN DFTABLES.EXE/OUTPUT=CHARTABLES.C
226     $ COMPILE MAKETABLES.C
227     $ COMPILE GET.C
228     $ COMPILE STUDY.C
229     $! I had to set POSIX_MALLOC_THRESHOLD to 10 in PCRE.H since the symbol
230     $! did not seem to be defined anywhere.
231     $! I edited pcre.h and added #DEFINE SUPPORT_UTF8 to enable UTF8 support.
232     $ COMPILE PCRE.C
233     $ LIB/CREATE PCRE MAKETABLES.OBJ, GET.OBJ, STUDY.OBJ, PCRE.OBJ
234     $! I had to set POSIX_MALLOC_THRESHOLD to 10 in PCRE.H since the symbol
235     $! did not seem to be defined anywhere.
236     $ COMPILE PCREPOSIX.C
237     $ LIB/CREATE PCREPOSIX PCREPOSIX.OBJ
238     $ COMPILE PCRETEST.C
239     $ LINK/EXE=PCRETEST.EXE PCRETEST.OBJ, PCRE/LIB, PCREPOSIX/LIB
240     $! C programs that want access to command line arguments must be
241     $! defined as a symbol
242     $ PCRETEST :== "$ SYS$ROADSUSERS:[DMOONEY.REGEXP]PCRETEST.EXE"
243     $! Arguments must be enclosed in quotes.
244     $ PCRETEST "-C"
245     $! Test results:
246     $!
247     $! The test results did not match 100%. The functions isprint(), iscntrl(),
248     $! isgraph() and ispunct() on OpenVMS must not produce the same results
249     $! as the system that built the test output files provided with the
250     $! distribution.
251     $!
252     $! The study size did not match and was always 3 less on OpenVMS.
253     $!
254     $! Locale could not be set to fr
255     $!
256     =========================
257    
258 ph10 128 Last Updated: 20 March 2007
259 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