| 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 |
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 |
the basic PCRE library consists entirely of code written in Standard C, and so |
| 15 |
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 |
| 16 |
|
library. The C++ wrapper functions are a separate issue (see below). |
| 17 |
|
|
| 18 |
|
|
| 19 |
GENERIC INSTRUCTIONS FOR THE C LIBRARY |
GENERIC INSTRUCTIONS FOR THE C LIBRARY |
| 22 |
indented commands are suggestions from Mark Tetrode as to which commands you |
indented commands are suggestions from Mark Tetrode as to which commands you |
| 23 |
might use on a Windows system to build a static library. |
might use on a Windows system to build a static library. |
| 24 |
|
|
| 25 |
(1) Copy or rename the file config.in as config.h, and change the macros that |
(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 |
| 31 |
your compiler gives to '\n'. |
your compiler gives to '\n'. |
| 32 |
|
|
| 33 |
rem Mark Tetrode's commands |
rem Mark Tetrode's commands |
| 34 |
copy config.in config.h |
copy config.h.in config.h |
| 35 |
rem Use write, because notepad cannot handle UNIX files. Change values. |
rem Use write, because notepad cannot handle UNIX files. Change values. |
| 36 |
write config.h |
write config.h |
| 37 |
|
|
| 38 |
(2) Copy or rename the file pcre.in as pcre.h, and change the macro definitions |
(2) Compile dftables.c as a stand-alone program, and then run it with |
| 39 |
for PCRE_MAJOR, PCRE_MINOR, and PCRE_DATE near its start to the values set in |
the single argument "pcre_chartables.c". This generates a set of standard |
|
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 |
|
|
|
|
|
(3) Compile dftables.c as a stand-alone program, and then run it with |
|
|
the single argument "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 |
rem Mark Tetrode's commands |
rem Mark Tetrode's commands |
| 43 |
rem Compile & run |
rem Compile & run |
| 44 |
cl -DSUPPORT_UTF8 -DSUPPORT_UCP dftables.c |
cl -DSUPPORT_UTF8 -DSUPPORT_UCP dftables.c |
| 45 |
dftables.exe chartables.c |
dftables.exe pcre_chartables.c |
| 46 |
|
|
| 47 |
(4) Compile the following source files: |
(3) Compile the following source files: |
| 48 |
|
|
| 49 |
pcre_chartables.c |
pcre_chartables.c |
| 50 |
pcre_compile.c |
pcre_compile.c |
| 56 |
pcre_globals.c |
pcre_globals.c |
| 57 |
pcre_info.c |
pcre_info.c |
| 58 |
pcre_maketables.c |
pcre_maketables.c |
| 59 |
|
pcre_newline.c |
| 60 |
pcre_ord2utf8.c |
pcre_ord2utf8.c |
|
pcre_printint.c |
|
| 61 |
pcre_refcount.c |
pcre_refcount.c |
| 62 |
pcre_study.c |
pcre_study.c |
| 63 |
pcre_tables.c |
pcre_tables.c |
| 64 |
pcre_try_flipped.c |
pcre_try_flipped.c |
| 65 |
pcre_ucp_findchar.c |
pcre_ucp_searchfuncs.c |
| 66 |
pcre_valid_utf8.c |
pcre_valid_utf8.c |
| 67 |
pcre_version.c |
pcre_version.c |
| 68 |
pcre_xclass.c |
pcre_xclass.c |
| 78 |
cl -DSUPPORT_UTF8 -DSUPPORT_UCP -DPOSIX_MALLOC_THRESHOLD=10 /c maketables.c get.c study.c pcre.c |
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 |
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 |
rem Mark Tetrode's commands, for a static library |
rem Mark Tetrode's commands, for a static library |
| 86 |
cl -DSUPPORT_UTF8 -DSUPPORT_UCP -DPOSIX_MALLOC_THRESHOLD=10 /c pcreposix.c |
cl -DSUPPORT_UTF8 -DSUPPORT_UCP -DPOSIX_MALLOC_THRESHOLD=10 /c pcreposix.c |
| 87 |
lib /OUT:pcreposix.lib pcreposix.obj |
lib /OUT:pcreposix.lib pcreposix.obj |
| 88 |
|
|
| 89 |
(6) Compile the test program pcretest.c. This needs the functions in the |
(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 |
rem Mark Tetrode's commands |
rem Mark Tetrode's commands |
| 93 |
rem compile & link |
rem compile & link |
| 94 |
cl /F0x400000 pcretest.c pcre.lib pcreposix.lib |
cl /F0x400000 pcretest.c pcre.lib pcreposix.lib |
| 95 |
|
|
| 96 |
(7) Run pcretest on the testinput files in the testdata directory, and check |
(6) Run pcretest on the testinput files in the testdata directory, and check |
| 97 |
that the output matches the corresponding testoutput files. You must use the |
that the output matches the corresponding testoutput files. Note that the |
| 98 |
-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 terminators. |
| 99 |
format, with just LF characters as line terminators. You may need to edit them |
You may need to edit them to change this if your system uses a different |
| 100 |
to change this if your system uses a different convention. |
convention. |
| 101 |
|
|
| 102 |
rem Mark Tetrode's commands |
rem Mark Tetrode's commands |
| 103 |
pcretest testdata\testinput1 testdata\myoutput1 |
pcretest testdata\testinput1 testdata\myoutput1 |
| 116 |
Note that there are now three more tests (7, 8, 9) that did not exist when Mark |
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. |
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 |
THE C++ WRAPPER FUNCTIONS |
| 124 |
|
|
| 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 |