readme

来自「Ubuntu packages of security software。 相」· 代码 · 共 729 行 · 第 1/3 页

TXT
729
字号
  whose code point values are less than 256. By default, it uses a set of  tables for ASCII encoding that is part of the distribution. If you specify  --enable-rebuild-chartables  a program called dftables is compiled and run in the default C locale when  you obey "make". It builds a source file called pcre_chartables.c. If you do  not specify this option, pcre_chartables.c is created as a copy of  pcre_chartables.c.dist. See "Character tables" below for further information.. It is possible to compile PCRE for use on systems that use EBCDIC as their  default character code (as opposed to ASCII) by specifying  --enable-ebcdic  This automatically implies --enable-rebuild-chartables (see above).The "configure" script builds the following files for the basic C library:. Makefile is the makefile that builds the library. config.h contains build-time configuration options for the library. pcre.h is the public PCRE header file. pcre-config is a script that shows the settings of "configure" options. libpcre.pc is data for the pkg-config command. libtool is a script that builds shared and/or static libraries. RunTest is a script for running tests on the basic C library. RunGrepTest is a script for running tests on the pcregrep commandVersions of config.h and pcre.h are distributed in the PCRE tarballs underthe names config.h.generic and pcre.h.generic. These are provided for thebenefit of those who have to built PCRE without the benefit of "configure". Ifyou use "configure", the .generic versions are not used.If a C++ compiler is found, the following files are also built:. libpcrecpp.pc is data for the pkg-config command. pcrecpparg.h is a header file for programs that call PCRE via the C++ wrapper. pcre_stringpiece.h is the header for the C++ "stringpiece" functionsThe "configure" script also creates config.status, which is an executablescript that can be run to recreate the configuration, and config.log, whichcontains compiler output from tests that "configure" runs.Once "configure" has run, you can run "make". It builds two libraries, calledlibpcre and libpcreposix, a test program called pcretest, a demonstrationprogram called pcredemo, and the pcregrep command. If a C++ compiler was foundon your system, "make" also builds the C++ wrapper library, which is calledlibpcrecpp, and some test programs called pcrecpp_unittest,pcre_scanner_unittest, and pcre_stringpiece_unittest. Building the C++ wrappercan be disabled by adding --disable-cpp to the "configure" command.The command "make check" runs all the appropriate tests. Details of the PCREtests are given below in a separate section of this document.You can use "make install" to install PCRE into live directories on yoursystem. The following are installed (file names are all relative to the<prefix> that is set when "configure" is run):  Commands (bin):    pcretest    pcregrep    pcre-config  Libraries (lib):    libpcre    libpcreposix    libpcrecpp (if C++ support is enabled)  Configuration information (lib/pkgconfig):    libpcre.pc    libpcrecpp.pc (if C++ support is enabled)  Header files (include):    pcre.h    pcreposix.h    pcre_scanner.h      )    pcre_stringpiece.h  ) if C++ support is enabled    pcrecpp.h           )    pcrecpparg.h        )  Man pages (share/man/man{1,3}):    pcregrep.1    pcretest.1    pcre.3    pcre*.3 (lots more pages, all starting "pcre")  HTML documentation (share/doc/pcre/html):    index.html    *.html (lots more pages, hyperlinked from index.html)  Text file documentation (share/doc/pcre):    AUTHORS    COPYING    ChangeLog    LICENCE    NEWS    README    pcre.txt       (a concatenation of the man(3) pages)    pcretest.txt   the pcretest man page    pcregrep.txt   the pcregrep man pageNote that the pcredemo program that is built by "configure" is *not* installedanywhere. It is a demonstration for programmers wanting to use PCRE.If you want to remove PCRE from your system, you can run "make uninstall".This removes all the files that "make install" installed. However, it does notremove any directories, because these are often shared with other programs.Retrieving configuration information on Unix-like systems---------------------------------------------------------Running "make install" installs the command pcre-config, which can be used torecall information about the PCRE configuration and installation. For example:  pcre-config --versionprints the version number, and  pcre-config --libsoutputs information about where the library is installed. This command can beincluded in makefiles for programs that use PCRE, saving the programmer fromhaving to remember too many details.The pkg-config command is another system for saving and retrieving informationabout installed libraries. Instead of separate commands for each library, asingle command is used. For example:  pkg-config --cflags pcreThe data is held in *.pc files that are installed in a directory called<prefix>/lib/pkgconfig.Shared libraries on Unix-like systems-------------------------------------The default distribution builds PCRE as shared libraries and static libraries,as long as the operating system supports shared libraries. Shared librarysupport relies on the "libtool" script which is built as part of the"configure" process.The libtool script is used to compile and link both shared and staticlibraries. They are placed in a subdirectory called .libs when they are newlybuilt. The programs pcretest and pcregrep are built to use these uninstalledlibraries (by means of wrapper scripts in the case of shared libraries). Whenyou use "make install" to install shared libraries, pcregrep and pcretest areautomatically re-built to use the newly installed shared libraries before beinginstalled themselves. However, the versions left in the build directory stilluse the uninstalled libraries.To build PCRE using static libraries only you must use --disable-shared whenconfiguring it. For example:./configure --prefix=/usr/gnu --disable-sharedThen run "make" in the usual way. Similarly, you can use --disable-static tobuild only shared libraries.Cross-compiling on Unix-like systems------------------------------------You can specify CC and CFLAGS in the normal way to the "configure" command, inorder to cross-compile PCRE for some other host. However, you should NOTspecify --enable-rebuild-chartables, because if you do, the dftables.c sourcefile is compiled and run on the local host, in order to generate the inbuiltcharacter tables (the pcre_chartables.c file). This will probably not work,because dftables.c needs to be compiled with the local compiler, not the crosscompiler.When --enable-rebuild-chartables is not specified, pcre_chartables.c is createdby making a copy of pcre_chartables.c.dist, which is a default set of tablesthat assumes ASCII code. Cross-compiling with the default tables should not bea problem.If you need to modify the character tables when cross-compiling, you shouldmove pcre_chartables.c.dist out of the way, then compile dftables.c by hand andrun it on the local host to make a new version of pcre_chartables.c.dist.Then when you cross-compile PCRE this new version of the tables will be used.Using HP's ANSI C++ compiler (aCC)----------------------------------Unless C++ support is disabled by specifying the "--disable-cpp" option of the"configure" script, you must include the "-AA" option in the CXXFLAGSenvironment variable in order for the C++ components to compile correctly.Also, note that the aCC compiler on PA-RISC platforms may have a defect wherebyneeded libraries fail to get included when specifying the "-AA" compileroption. If you experience unresolved symbols when linking the C++ programs,use the workaround of specifying the following environment variable prior torunning the "configure" script:  CXXLDFLAGS="-lstd_v2 -lCsup_v2"Making new tarballs-------------------The command "make dist" creates three PCRE tarballs, in tar.gz, tar.bz2, andzip formats. The command "make distcheck" does the same, but then does a trialbuild of the new distribution to ensure that it works.If you have modified any of the man page sources in the doc directory, youshould first run the PrepareRelease script before making a distribution. Thisscript creates the .txt and HTML forms of the documentation from the man pages.Testing PCRE------------To test the basic PCRE library on a Unix system, run the RunTest script that iscreated by the configuring process. There is also a script called RunGrepTestthat tests the options of the pcregrep command. If the C++ wrapper library isbuilt, three test programs called pcrecpp_unittest, pcre_scanner_unittest, andpcre_stringpiece_unittest are also built.Both the scripts and all the program tests are run if you obey "make check" or"make test". For other systems, see the instructions in NON-UNIX-USE.The RunTest script runs the pcretest test program (which is documented in itsown man page) on each of the testinput files in the testdata directory inturn, and compares the output with the contents of the corresponding testoutputfiles. A file called testtry is used to hold the main output from pcretest(testsavedregex is also used as a working file). To run pcretest on just one ofthe test files, give its number as an argument to RunTest, for example:  RunTest 2The first test file can also be fed directly into the perltest.pl script tocheck that Perl gives the same results. The only difference you should see isin the first few lines, where the Perl version is given instead of the PCREversion.The second set of tests check pcre_fullinfo(), pcre_info(), pcre_study(),pcre_copy_substring(), pcre_get_substring(), pcre_get_substring_list(), errordetection, and run-time flags that are specific to PCRE, as well as the POSIXwrapper API. It also uses the debugging flags to check some of the internals ofpcre_compile().

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?