NON-AUTOTOOLS-BUILD 31 KB

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