/[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 75 by nigel, Sat Feb 24 21:40:37 2007 UTC revision 111 by ph10, Thu Mar 8 16:53:09 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 and OpenVMS usage. I (Philip Hazel)  I (Philip Hazel) have no knowledge of Windows or VMS sytems and how their
5  have no knowledge of Windows or VMS sytems and how their libraries work. The  libraries work. The items in the PCRE distribution and Makefile that relate to
6  items in the PCRE Makefile that relate to anything other than Unix-like systems  anything other than Unix-like systems have been contributed by PCRE users and
7  have been contributed by PCRE users. There are some other comments and files in  are untested by me.
8  the Contrib directory on the ftp site that you may find useful. See  
9    There are some other comments and files in the Contrib directory on the ftp
10    site that you may find useful, although a lot of them are now out-of-date. See
11    
12    ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/Contrib    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,  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  for a system that does not support "configure" and "make" files), note that
16  PCRE 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
17  successfully on any system that has a Standard C compiler and library.  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 the PCRE C library "by hand".
24    
25  GENERIC INSTRUCTIONS  (1) Copy or rename the file config.h.generic as config.h, and edit the macro
26        settings that it contains to whatever is appropriate for your environment.
27        In particular, if you want to force a specific value for newline, you can
28        define the NEWLINE macro.
29    
30  The following are generic comments about building PCRE. The interspersed      An alternative approach is not to edit config.h, but to use -D on the
31  indented commands are suggestions from Mark Tetrode as to which commands you      compiler command line to make any changes that you need.
32  might use on a Windows system to build a static library.  
33    (2) Copy or rename the file pcre.h.generic to pcre.h.
 (1) Copy or rename the file config.in as config.h, and change the macros that  
 define HAVE_STRERROR and HAVE_MEMMOVE to define them as 1 rather than 0.  
 Unfortunately, because of the way Unix autoconf works, the default setting has  
 to be 0. You may also want to make changes to other macros in config.h. In  
 particular, if you want to force a specific value for newline, you can define  
 the NEWLINE macro. The default is to use '\n', thereby using whatever value  
 your compiler gives to '\n'.  
   
   rem Mark Tetrode's commands  
   copy config.in config.h  
   rem Use write, because notepad cannot handle UNIX files. Change values.  
   write config.h  
   
 (2) Copy or rename the file pcre.in as pcre.h, and change the macro definitions  
 for PCRE_MAJOR, PCRE_MINOR, and PCRE_DATE near its start to the values set in  
 configure.in.  
   
   rem Mark Tetrode's commands  
   copy pcre.in pcre.h  
   rem Read values from configure.in  
   write configure.in  
   rem Change values  
   write pcre.h  
