?? non-unix-use
字號:
Compiling PCRE on non-Unix systems----------------------------------See below for comments on Cygwin or MinGW and OpenVMS usage. I (Philip Hazel)have no knowledge of Windows or VMS sytems and how their libraries work. Theitems in the PCRE Makefile that relate to anything other than Unix-like systemshave been contributed by PCRE users. There are some other comments and files inthe Contrib directory on the ftp site that you may find useful. See ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ContribIf you want to compile PCRE for a non-Unix system (or perhaps, more strictly,for a system that does not support "configure" and "make" files), note thatPCRE consists entirely of code written in Standard C, and so should compilesuccessfully on any system that has a Standard C compiler and library.GENERIC INSTRUCTIONSThe following are generic comments about building PCRE. The interspersedindented commands are suggestions from Mark Tetrode as to which commands youmight use on a Windows system to build a static library.(1) Copy or rename the file config.in as config.h, and change the macros thatdefine HAVE_STRERROR and HAVE_MEMMOVE to define them as 1 rather than 0.Unfortunately, because of the way Unix autoconf works, the default setting hasto be 0. You may also want to make changes to other macros in config.h. Inparticular, if you want to force a specific value for newline, you can definethe NEWLINE macro. The default is to use '\n', thereby using whatever valueyour 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 definitionsfor PCRE_MAJOR, PCRE_MINOR, and PCRE_DATE near its start to the values set inconfigure.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 withthe single argument "chartables.c". This generates a set of standardcharacter tables and writes them to that file. rem Mark Tetrode's commands 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 alltogether into an object library in whichever form your system keeps suchlibraries. This is the pcre library (chartables.c is included by means of an#include directive). If your system has static and shared libraries, you mayhave 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(5) Similarly, compile pcreposix.c and link it (on its own) as the pcreposixlibrary. rem Mark Tetrode's commands, for a static library rem Compile & lib cl -DSUPPORT_UTF8 -DPOSIX_MALLOC_THRESHOLD=10 /c pcreposix.c lib /OUT:pcreposix.lib pcreposix.obj(6) Compile the test program pcretest.c. This needs the functions in thepcre and pcreposix libraries when linking. rem Mark Tetrode's commands rem compile & link cl pcretest.c pcre.lib pcreposix.lib(7) Run pcretest on the testinput files in the testdata directory, and checkthat the output matches the corresponding testoutput files. You must use the-i option when checking testinput2. Note that the supplied files are in Unixformat, with just LF characters as line terminators. You may need to edit themto change this if your system uses a different convention. rem Mark Tetrode's commands rem Make a change, i.e. space, backspace, and save again - do this for all rem to change UNIX to Win, \n to \n\r write testoutput1 write testoutput2 write testoutput3 write testoutput4 write testoutput5 pcretest testdata\testinput1 testdata\myoutput1 windiff testdata\testoutput1 testdata\myoutput1 pcretest -i testdata\testinput2 testdata\myoutput2 windiff testdata\testoutput2 testdata\myoutput2 pcretest testdata\testinput3 testdata\myoutput3 windiff testdata\testoutput3 testdata\myoutput3 pcretest testdata\testinput4 testdata\myoutput4 windiff testdata\testoutput4 testdata\myoutput4 pcretest testdata\testinput5 testdata\myoutput5 windiff testdata\testoutput5 testdata\myoutput5FURTHER REMARKSIf you have a system without "configure" but where you can use a Makefile, editMakefile.in to create Makefile, substituting suitable values for the variablesat the head of the file.Some help in building a Win32 DLL of PCRE in GnuWin32 environments wascontributed by Paul Sokolovsky. These environments are Mingw32(http://www.xraylith.wisc.edu/~khan/software/gnu-win32/) and CygWin(http://sourceware.cygnus.com/cygwin/). Paul comments: For CygWin, set CFLAGS=-mno-cygwin, and do 'make dll'. You'll get pcre.dll (containing pcreposix also), libpcre.dll.a, and dynamically linked pgrep and pcretest. If you have /bin/sh, run RunTest (three main test go ok, locale not supported).Changes to do MinGW with autoconf 2.50 were supplied by Fred Cox<sailorFred@yahoo.com>, who comments as follows: If you are using the PCRE DLL, the normal Unix style configure && make && make check && make install should just work[*]. If you want to statically link against the .a file, you must define PCRE_STATIC before including pcre.h, otherwise the pcre_malloc and pcre_free exported functions will be declared __declspec(dllimport), with hilarious results. See the configure.in and pcretest.c for how it is done for the static test. Also, there will only be a libpcre.la, not a libpcreposix.la, as you would expect from the Unix version. The single DLL includes the pcreposix interface.[*] But note that the supplied test files are in Unix format, with just LFcharacters as line terminators. You will have to edit them to change to CR LFterminators.A script for building PCRE using Borland's C++ compiler for use with VPASCALwas contributed by Alexander Tokarev. It is called makevp.bat.These are some further comments about Win32 builds from Mark Evans. Theywere contributed before Fred Cox's changes were made, so it is possible thatthey may no longer be relevant."The documentation for Win32 builds is a bit shy. Under MSVC6 Ifollowed their instructions to the letter, but there were stillsome things missing.(1) Must #define STATIC for entire project if linking statically. (I see no reason to use DLLs for code this compact.) This of course is a project setting in MSVC under Preprocessor.(2) Missing some #ifdefs relating to the function pointers pcre_malloc and pcre_free. See my solution below. (The stubs may not be mandatory but they made me feel better.)"=========================#ifdef _WIN32#include <malloc.h>void* malloc_stub(size_t N){ return malloc(N); }void free_stub(void* p){ free(p); }void *(*pcre_malloc)(size_t) = &malloc_stub;void (*pcre_free)(void *) = &free_stub;#elsevoid *(*pcre_malloc)(size_t) = malloc;void (*pcre_free)(void *) = free;#endif=========================BUILDING PCRE ON OPENVMSDan Mooney sent the following comments about building PCRE on OpenVMS:"It was quite easy to compile and link the library. I don't have a formalmake file but the attached file [reproduced below] contains the OpenVMS DCLcommands I used to build the library. I had to add #definePOSIX_MALLOC_THRESHOLD 10 to pcre.h since it was not defined anywhere.The library was built on:O/S: HP OpenVMS v7.3-1Compiler: Compaq C v6.5-001-48BCDLinker: vA13-01The test results did not match 100% due to the issues you mention in yourdocumentation regarding isprint(), iscntrl(), isgraph() and ispunct(). Imodified some of the character tables temporarily and was able to get theresults to match. Tests using the fr locale did not match since I don't havethat locale loaded. The study size was always reported to be 3 less than thevalue in the standard test output files."=========================$! This DCL procedure builds PCRE on OpenVMS$!$! I followed the instructions in the non-unix-use file in the distribution.$!$ COMPILE == "CC/LIST/NOMEMBER_ALIGNMENT/PREFIX_LIBRARY_ENTRIES=ALL_ENTRIES$ COMPILE DFTABLES.C$ LINK/EXE=DFTABLES.EXE DFTABLES.OBJ$ RUN DFTABLES.EXE/OUTPUT=CHARTABLES.C$ COMPILE MAKETABLES.C$ COMPILE GET.C$ COMPILE STUDY.C$! I had to set POSIX_MALLOC_THRESHOLD to 10 in PCRE.H since the symbol$! did not seem to be defined anywhere.$! I edited pcre.h and added #DEFINE SUPPORT_UTF8 to enable UTF8 support.$ COMPILE PCRE.C$ LIB/CREATE PCRE MAKETABLES.OBJ, GET.OBJ, STUDY.OBJ, PCRE.OBJ$! I had to set POSIX_MALLOC_THRESHOLD to 10 in PCRE.H since the symbol$! did not seem to be defined anywhere.$ COMPILE PCREPOSIX.C$ LIB/CREATE PCREPOSIX PCREPOSIX.OBJ$ COMPILE PCRETEST.C$ LINK/EXE=PCRETEST.EXE PCRETEST.OBJ, PCRE/LIB, PCREPOSIX/LIB$! C programs that want access to command line arguments must be$! defined as a symbol$ PCRETEST :== "$ SYS$ROADSUSERS:[DMOONEY.REGEXP]PCRETEST.EXE"$! Arguments must be enclosed in quotes.$ PCRETEST "-C"$! Test results:$!$! The test results did not match 100%. The functions isprint(), iscntrl(),$! isgraph() and ispunct() on OpenVMS must not produce the same results$! as the system that built the test output files provided with the$! distribution.$!$! The study size did not match and was always 3 less on OpenVMS.$!$! Locale could not be set to fr$!=========================****
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -