Home | History | Annotate | Download | only in dist
      1 Building PCRE without using autotools
      2 -------------------------------------
      3 
      4 NOTE: This document relates to PCRE releases that use the original API, with
      5 library names libpcre, libpcre16, and libpcre32. January 2015 saw the first
      6 release of a new API, known as PCRE2, with release numbers starting at 10.00
      7 and library names libpcre2-8, libpcre2-16, and libpcre2-32. The old libraries
      8 (now called PCRE1) are still being maintained for bug fixes, but there will be
      9 no new development. New projects are advised to use the new PCRE2 libraries.
     10 
     11 
     12 This document contains the following sections:
     13 
     14   General
     15   Generic instructions for the PCRE C library
     16   The C++ wrapper functions
     17   Building for virtual Pascal
     18   Stack size in Windows environments
     19   Linking programs in Windows environments
     20   Calling conventions in Windows environments
     21   Comments about Win32 builds
     22   Building PCRE on Windows with CMake
     23   Use of relative paths with CMake on Windows
     24   Testing with RunTest.bat
     25   Building under Windows CE with Visual Studio 200x
     26   Building under Windows with BCC5.5
     27   Building using Borland C++ Builder 2007 (CB2007) and higher
     28   Building PCRE on OpenVMS
     29   Building PCRE on Stratus OpenVOS
     30   Building PCRE on native z/OS and z/VM
     31 
     32 
     33 GENERAL
     34 
     35 I (Philip Hazel) have no experience of Windows or VMS sytems and how their
     36 libraries work. The items in the PCRE distribution and Makefile that relate to
     37 anything other than Linux systems are untested by me.
     38 
     39 There are some other comments and files (including some documentation in CHM
     40 format) in the Contrib directory on the FTP site:
     41 
     42   ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/Contrib
     43 
     44 The basic PCRE library consists entirely of code written in Standard C, and so
     45 should compile successfully on any system that has a Standard C compiler and
     46 library. The C++ wrapper functions are a separate issue (see below).
     47 
     48 The PCRE distribution includes a "configure" file for use by the configure/make
     49 (autotools) build system, as found in many Unix-like environments. The README
     50 file contains information about the options for "configure".
     51 
     52 There is also support for CMake, which some users prefer, especially in Windows
     53 environments, though it can also be run in Unix-like environments. See the
     54 section entitled "Building PCRE on Windows with CMake" below.
     55 
     56 Versions of config.h and pcre.h are distributed in the PCRE tarballs under the
     57 names config.h.generic and pcre.h.generic. These are provided for those who
     58 build PCRE without using "configure" or CMake. If you use "configure" or CMake,
     59 the .generic versions are not used.
     60 
     61 
     62 GENERIC INSTRUCTIONS FOR THE PCRE C LIBRARY
     63 
     64 The following are generic instructions for building the PCRE C library "by
     65 hand". If you are going to use CMake, this section does not apply to you; you
     66 can skip ahead to the CMake section.
     67 
     68  (1) Copy or rename the file config.h.generic as config.h, and edit the macro
     69      settings that it contains to whatever is appropriate for your environment.
     70 
     71      In particular, you can alter the definition of the NEWLINE macro to
     72      specify what character(s) you want to be interpreted as line terminators.
     73      In an EBCDIC environment, you MUST change NEWLINE, because its default
     74      value is 10, an ASCII LF. The usual EBCDIC newline character is 21 (0x15,
     75      NL), though in some cases it may be 37 (0x25).
     76 
     77      When you compile any of the PCRE modules, you must specify -DHAVE_CONFIG_H
     78      to your compiler so that config.h is included in the sources.
     79 
     80      An alternative approach is not to edit config.h, but to use -D on the
     81      compiler command line to make any changes that you need to the
     82      configuration options. In this case -DHAVE_CONFIG_H must not be set.
     83 
     84      NOTE: There have been occasions when the way in which certain parameters
     85      in config.h are used has changed between releases. (In the configure/make
     86      world, this is handled automatically.) When upgrading to a new release,
     87      you are strongly advised to review config.h.generic before re-using what
     88      you had previously.
     89 
     90  (2) Copy or rename the file pcre.h.generic as pcre.h.
     91 
     92  (3) EITHER:
     93        Copy or rename file pcre_chartables.c.dist as pcre_chartables.c.
     94 
     95      OR:
     96        Compile dftables.c as a stand-alone program (using -DHAVE_CONFIG_H if
     97        you have set up config.h), and then run it with the single argument
     98        "pcre_chartables.c". This generates a set of standard character tables
     99        and writes them to that file. The tables are generated using the default
    100        C locale for your system. If you want to use a locale that is specified
    101        by LC_xxx environment variables, add the -L option to the dftables
    102        command. You must use this method if you are building on a system that
    103        uses EBCDIC code.
    104 
    105      The tables in pcre_chartables.c are defaults. The caller of PCRE can
    106      specify alternative tables at run time.
    107 
    108  (4) Ensure that you have the following header files:
    109 
    110        pcre_internal.h
    111        ucp.h
    112 
    113  (5) For an 8-bit library, compile the following source files, setting
    114      -DHAVE_CONFIG_H as a compiler option if you have set up config.h with your
    115      configuration, or else use other -D settings to change the configuration
    116      as required.
    117 
    118        pcre_byte_order.c
    119        pcre_chartables.c
    120        pcre_compile.c
    121        pcre_config.c
    122        pcre_dfa_exec.c
    123        pcre_exec.c
    124        pcre_fullinfo.c
    125        pcre_get.c
    126        pcre_globals.c
    127        pcre_jit_compile.c
    128        pcre_maketables.c
    129        pcre_newline.c
    130        pcre_ord2utf8.c
    131        pcre_refcount.c
    132        pcre_string_utils.c
    133        pcre_study.c
    134        pcre_tables.c
    135        pcre_ucd.c
    136        pcre_valid_utf8.c
    137        pcre_version.c
    138        pcre_xclass.c
    139 
    140      Make sure that you include -I. in the compiler command (or equivalent for
    141      an unusual compiler) so that all included PCRE header files are first
    142      sought in the current directory. Otherwise you run the risk of picking up
    143      a previously-installed file from somewhere else.
    144 
    145      Note that you must still compile pcre_jit_compile.c, even if you have not
    146      defined SUPPORT_JIT in config.h, because when JIT support is not
    147      configured, dummy functions are compiled. When JIT support IS configured,
    148      pcre_jit_compile.c #includes sources from the sljit subdirectory, where
    149      there should be 16 files, all of whose names begin with "sljit".
    150 
    151  (6) Now link all the compiled code into an object library in whichever form
    152      your system keeps such libraries. This is the basic PCRE C 8-bit library.
    153      If your system has static and shared libraries, you may have to do this
    154      once for each type.
    155 
    156  (7) If you want to build a 16-bit library (as well as, or instead of the 8-bit
    157      or 32-bit libraries) repeat steps 5-6 with the following files:
    158 
    159        pcre16_byte_order.c
    160        pcre16_chartables.c
    161        pcre16_compile.c
    162        pcre16_config.c
    163        pcre16_dfa_exec.c
    164        pcre16_exec.c
    165        pcre16_fullinfo.c
    166        pcre16_get.c
    167        pcre16_globals.c
    168        pcre16_jit_compile.c
    169        pcre16_maketables.c
    170        pcre16_newline.c
    171        pcre16_ord2utf16.c
    172        pcre16_refcount.c
    173        pcre16_string_utils.c
    174        pcre16_study.c
    175        pcre16_tables.c
    176        pcre16_ucd.c
    177        pcre16_utf16_utils.c
    178        pcre16_valid_utf16.c
    179        pcre16_version.c
    180        pcre16_xclass.c
    181 
    182  (8) If you want to build a 32-bit library (as well as, or instead of the 8-bit
    183      or 16-bit libraries) repeat steps 5-6 with the following files:
    184 
    185        pcre32_byte_order.c
    186        pcre32_chartables.c
    187        pcre32_compile.c
    188        pcre32_config.c
    189        pcre32_dfa_exec.c
    190        pcre32_exec.c
    191        pcre32_fullinfo.c
    192        pcre32_get.c
    193        pcre32_globals.c
    194        pcre32_jit_compile.c
    195        pcre32_maketables.c
    196        pcre32_newline.c
    197        pcre32_ord2utf32.c
    198        pcre32_refcount.c
    199        pcre32_string_utils.c
    200        pcre32_study.c
    201        pcre32_tables.c
    202        pcre32_ucd.c
    203        pcre32_utf32_utils.c
    204        pcre32_valid_utf32.c
    205        pcre32_version.c
    206        pcre32_xclass.c
    207 
    208  (9) If you want to build the POSIX wrapper functions (which apply only to the
    209      8-bit library), ensure that you have the pcreposix.h file and then compile
    210      pcreposix.c (remembering -DHAVE_CONFIG_H if necessary). Link the result
    211      (on its own) as the pcreposix library.
    212 
    213 (10) The pcretest program can be linked with any combination of the 8-bit,
    214      16-bit and 32-bit libraries (depending on what you selected in config.h).
    215      Compile pcretest.c and pcre_printint.c (again, don't forget
    216      -DHAVE_CONFIG_H) and link them together with the appropriate library/ies.
    217      If you compiled an 8-bit library, pcretest also needs the pcreposix
    218      wrapper library unless you compiled it with -DNOPOSIX.
    219 
    220 (11) Run pcretest on the testinput files in the testdata directory, and check
    221      that the output matches the corresponding testoutput files. There are
    222      comments about what each test does in the section entitled "Testing PCRE"
    223      in the README file. If you compiled more than one of the 8-bit, 16-bit and
    224      32-bit libraries, you need to run pcretest with the -16 option to do
    225      16-bit tests and with the -32 option to do 32-bit tests.
    226 
    227      Some tests are relevant only when certain build-time options are selected.
    228      For example, test 4 is for UTF-8/UTF-16/UTF-32 support, and will not run
    229      if you have built PCRE without it. See the comments at the start of each
    230      testinput file. If you have a suitable Unix-like shell, the RunTest script
    231      will run the appropriate tests for you. The command "RunTest list" will
    232      output a list of all the tests.
    233 
    234      Note that the supplied files are in Unix format, with just LF characters
    235      as line terminators. You may need to edit them to change this if your
    236      system uses a different convention. If you are using Windows, you probably
    237      should use the wintestinput3 file instead of testinput3 (and the
    238      corresponding output file). This is a locale test; wintestinput3 sets the
    239      locale to "french" rather than "fr_FR", and there some minor output
    240      differences.
    241 
    242 (12) If you have built PCRE with SUPPORT_JIT, the JIT features will be tested
    243      by the testdata files. However, you might also like to build and run
    244      the freestanding JIT test program, pcre_jit_test.c.
    245 
    246 (13) If you want to use the pcregrep command, compile and link pcregrep.c; it
    247      uses only the basic 8-bit PCRE library (it does not need the pcreposix
    248      library).
    249 
    250 
    251 THE C++ WRAPPER FUNCTIONS
    252 
    253 The PCRE distribution also contains some C++ wrapper functions and tests,
    254 applicable to the 8-bit library, which were contributed by Google Inc. On a
    255 system that can use "configure" and "make", the functions are automatically
    256 built into a library called pcrecpp. It should be straightforward to compile
    257 the .cc files manually on other systems. The files called xxx_unittest.cc are
    258 test programs for each of the corresponding xxx.cc files.
    259 
    260 
    261 BUILDING FOR VIRTUAL PASCAL
    262 
    263 A script for building PCRE using Borland's C++ compiler for use with VPASCAL
    264 was contributed by Alexander Tokarev. Stefan Weber updated the script and added
    265 additional files. The following files in the distribution are for building PCRE
    266 for use with VP/Borland: makevp_c.txt, makevp_l.txt, makevp.bat, pcregexp.pas.
    267 
    268 
    269 STACK SIZE IN WINDOWS ENVIRONMENTS
    270 
    271 The default processor stack size of 1Mb in some Windows environments is too
    272 small for matching patterns that need much recursion. In particular, test 2 may
    273 fail because of this. Normally, running out of stack causes a crash, but there
    274 have been cases where the test program has just died silently. See your linker
    275 documentation for how to increase stack size if you experience problems. The
    276 Linux default of 8Mb is a reasonable choice for the stack, though even that can
    277 be too small for some pattern/subject combinations.
    278 
    279 PCRE has a compile configuration option to disable the use of stack for
    280 recursion so that heap is used instead. However, pattern matching is
    281 significantly slower when this is done. There is more about stack usage in the
    282 "pcrestack" documentation.
    283 
    284 
    285 LINKING PROGRAMS IN WINDOWS ENVIRONMENTS
    286 
    287 If you want to statically link a program against a PCRE library in the form of
    288 a non-dll .a file, you must define PCRE_STATIC before including pcre.h or
    289 pcrecpp.h, otherwise the pcre_malloc() and pcre_free() exported functions will
    290 be declared __declspec(dllimport), with unwanted results.
    291 
    292 
    293 CALLING CONVENTIONS IN WINDOWS ENVIRONMENTS
    294 
    295 It is possible to compile programs to use different calling conventions using
    296 MSVC. Search the web for "calling conventions" for more information. To make it
    297 easier to change the calling convention for the exported functions in the
    298 PCRE library, the macro PCRE_CALL_CONVENTION is present in all the external
    299 definitions. It can be set externally when compiling (e.g. in CFLAGS). If it is
    300 not set, it defaults to empty; the default calling convention is then used
    301 (which is what is wanted most of the time).
    302 
    303 
    304 COMMENTS ABOUT WIN32 BUILDS (see also "BUILDING PCRE ON WINDOWS WITH CMAKE")
    305 
    306 There are two ways of building PCRE using the "configure, make, make install"
    307 paradigm on Windows systems: using MinGW or using Cygwin. These are not at all
    308 the same thing; they are completely different from each other. There is also
    309 support for building using CMake, which some users find a more straightforward
    310 way of building PCRE under Windows.
    311 
    312 The MinGW home page (http://www.mingw.org/) says this:
    313 
    314   MinGW: A collection of freely available and freely distributable Windows
    315   specific header files and import libraries combined with GNU toolsets that
    316   allow one to produce native Windows programs that do not rely on any
    317   3rd-party C runtime DLLs.
    318 
    319 The Cygwin home page (http://www.cygwin.com/) says this:
    320 
    321   Cygwin is a Linux-like environment for Windows. It consists of two parts:
    322 
    323   . A DLL (cygwin1.dll) which acts as a Linux API emulation layer providing
    324     substantial Linux API functionality
    325 
    326   . A collection of tools which provide Linux look and feel.
    327 
    328   The Cygwin DLL currently works with all recent, commercially released x86 32
    329   bit and 64 bit versions of Windows, with the exception of Windows CE.
    330 
    331 On both MinGW and Cygwin, PCRE should build correctly using:
    332 
    333   ./configure && make && make install
    334 
    335 This should create two libraries called libpcre and libpcreposix, and, if you
    336 have enabled building the C++ wrapper, a third one called libpcrecpp. These are
    337 independent libraries: when you link with libpcreposix or libpcrecpp you must
    338 also link with libpcre, which contains the basic functions. (Some earlier
    339 releases of PCRE included the basic libpcre functions in libpcreposix. This no
    340 longer happens.)
    341 
    342 A user submitted a special-purpose patch that makes it easy to create
    343 "pcre.dll" under mingw32 using the "msys" environment. It provides "pcre.dll"
    344 as a special target. If you use this target, no other files are built, and in
    345 particular, the pcretest and pcregrep programs are not built. An example of how
    346 this might be used is:
    347 
    348   ./configure --enable-utf --disable-cpp CFLAGS="-03 -s"; make pcre.dll
    349 
    350 Using Cygwin's compiler generates libraries and executables that depend on
    351 cygwin1.dll. If a library that is generated this way is distributed,
    352 cygwin1.dll has to be distributed as well. Since cygwin1.dll is under the GPL
    353 licence, this forces not only PCRE to be under the GPL, but also the entire
    354 application. A distributor who wants to keep their own code proprietary must
    355 purchase an appropriate Cygwin licence.
    356 
    357 MinGW has no such restrictions. The MinGW compiler generates a library or
    358 executable that can run standalone on Windows without any third party dll or
    359 licensing issues.
    360 
    361 But there is more complication:
    362 
    363 If a Cygwin user uses the -mno-cygwin Cygwin gcc flag, what that really does is
    364 to tell Cygwin's gcc to use the MinGW gcc. Cygwin's gcc is only acting as a
    365 front end to MinGW's gcc (if you install Cygwin's gcc, you get both Cygwin's
    366 gcc and MinGW's gcc). So, a user can:
    367 
    368 . Build native binaries by using MinGW or by getting Cygwin and using
    369   -mno-cygwin.
    370 
    371 . Build binaries that depend on cygwin1.dll by using Cygwin with the normal
    372   compiler flags.
    373 
    374 The test files that are supplied with PCRE are in UNIX format, with LF
    375 characters as line terminators. Unless your PCRE library uses a default newline
    376 option that includes LF as a valid newline, it may be necessary to change the
    377 line terminators in the test files to get some of the tests to work.
    378 
    379 
    380 BUILDING PCRE ON WINDOWS WITH CMAKE
    381 
    382 CMake is an alternative configuration facility that can be used instead of
    383 "configure". CMake creates project files (make files, solution files, etc.)
    384 tailored to numerous development environments, including Visual Studio,
    385 Borland, Msys, MinGW, NMake, and Unix. If possible, use short paths with no
    386 spaces in the names for your CMake installation and your PCRE source and build
    387 directories.
    388 
    389 The following instructions were contributed by a PCRE user. If they are not
    390 followed exactly, errors may occur. In the event that errors do occur, it is
    391 recommended that you delete the CMake cache before attempting to repeat the
    392 CMake build process. In the CMake GUI, the cache can be deleted by selecting
    393 "File > Delete Cache".
    394 
    395 1.  Install the latest CMake version available from http://www.cmake.org/, and
    396     ensure that cmake\bin is on your path.
    397 
    398 2.  Unzip (retaining folder structure) the PCRE source tree into a source
    399     directory such as C:\pcre. You should ensure your local date and time
    400     is not earlier than the file dates in your source dir if the release is
    401     very new.
    402 
    403 3.  Create a new, empty build directory, preferably a subdirectory of the
    404     source dir. For example, C:\pcre\pcre-xx\build.
    405 
    406 4.  Run cmake-gui from the Shell envirornment of your build tool, for example,
    407     Msys for Msys/MinGW or Visual Studio Command Prompt for VC/VC++. Do not try
    408     to start Cmake from the Windows Start menu, as this can lead to errors.
    409 
    410 5.  Enter C:\pcre\pcre-xx and C:\pcre\pcre-xx\build for the source and build
    411     directories, respectively.
    412 
    413 6.  Hit the "Configure" button.
    414 
    415 7.  Select the particular IDE / build tool that you are using (Visual
    416     Studio, MSYS makefiles, MinGW makefiles, etc.)
    417 
    418 8.  The GUI will then list several configuration options. This is where
    419     you can enable UTF-8 support or other PCRE optional features.
    420 
    421 9.  Hit "Configure" again. The adjacent "Generate" button should now be
    422     active.
    423 
    424 10. Hit "Generate".
    425 
    426 11. The build directory should now contain a usable build system, be it a
    427     solution file for Visual Studio, makefiles for MinGW, etc. Exit from
    428     cmake-gui and use the generated build system with your compiler or IDE.
    429     E.g., for MinGW you can run "make", or for Visual Studio, open the PCRE
    430     solution, select the desired configuration (Debug, or Release, etc.) and
    431     build the ALL_BUILD project.
    432 
    433 12. If during configuration with cmake-gui you've elected to build the test
    434     programs, you can execute them by building the test project. E.g., for
    435     MinGW: "make test"; for Visual Studio build the RUN_TESTS project. The
    436     most recent build configuration is targeted by the tests. A summary of
    437     test results is presented. Complete test output is subsequently
    438     available for review in Testing\Temporary under your build dir.
    439 
    440 
    441 USE OF RELATIVE PATHS WITH CMAKE ON WINDOWS
    442 
    443 A PCRE user comments as follows: I thought that others may want to know the
    444 current state of CMAKE_USE_RELATIVE_PATHS support on Windows. Here it is:
    445 
    446 -- AdditionalIncludeDirectories is only partially modified (only the
    447    first path - see below)
    448 -- Only some of the contained file paths are modified - shown below for
    449    pcre.vcproj
    450 -- It properly modifies
    451 
    452 I am sure CMake people can fix that if they want to. Until then one will
    453 need to replace existing absolute paths in project files with relative
    454 paths manually (e.g. from VS) - relative to project file location. I did
    455 just that before being told to try CMAKE_USE_RELATIVE_PATHS. Not a big
    456 deal.
    457 
    458 AdditionalIncludeDirectories="E:\builds\pcre\build;E:\builds\pcre\pcre-7.5;"
    459 AdditionalIncludeDirectories=".;E:\builds\pcre\pcre-7.5;"
    460 
    461 RelativePath="pcre.h"
    462 RelativePath="pcre_chartables.c"
    463 RelativePath="pcre_chartables.c.rule"
    464 
    465 
    466 TESTING WITH RUNTEST.BAT
    467 
    468 If configured with CMake, building the test project ("make test" or building
    469 ALL_TESTS in Visual Studio) creates (and runs) pcre_test.bat (and depending
    470 on your configuration options, possibly other test programs) in the build
    471 directory. Pcre_test.bat runs RunTest.Bat with correct source and exe paths.
    472 
    473 For manual testing with RunTest.bat, provided the build dir is a subdirectory
    474 of the source directory: Open command shell window. Chdir to the location
    475 of your pcretest.exe and pcregrep.exe programs. Call RunTest.bat with
    476 "..\RunTest.Bat" or "..\..\RunTest.bat" as appropriate.
    477 
    478 To run only a particular test with RunTest.Bat provide a test number argument.
    479 
    480 Otherwise:
    481 
    482 1. Copy RunTest.bat into the directory where pcretest.exe and pcregrep.exe
    483    have been created.
    484 
    485 2. Edit RunTest.bat to indentify the full or relative location of
    486    the pcre source (wherein which the testdata folder resides), e.g.:
    487 
    488    set srcdir=C:\pcre\pcre-8.20
    489 
    490 3. In a Windows command environment, chdir to the location of your bat and
    491    exe programs.
    492 
    493 4. Run RunTest.bat. Test outputs will automatically be compared to expected
    494    results, and discrepancies will be identified in the console output.
    495 
    496 To independently test the just-in-time compiler, run pcre_jit_test.exe.
    497 To test pcrecpp, run pcrecpp_unittest.exe, pcre_stringpiece_unittest.exe and
    498 pcre_scanner_unittest.exe.
    499 
    500 
    501 BUILDING UNDER WINDOWS CE WITH VISUAL STUDIO 200x
    502 
    503 Vincent Richomme sent a zip archive of files to help with this process. They
    504 can be found in the file "pcre-vsbuild.zip" in the Contrib directory of the FTP
    505 site.
    506 
    507 
    508 BUILDING UNDER WINDOWS WITH BCC5.5
    509 
    510 Michael Roy sent these comments about building PCRE under Windows with BCC5.5:
    511 
    512 Some of the core BCC libraries have a version of PCRE from 1998 built in, which
    513 can lead to pcre_exec() giving an erroneous PCRE_ERROR_NULL from a version
    514 mismatch. I'm including an easy workaround below, if you'd like to include it
    515 in the non-unix instructions:
    516 
    517 When linking a project with BCC5.5, pcre.lib must be included before any of the
    518 libraries cw32.lib, cw32i.lib, cw32mt.lib, and cw32mti.lib on the command line.
    519 
    520 
    521 BUILDING USING BORLAND C++ BUILDER 2007 (CB2007) AND HIGHER
    522 
    523 A PCRE user sent these comments about this environment (see also the comment
    524 from another user that follows them):
    525 
    526 The XE versions of C++ Builder come with a RegularExpressionsCore class which
    527 contain a version of TPerlRegEx. However, direct use of the C PCRE library may
    528 be desirable.
    529 
    530 The default makevp.bat, however, supplied with PCRE builds a version of PCRE
    531 that is not usable with any version of C++ Builder because the compiler ships
    532 with an embedded version of PCRE, version 2.01 from 1998! [See also the note
    533 about BCC5.5 above.] If you want to use PCRE you'll need to rename the
    534 functions (pcre_compile to pcre_compile_bcc, etc) or do as I have done and just
    535 use the 16 bit versions. I'm using std::wstring everywhere anyway. Since the
    536 embedded version of PCRE does not have the 16 bit function names, there is no
    537 conflict.
    538 
    539 Building PCRE using a C++ Builder static library project file (recommended):
    540 
    541 1. Rename or remove pcre.h, pcreposi.h, and pcreposix.h from your C++ Builder
    542 original include path.
    543 
    544 2. Download PCRE from pcre.org and extract to a directory.
    545 
    546 3. Rename pcre_chartables.c.dist to pcre_chartables.c, pcre.h.generic to
    547 pcre.h, and config.h.generic to config.h.
    548 
    549 4. Edit pcre.h and pcre_config.c so that they include config.h.
    550 
    551 5. Edit config.h like so:
    552 
    553 Comment out the following lines:
    554 #define PACKAGE "pcre"
    555 #define PACKAGE_BUGREPORT ""
    556 #define PACKAGE_NAME "PCRE"
    557 #define PACKAGE_STRING "PCRE 8.32"
    558 #define PACKAGE_TARNAME "pcre"
    559 #define PACKAGE_URL ""
    560 #define PACKAGE_VERSION "8.32"
    561 
    562 Add the following lines:
    563 #ifndef SUPPORT_UTF
    564 #define SUPPORT_UTF 100 // any value is fine
    565 #endif
    566 
    567 #ifndef SUPPORT_UCP
    568 #define SUPPORT_UCP 101 // any value is fine
    569 #endif
    570 
    571 #ifndef SUPPORT_UCP
    572 #define SUPPORT_PCRE16 102 // any value is fine
    573 #endif
    574 
    575 #ifndef SUPPORT_UTF8
    576 #define SUPPORT_UTF8 103 // any value is fine
    577 #endif
    578 
    579 6. Build a C++ Builder project using the IDE. Go to File / New / Other and
    580 choose Static Library. You can name it pcre.cbproj or whatever. Now set your
    581 paths by going to Project / Options. Set the Include path. Do this from the
    582 "Base" option to apply to both Release and Debug builds. Now add the following
    583 files to the project:
    584 
    585 pcre.h
    586 pcre16_byte_order.c
    587 pcre16_chartables.c
    588 pcre16_compile.c
    589 pcre16_config.c
    590 pcre16_dfa_exec.c
    591 pcre16_exec.c
    592 pcre16_fullinfo.c
    593 pcre16_get.c
    594 pcre16_globals.c
    595 pcre16_maketables.c
    596 pcre16_newline.c
    597 pcre16_ord2utf16.c
    598 pcre16_printint.c
    599 pcre16_refcount.c
    600 pcre16_string_utils.c
    601 pcre16_study.c
    602 pcre16_tables.c
    603 pcre16_ucd.c
    604 pcre16_utf16_utils.c
    605 pcre16_valid_utf16.c
    606 pcre16_version.c
    607 pcre16_xclass.c
    608 
    609 //Optional
    610 pcre_version.c
    611 
    612 7. After compiling the .lib file, copy the .lib and header files to a project
    613 you want to use PCRE with. Enjoy.
    614 
    615 Optional ... Building PCRE using the makevp.bat file:
    616 
    617 1. Edit makevp_c.txt and makevp_l.txt and change all the names to the 16 bit
    618 versions.
    619 
    620 2. Edit makevp.bat and set the path to C++ Builder. Run makevp.bat.
    621 
    622 Another PCRE user added this comment:
    623 
    624 Another approach I successfully used for some years with BCB 5 and 6 was to
    625 make sure that include and library paths of PCRE are configured before the
    626 default paths of the IDE in the dialogs where one can manage those paths.
    627 Afterwards one can open the project files using a text editor and manually add
    628 the self created library for pcre itself, pcrecpp doesn't ship with the IDE, in
    629 the library nodes where the IDE manages its own libraries to link against in
    630 front of the IDE-own libraries. This way one can use the default PCRE function
    631 names without getting access violations on runtime.
    632 
    633   <ALLLIB value="libpcre.lib $(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib"/>
    634 
    635 
    636 BUILDING PCRE ON OPENVMS
    637 
    638 Stephen Hoffman sent the following, in December 2012:
    639 
    640 "Here <http://labs.hoffmanlabs.com/node/1847> is a very short write-up on the
    641 OpenVMS port and here
    642 
    643 <http://labs.hoffmanlabs.com/labsnotes/pcre-vms-8_32.zip>
    644 
    645 is a zip with the OpenVMS files, and with one modified testing-related PCRE
    646 file." This is a port of PCRE 8.32.
    647 
    648 Earlier, Dan Mooney sent the following comments about building PCRE on OpenVMS.
    649 They relate to an older version of PCRE that used fewer source files, so the
    650 exact commands will need changing. See the current list of source files above.
    651 
    652 "It was quite easy to compile and link the library. I don't have a formal
    653 make file but the attached file [reproduced below] contains the OpenVMS DCL
    654 commands I used to build the library. I had to add #define
    655 POSIX_MALLOC_THRESHOLD 10 to pcre.h since it was not defined anywhere.
    656 
    657 The library was built on:
    658 O/S: HP OpenVMS v7.3-1
    659 Compiler: Compaq C v6.5-001-48BCD
    660 Linker: vA13-01
    661 
    662 The test results did not match 100% due to the issues you mention in your
    663 documentation regarding isprint(), iscntrl(), isgraph() and ispunct(). I
    664 modified some of the character tables temporarily and was able to get the
    665 results to match. Tests using the fr locale did not match since I don't have
    666 that locale loaded. The study size was always reported to be 3 less than the
    667 value in the standard test output files."
    668 
    669 =========================
    670 $! This DCL procedure builds PCRE on OpenVMS
    671 $!
    672 $! I followed the instructions in the non-unix-use file in the distribution.
    673 $!
    674 $ COMPILE == "CC/LIST/NOMEMBER_ALIGNMENT/PREFIX_LIBRARY_ENTRIES=ALL_ENTRIES
    675 $ COMPILE DFTABLES.C
    676 $ LINK/EXE=DFTABLES.EXE DFTABLES.OBJ
    677 $ RUN DFTABLES.EXE/OUTPUT=CHARTABLES.C
    678 $ COMPILE MAKETABLES.C
    679 $ COMPILE GET.C
    680 $ COMPILE STUDY.C
    681 $! I had to set POSIX_MALLOC_THRESHOLD to 10 in PCRE.H since the symbol
    682 $! did not seem to be defined anywhere.
    683 $! I edited pcre.h and added #DEFINE SUPPORT_UTF8 to enable UTF8 support.
    684 $ COMPILE PCRE.C
    685 $ LIB/CREATE PCRE MAKETABLES.OBJ, GET.OBJ, STUDY.OBJ, PCRE.OBJ
    686 $! I had to set POSIX_MALLOC_THRESHOLD to 10 in PCRE.H since the symbol
    687 $! did not seem to be defined anywhere.
    688 $ COMPILE PCREPOSIX.C
    689 $ LIB/CREATE PCREPOSIX PCREPOSIX.OBJ
    690 $ COMPILE PCRETEST.C
    691 $ LINK/EXE=PCRETEST.EXE PCRETEST.OBJ, PCRE/LIB, PCREPOSIX/LIB
    692 $! C programs that want access to command line arguments must be
    693 $! defined as a symbol
    694 $ PCRETEST :== "$ SYS$ROADSUSERS:[DMOONEY.REGEXP]PCRETEST.EXE"
    695 $! Arguments must be enclosed in quotes.
    696 $ PCRETEST "-C"
    697 $! Test results:
    698 $!
    699 $!   The test results did not match 100%. The functions isprint(), iscntrl(),
    700 $!   isgraph() and ispunct() on OpenVMS must not produce the same results
    701 $!   as the system that built the test output files provided with the
    702 $!   distribution.
    703 $!
    704 $!   The study size did not match and was always 3 less on OpenVMS.
    705 $!
    706 $!   Locale could not be set to fr
    707 $!
    708 =========================
    709 
    710 
    711 BUILDING PCRE ON STRATUS OPENVOS
    712 
    713 These notes on the port of PCRE to VOS (lightly edited) were supplied by
    714 Ashutosh Warikoo, whose email address has the local part awarikoo and the
    715 domain nse.co.in. The port was for version 7.9 in August 2009.
    716 
    717 1.   Building PCRE
    718 
    719 I built pcre on OpenVOS Release 17.0.1at using GNU Tools 3.4a without any
    720 problems. I used the following packages to build PCRE:
    721 
    722   ftp://ftp.stratus.com/pub/vos/posix/ga/posix.save.evf.gz
    723 
    724 Please read and follow the instructions that come with these packages. To start
    725 the build of pcre, from the root of the package type:
    726 
    727   ./build.sh
    728 
    729 2. Installing PCRE
    730 
    731 Once you have successfully built PCRE, login to the SysAdmin group, switch to
    732 the root user, and type
    733 
    734   [ !create_dir (master_disk)>usr   --if needed ]
    735   [ !create_dir (master_disk)>usr>local   --if needed ]
    736     !gmake install
    737 
    738 This installs PCRE and its man pages into /usr/local. You can add
    739 (master_disk)>usr>local>bin to your command search paths, or if you are in
    740 BASH, add /usr/local/bin to the PATH environment variable.
    741 
    742 4. Restrictions
    743 
    744 This port requires readline library optionally. However during the build I
    745 faced some yet unexplored errors while linking with readline. As it was an
    746 optional component I chose to disable it.
    747 
    748 5. Known Problems
    749 
    750 I ran the test suite, but you will have to be your own judge of whether this
    751 command, and this port, suits your purposes. If you find any problems that
    752 appear to be related to the port itself, please let me know. Please see the
    753 build.log file in the root of the package also.
    754 
    755 
    756 BUILDING PCRE ON NATIVE Z/OS AND Z/VM
    757 
    758 z/OS and z/VM are operating systems for mainframe computers, produced by IBM.
    759 The character code used is EBCDIC, not ASCII or Unicode. In z/OS, UNIX APIs and
    760 applications can be supported through UNIX System Services, and in such an
    761 environment PCRE can be built in the same way as in other systems. However, in
    762 native z/OS (without UNIX System Services) and in z/VM, special ports are
    763 required. For details, please see this web site:
    764 
    765   http://www.zaconsultants.net
    766 
    767 You may download PCRE from WWW.CBTTAPE.ORG,file 882. Everything, source and
    768 executable, is in EBCDIC and native z/OS file formats and this is the
    769 recommended download site.
    770 
    771 ==========================
    772 Last Updated: 25 June 2015
    773