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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 73 by nigel, Sat Feb 24 21:40:30 2007 UTC revision 93 by nigel, Sat Feb 24 21:41:42 2007 UTC
# Line 1  Line 1 
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  the basic PCRE library consists entirely of code written in Standard C, and so
15  successfully on any machine with a Standard C compiler and library, using  should compile successfully on any system that has a Standard C compiler and
16  normal compiling commands to do the following:  library. The C++ wrapper functions are a separate issue (see below).
17    
18  (1) Copy or rename the file config.in as config.h, and change the macros that  
19    GENERIC INSTRUCTIONS FOR THE C LIBRARY
20    
21    The following are generic comments about building PCRE. The interspersed
22    indented commands are suggestions from Mark Tetrode as to which commands you
23    might use on a Windows system to build a static library.
24    
25    (1) Copy or rename the file config.h.in as config.h, and change the macros that
26  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.
27  Unfortunately, because of the way Unix autoconf works, the default setting has  Unfortunately, because of the way Unix autoconf works, the default setting has
28  to be 0. You may also want to make changes to other macros in config.h. In  to be 0. You may also want to make changes to other macros in config.h. In
# Line 23  particular, if you want to force a speci Line 30  particular, if you want to force a speci
30  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
31  your compiler gives to '\n'.  your compiler gives to '\n'.
32    
33  (2) Copy or rename the file pcre.in as pcre.h, and change the macro definitions    rem Mark Tetrode's commands
34  for PCRE_MAJOR, PCRE_MINOR, and PCRE_DATE near its start to the values set in    copy config.h.in config.h
35  configure.in.    rem Use write, because notepad cannot handle UNIX files. Change values.
36      write config.h
37    
38  (3) Compile dftables.c as a stand-alone program, and then run it with  (2) Compile dftables.c as a stand-alone program, and then run it with
39  the single argument "chartables.c". This generates a set of standard  the single argument "pcre_chartables.c". This generates a set of standard
40  character tables and writes them to that file.  character tables and writes them to that file.
41    
42  (4) Compile maketables.c, get.c, study.c and pcre.c and link them all    rem Mark Tetrode's commands
43  together into an object library in whichever form your system keeps such    rem Compile & run
44  libraries. This is the pcre library (chartables.c is included by means of an    cl -DSUPPORT_UTF8 -DSUPPORT_UCP dftables.c
45  #include directive). If your system has static and shared libraries, you may    dftables.exe pcre_chartables.c
46  have to do this once for each type.  
47    (3) Compile the following source files:
48    
49      pcre_chartables.c
50      pcre_compile.c
51      pcre_config.c
52      pcre_dfa_exec.c
53      pcre_exec.c
54      pcre_fullinfo.c
55      pcre_get.c
56      pcre_globals.c
57      pcre_info.c
58      pcre_maketables.c
59      pcre_newline.c
60      pcre_ord2utf8.c
61      pcre_refcount.c
62      pcre_study.c
63      pcre_tables.c
64      pcre_try_flipped.c
65      pcre_ucp_searchfuncs.c
66      pcre_valid_utf8.c
67      pcre_version.c
68      pcre_xclass.c
69    
70    and link them all together into an object library in whichever form your system
71    keeps such libraries. This is the pcre C library. If your system has static and
72    shared libraries, you may have to do this once for each type.
73    
74      rem These comments are out-of-date, referring to a previous release which
75      rem had fewer source files. Replace with the file names from above.
76      rem Mark Tetrode's commands, for a static library
77      rem Compile & lib
78      cl -DSUPPORT_UTF8 -DSUPPORT_UCP -DPOSIX_MALLOC_THRESHOLD=10 /c maketables.c get.c study.c pcre.c
79      lib /OUT:pcre.lib maketables.obj get.obj study.obj pcre.obj
80    
81  (5) Similarly, compile pcreposix.c and link it (on its own) as the pcreposix  (4) Similarly, compile pcreposix.c and link it (on its own) as the pcreposix
82  library.  library.
83    
84  (6) Compile the test program pcretest.c. This needs the functions in the    rem Mark Tetrode's commands, for a static library
85      rem Compile & lib
86      cl -DSUPPORT_UTF8 -DSUPPORT_UCP -DPOSIX_MALLOC_THRESHOLD=10 /c pcreposix.c
87      lib /OUT:pcreposix.lib pcreposix.obj
88    
89    (5) Compile the test program pcretest.c. This needs the functions in the
90  pcre and pcreposix libraries when linking.  pcre and pcreposix libraries when linking.
91    
92  (7) Run pcretest on the testinput files in the testdata directory, and check    rem Mark Tetrode's commands
93  that the output matches the corresponding testoutput files. You must use the    rem compile & link
94  -i option when checking testinput2. Note that the supplied files are in Unix    cl /F0x400000 pcretest.c pcre.lib pcreposix.lib
95  format, with just LF characters as line terminators. You may need to edit them  
96  to change this if your system uses a different convention.  (6) Run pcretest on the testinput files in the testdata directory, and check
97    that the output matches the corresponding testoutput files. Note that the
98    supplied files are in Unix format, with just LF characters as line terminators.
99    You may need to edit them to change this if your system uses a different
100    convention.
101    
102      rem Mark Tetrode's commands
103      pcretest testdata\testinput1 testdata\myoutput1
104      windiff testdata\testoutput1 testdata\myoutput1
105      pcretest -i testdata\testinput2 testdata\myoutput2
106      windiff testdata\testoutput2 testdata\myoutput2
107      pcretest testdata\testinput3 testdata\myoutput3
108      windiff testdata\testoutput3 testdata\myoutput3
109      pcretest testdata\testinput4 testdata\myoutput4
110      windiff testdata\testoutput4 testdata\myoutput4
111      pcretest testdata\testinput5 testdata\myoutput5
112      windiff testdata\testoutput5 testdata\myoutput5
113      pcretest testdata\testinput6 testdata\myoutput6
114      windiff testdata\testoutput6 testdata\myoutput6
115    
116    Note that there are now three more tests (7, 8, 9) that did not exist when Mark
117    wrote those comments. The test the new pcre_dfa_exec() function.
118    
119    (7) If you want to use the pcregrep command, compile and link pcregrep.c; it
120    uses only the basic PCRE library.
121    
122    
123    THE C++ WRAPPER FUNCTIONS
124    
125    The PCRE distribution now contains some C++ wrapper functions and tests,
126    contributed by Google Inc. On a system that can use "configure" and "make",
127    the functions are automatically built into a library called pcrecpp. It should
128    be straightforward to compile the .cc files manually on other systems. The
129    files called xxx_unittest.cc are test programs for each of the corresponding
130    xxx.cc files.
131    
132    
133    FURTHER REMARKS
134    
135  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
136  Makefile.in to create Makefile, substituting suitable values for the variables  Makefile.in to create Makefile, substituting suitable values for the variables
137  at the head of the file.  at the head of the file.
138    
139    Michael Roy sent these comments about building PCRE under Windows with BCC5.5:
140    
141      Some of the core BCC libraries have a version of PCRE from 1998 built in,
142      which can lead to pcre_exec() giving an erroneous PCRE_ERROR_NULL from a
143      version mismatch. I'm including an easy workaround below, if you'd like to
144      include it in the non-unix instructions:
145    
146      When linking a project with BCC5.5, pcre.lib must be included before any of
147      the libraries cw32.lib, cw32i.lib, cw32mt.lib, and cw32mti.lib on the command
148      line.
149    
150  Some help in building a Win32 DLL of PCRE in GnuWin32 environments was  Some help in building a Win32 DLL of PCRE in GnuWin32 environments was
151  contributed by Paul Sokolovsky. These environments are Mingw32  contributed by Paul Sokolovsky. These environments are Mingw32
152  (http://www.xraylith.wisc.edu/~khan/software/gnu-win32/) and CygWin  (http://www.xraylith.wisc.edu/~khan/software/gnu-win32/) and CygWin
# Line 119  void (*pcre_free)(void *) = free; Line 213  void (*pcre_free)(void *) = free;
213  #endif  #endif
214  =========================  =========================
215    
216    
217    BUILDING PCRE ON OPENVMS
218    
219    Dan Mooney sent the following comments about building PCRE on OpenVMS. They
220    relate to an older version of PCRE that used fewer source files, so the exact
221    commands will need changing. See the current list of source files above.
222    
223    "It was quite easy to compile and link the library. I don't have a formal
224    make file but the attached file [reproduced below] contains the OpenVMS DCL
225    commands I used to build the library. I had to add #define
226    POSIX_MALLOC_THRESHOLD 10 to pcre.h since it was not defined anywhere.
227    
228    The library was built on:
229    O/S: HP OpenVMS v7.3-1
230    Compiler: Compaq C v6.5-001-48BCD
231    Linker: vA13-01
232    
233    The test results did not match 100% due to the issues you mention in your
234    documentation regarding isprint(), iscntrl(), isgraph() and ispunct(). I
235    modified some of the character tables temporarily and was able to get the
236    results to match. Tests using the fr locale did not match since I don't have
237    that locale loaded. The study size was always reported to be 3 less than the
238    value in the standard test output files."
239    
240    =========================
241    $! This DCL procedure builds PCRE on OpenVMS
242    $!
243    $! I followed the instructions in the non-unix-use file in the distribution.
244    $!
245    $ COMPILE == "CC/LIST/NOMEMBER_ALIGNMENT/PREFIX_LIBRARY_ENTRIES=ALL_ENTRIES
246    $ COMPILE DFTABLES.C
247    $ LINK/EXE=DFTABLES.EXE DFTABLES.OBJ
248    $ RUN DFTABLES.EXE/OUTPUT=CHARTABLES.C
249    $ COMPILE MAKETABLES.C
250    $ COMPILE GET.C
251    $ COMPILE STUDY.C
252    $! I had to set POSIX_MALLOC_THRESHOLD to 10 in PCRE.H since the symbol
253    $! did not seem to be defined anywhere.
254    $! I edited pcre.h and added #DEFINE SUPPORT_UTF8 to enable UTF8 support.
255    $ COMPILE PCRE.C
256    $ LIB/CREATE PCRE MAKETABLES.OBJ, GET.OBJ, STUDY.OBJ, PCRE.OBJ
257    $! I had to set POSIX_MALLOC_THRESHOLD to 10 in PCRE.H since the symbol
258    $! did not seem to be defined anywhere.
259    $ COMPILE PCREPOSIX.C
260    $ LIB/CREATE PCREPOSIX PCREPOSIX.OBJ
261    $ COMPILE PCRETEST.C
262    $ LINK/EXE=PCRETEST.EXE PCRETEST.OBJ, PCRE/LIB, PCREPOSIX/LIB
263    $! C programs that want access to command line arguments must be
264    $! defined as a symbol
265    $ PCRETEST :== "$ SYS$ROADSUSERS:[DMOONEY.REGEXP]PCRETEST.EXE"
266    $! Arguments must be enclosed in quotes.
267    $ PCRETEST "-C"
268    $! Test results:
269    $!
270    $!   The test results did not match 100%. The functions isprint(), iscntrl(),
271    $!   isgraph() and ispunct() on OpenVMS must not produce the same results
272    $!   as the system that built the test output files provided with the
273    $!   distribution.
274    $!
275    $!   The study size did not match and was always 3 less on OpenVMS.
276    $!
277    $!   Locale could not be set to fr
278    $!
279    =========================
280    
281  ****  ****

Legend:
Removed from v.73  
changed lines
  Added in v.93

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12