34    
35  (3) Compile dftables.c as a stand-alone program, and then run it with  (3) Compile dftables.c as a stand-alone program, and then run it with
36  the single argument "chartables.c". This generates a set of standard      the single argument "pcre_chartables.c". This generates a set of standard
37  character tables and writes them to that file.      character tables and writes them to that file.
38    
39    rem Mark Tetrode's commands  (4) Compile the following source files:
   rem Compile & run  
   cl -DSUPPORT_UTF8 dftables.c  
   dftables.exe > chartables.c  
   
 (4) Compile maketables.c, get.c, study.c and pcre.c and link them all  
 together into an object library in whichever form your system keeps such  
 libraries. This is the pcre library (chartables.c is included by means of an  
 #include directive). If your system has static and shared libraries, you may  
 have to do this once for each type.  
   
   rem Mark Tetrode's commands, for a static library  
   rem Compile & lib  
   cl -DSUPPORT_UTF8 -DPOSIX_MALLOC_THRESHOLD=10 /c maketables.c get.c study.c pcre.c  
   lib /OUT:pcre.lib maketables.obj get.obj study.obj pcre.obj  
40    
41  (5) Similarly, compile pcreposix.c and link it (on its own) as the pcreposix        pcre_chartables.c
42  library.        pcre_compile.c
43          pcre_config.c
44          pcre_dfa_exec.c
45          pcre_exec.c
46          pcre_fullinfo.c
47          pcre_get.c
48          pcre_globals.c
49          pcre_info.c
50          pcre_maketables.c
51          pcre_newline.c
52          pcre_ord2utf8.c
53          pcre_refcount.c
54          pcre_study.c
55          pcre_tables.c
56          pcre_try_flipped.c
57          pcre_ucp_searchfuncs.c
58          pcre_valid_utf8.c
59          pcre_version.c
60          pcre_xclass.c
61    
62        Now link them all together into an object library in whichever form your
63        system keeps such libraries. This is the basic PCRE C library. If your
64        system has static and shared libraries, you may have to do this once for
65        each type.
66    
67    rem Mark Tetrode's commands, for a static library  (5) Similarly, compile pcreposix.c and link it (on its own) as the pcreposix
68    rem Compile & lib      library.
   cl -DSUPPORT_UTF8 -DPOSIX_MALLOC_THRESHOLD=10 /c pcreposix.c  
   lib /OUT:pcreposix.lib pcreposix.obj  
69    
70  (6) Compile the test program pcretest.c. This needs the functions in the  (6) Compile the test program pcretest.c. This needs the functions in the
71  pcre and pcreposix libraries when linking.      pcre and pcreposix libraries when linking.
   
   rem Mark Tetrode's commands  
   rem compile & link  
   cl pcretest.c pcre.lib pcreposix.lib  
72    
73  (7) Run pcretest on the testinput files in the testdata directory, and check  (7) Run pcretest on the testinput files in the testdata directory, and check
74  that the output matches the corresponding testoutput files. You must use the      that the output matches the corresponding testoutput files. Note that the
75  -i option when checking testinput2. Note that the supplied files are in Unix      supplied files are in Unix format, with just LF characters as line
76  format, with just LF characters as line terminators. You may need to edit them      terminators. You may need to edit them to change this if your system uses a
77  to change this if your system uses a different convention.      different convention.
78    
79    rem Mark Tetrode's commands  (8) If you want to use the pcregrep command, compile and link pcregrep.c; it
80    rem Make a change, i.e. space, backspace, and save again - do this for all      uses only the basic PCRE library (it does not need the pcreposix library).
81    rem to change UNIX to Win, \n to \n\r  
82    write testoutput1  
83    write testoutput2  THE C++ WRAPPER FUNCTIONS
84    write testoutput3  
85    write testoutput4  The PCRE distribution also contains some C++ wrapper functions and tests,
86    write testoutput5  contributed by Google Inc. On a system that can use "configure" and "make",
87    pcretest testdata\testinput1 testdata\myoutput1  the functions are automatically built into a library called pcrecpp. It should
88    windiff testdata\testoutput1 testdata\myoutput1  be straightforward to compile the .cc files manually on other systems. The
89    pcretest -i testdata\testinput2 testdata\myoutput2  files called xxx_unittest.cc are test programs for each of the corresponding
90    windiff testdata\testoutput2 testdata\myoutput2  xxx.cc files.
91    pcretest testdata\testinput3 testdata\myoutput3  
92    windiff testdata\testoutput3 testdata\myoutput3  
93    pcretest testdata\testinput4 testdata\myoutput4  BUILDING FOR VIRTUAL PASCAL
94    windiff testdata\testoutput4 testdata\myoutput4  
95    pcretest testdata\testinput5 testdata\myoutput5  Stefan Weber contributed the following files in the distribution for building
96    windiff testdata\testoutput5 testdata\myoutput5  PCRE for use with VP/Borland: !compile.txt, !linklib.txt, makevp.bat,
97    pcregexp.pas.
98    
99  FURTHER REMARKS  
100    BUILDING UNDER WINDOWS WITH BCC5.5
101  If you have a system without "configure" but where you can use a Makefile, edit  
102  Makefile.in to create Makefile, substituting suitable values for the variables  Michael Roy sent these comments about building PCRE under Windows with BCC5.5:
103  at the head of the file.  
104      Some of the core BCC libraries have a version of PCRE from 1998 built in,
105      which can lead to pcre_exec() giving an erroneous PCRE_ERROR_NULL from a
106      version mismatch. I'm including an easy workaround below, if you'd like to
107      include it in the non-unix instructions:
108    
109      When linking a project with BCC5.5, pcre.lib must be included before any of
110      the libraries cw32.lib, cw32i.lib, cw32mt.lib, and cw32mti.lib on the command
111      line.
112    
113    
114    OUT-OF-DATE COMMENTS ABOUT WIN32 BUILDS
115    
116    [These comments need looking at by someone who knows about Windows.]
117    
118  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
119  contributed by Paul Sokolovsky. These environments are Mingw32  contributed by Paul Sokolovsky. These environments are Mingw32
# Line 181  void (*pcre_free)(void *) = free; Line 184  void (*pcre_free)(void *) = free;
184    
185  BUILDING PCRE ON OPENVMS  BUILDING PCRE ON OPENVMS
186    
187  Dan Mooney sent the following comments about building PCRE on OpenVMS:  Dan Mooney sent the following comments about building PCRE on OpenVMS. They
188    relate to an older version of PCRE that used fewer source files, so the exact
189    commands will need changing. See the current list of source files above.
190    
191  "It was quite easy to compile and link the library. I don't have a formal  "It was quite easy to compile and link the library. I don't have a formal
192  make file but the attached file [reproduced below] contains the OpenVMS DCL  make file but the attached file [reproduced below] contains the OpenVMS DCL

Legend:
Removed from v.75  
changed lines
  Added in v.111

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12