[pcre-dev] PCRE autotools patch 6

Pàgina inicial
Delete this message
Autor: Bob Rossi
Data:  
A: pcre-dev
Assumpte: [pcre-dev] PCRE autotools patch 6
Hi,

For those of you that don't know, we are attempting to create a patch
that converts the existing build system over to using autotools.

I'm currently testing the following configurations on linux,
  default                                                                                               
  shared                      "--disable-static --enable-shared"                                        
  static                      "--enable-static --disable-shared"                                        
  utf8                        "--enable-utf8"                                                           
  unicode-properties          "--enable-unicode-properties"                                             
  disable-cpp                 "--disable-cpp"                                                           
  newline-is-cr               "--enable-newline-is-cr"                                                  
  newline-is-lf               "--enable-newline-is-lf"                                                  
  newline-is-crlf             "--enable-newline-is-crlf"                                                
  newline-is-any              "--enable-newline-is-any"                                                 
  ebcdic                      "--enable-ebcdic"                                                         
  stack_for_recursion         "--disable-stack-for-recursion"                                           
  link-size_3                 "--with-link-size=3"                                                      
  link-size_4                 "--with-link-size=4"                                                      
  match-limit                 "--with-match-limit=20000000"                                             
  match-limit-recursion       "--with-match-limit-recursion=20000000"                                   
  match-limit-and-recursion   "--with-match-limit=20000000 --with-match-limit-recurs                    
  utf8-newline-is-any         "--enable-utf8 --enable-newline-is-any"                                   


All the test suites passed except for                                                                   
  ebcdic                                                                                                
  newline-is-any (pcregrep failed here)                                                                 
  newline-is-cr (a lot of failures)                                                                     
  newline-is-crlf (a lot of failures)                                                                   


Philip, are all of these tests supposed to fail?                                                                


This is patch 6. What can you clever folks find wrong with it?

Thanks,
Bob Rossi
Index: RunTest.in
===================================================================
--- RunTest.in    (revision 2)
+++ RunTest.in    (working copy)
@@ -2,6 +2,8 @@


 # This file is generated by configure from RunTest.in. Make any changes
 # to that file.
+# TODO: Replace use of variables @LINK_SIZE@, @UTF8@ and @UCP@ with
+#       the data found from the output of 'pcretest -C' instead.


# Run PCRE tests

@@ -42,7 +44,7 @@
shift
done

-if [ "@LINK_SIZE@" != "" -a "@LINK_SIZE@" != "-DLINK_SIZE=2" ] ; then
+if [ "@LINK_SIZE@" != "2" ] ; then
   if [ $do2 = yes ] ; then
     echo "Can't run test 2 with an internal link size other than 2"
     exit 1
@@ -57,7 +59,7 @@
   fi
 fi


-if [ "@UTF8@" = "" ] ; then
+if [ "@UTF8@" = "no" ] ; then
   if [ $do4 = yes ] ; then
     echo "Can't run test 4 because UTF-8 support is not configured"
     exit 1
@@ -80,7 +82,7 @@
   fi
 fi


-if [ "@UCP@" = "" ] ; then
+if [ "@UCP@" = "no" ] ; then
   if [ $do6 = yes ] ; then
     echo "Can't run test 6 because Unicode property support is not configured"
     exit 1
@@ -97,12 +99,12 @@
   do1=yes
   do2=yes
   do3=yes
-  if [ "@UTF8@" != "" ] ; then do4=yes; fi
-  if [ "@UTF8@" != "" ] ; then do5=yes; fi
-  if [ "@UTF8@" != "" -a "@UCP@" != "" ] ; then do6=yes; fi
+  if [ "@UTF8@" != "no" ] ; then do4=yes; fi
+  if [ "@UTF8@" != "no" ] ; then do5=yes; fi
+  if [ "@UTF8@" != "no" -a "@UCP@" != "no" ] ; then do6=yes; fi
   do7=yes 
-  if [ "@UTF8@" != "" ] ; then do8=yes; fi
-  if [ "@UTF8@" != "" -a "@UCP@" != "" ] ; then do9=yes; fi
+  if [ "@UTF8@" != "no" ] ; then do8=yes; fi
+  if [ "@UTF8@" != "no" -a "@UCP@" != "no" ] ; then do9=yes; fi
 fi


# Show which release
@@ -126,7 +128,7 @@
# PCRE tests that are not Perl-compatible - API & error tests, mostly

 if [ $do2 = yes ] ; then
-  if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then
+  if [ "@LINK_SIZE@" = "2" ] ; then
     echo "Test 2: API and error handling (not Perl compatible)"
     $valgrind ./pcretest -q $testdata/testinput2 testtry
     if [ $? = 0 ] ; then
@@ -184,7 +186,7 @@
 fi


 if [ $do5 = yes ] ; then
-  if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then
+  if [ "@LINK_SIZE@" = "2" ] ; then
     echo "Test 5: API and internals for UTF-8 support (not Perl compatible)"
     $valgrind ./pcretest -q $testdata/testinput5 testtry
     if [ $? = 0 ] ; then
@@ -201,7 +203,7 @@
 fi


 if [ $do6 = yes ] ; then
-  if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then
+  if [ "@LINK_SIZE@" = "2" ] ; then
     echo "Test 6: Unicode property support"
     $valgrind ./pcretest -q $testdata/testinput6 testtry
     if [ $? = 0 ] ; then
Index: pcre.h.in
===================================================================
--- pcre.h.in    (revision 0)
+++ pcre.h.in    (revision 29)
@@ -0,0 +1,294 @@
+/*************************************************
+*       Perl-Compatible Regular Expressions      *
+*************************************************/
+
+/* This is the public header file for the PCRE library, to be #included by
+applications that call the PCRE functions.
+
+           Copyright (c) 1997-2006 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+    * Neither the name of the University of Cambridge nor the names of its
+      contributors may be used to endorse or promote products derived from
+      this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _PCRE_H
+#define _PCRE_H
+
+/* The current PCRE version information. */
+
+/* NOTES FOR FUTURE MAINTAINERS: Do not use numbers with leading zeros, because
+they may be treated as octal constants. The PCRE_PRERELEASE feature is for
+identifying release candidates. It might be defined as -RC2, for example. In
+real releases, it should be defined empty. Do not change the alignment of these
+statments. The code in ./configure greps out the version numbers by using "cut"
+to get values from column 29 onwards. These are substituted into pcre-config
+and libpcre.pc. The values are not put into configure.ac and substituted here
+(which would simplify this issue) because that makes life harder for those who
+cannot run ./configure. As it now stands, this file need not be edited in that
+circumstance. */
+
+#define PCRE_MAJOR          @PCRE_MAJOR@
+#define PCRE_MINOR          @PCRE_MINOR@
+#define PCRE_PRERELEASE     @PCRE_PRERELEASE@
+#define PCRE_DATE           @PCRE_DATE@
+
+/* Win32 uses DLL by default; it needs special stuff for exported functions
+when building PCRE. */
+
+#ifdef _WIN32
+#  ifdef PCRE_DEFINITION
+#    ifdef DLL_EXPORT
+#      define PCRE_DATA_SCOPE __declspec(dllexport)
+#    endif
+#  else
+#    ifndef PCRE_STATIC
+#      define PCRE_DATA_SCOPE extern __declspec(dllimport)
+#    endif
+#  endif
+#endif
+
+/* Otherwise, we use the standard "extern". */
+
+#ifndef PCRE_DATA_SCOPE
+#  ifdef __cplusplus
+#    define PCRE_DATA_SCOPE     extern "C"
+#  else
+#    define PCRE_DATA_SCOPE     extern
+#  endif
+#endif
+
+/* Have to include stdlib.h in order to ensure that size_t is defined;
+it is needed here for malloc. */
+
+#include <stdlib.h>
+
+/* Allow for C++ users */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Options */
+
+#define PCRE_CASELESS           0x00000001
+#define PCRE_MULTILINE          0x00000002
+#define PCRE_DOTALL             0x00000004
+#define PCRE_EXTENDED           0x00000008
+#define PCRE_ANCHORED           0x00000010
+#define PCRE_DOLLAR_ENDONLY     0x00000020
+#define PCRE_EXTRA              0x00000040
+#define PCRE_NOTBOL             0x00000080
+#define PCRE_NOTEOL             0x00000100
+#define PCRE_UNGREEDY           0x00000200
+#define PCRE_NOTEMPTY           0x00000400
+#define PCRE_UTF8               0x00000800
+#define PCRE_NO_AUTO_CAPTURE    0x00001000
+#define PCRE_NO_UTF8_CHECK      0x00002000
+#define PCRE_AUTO_CALLOUT       0x00004000
+#define PCRE_PARTIAL            0x00008000
+#define PCRE_DFA_SHORTEST       0x00010000
+#define PCRE_DFA_RESTART        0x00020000
+#define PCRE_FIRSTLINE          0x00040000
+#define PCRE_DUPNAMES           0x00080000
+#define PCRE_NEWLINE_CR         0x00100000
+#define PCRE_NEWLINE_LF         0x00200000
+#define PCRE_NEWLINE_CRLF       0x00300000
+#define PCRE_NEWLINE_ANY        0x00400000
+
+/* Exec-time and get/set-time error codes */
+
+#define PCRE_ERROR_NOMATCH         (-1)
+#define PCRE_ERROR_NULL            (-2)
+#define PCRE_ERROR_BADOPTION       (-3)
+#define PCRE_ERROR_BADMAGIC        (-4)
+#define PCRE_ERROR_UNKNOWN_OPCODE  (-5)
+#define PCRE_ERROR_UNKNOWN_NODE    (-5)  /* For backward compatibility */
+#define PCRE_ERROR_NOMEMORY        (-6)
+#define PCRE_ERROR_NOSUBSTRING     (-7)
+#define PCRE_ERROR_MATCHLIMIT      (-8)
+#define PCRE_ERROR_CALLOUT         (-9)  /* Never used by PCRE itself */
+#define PCRE_ERROR_BADUTF8        (-10)
+#define PCRE_ERROR_BADUTF8_OFFSET (-11)
+#define PCRE_ERROR_PARTIAL        (-12)
+#define PCRE_ERROR_BADPARTIAL     (-13)
+#define PCRE_ERROR_INTERNAL       (-14)
+#define PCRE_ERROR_BADCOUNT       (-15)
+#define PCRE_ERROR_DFA_UITEM      (-16)
+#define PCRE_ERROR_DFA_UCOND      (-17)
+#define PCRE_ERROR_DFA_UMLIMIT    (-18)
+#define PCRE_ERROR_DFA_WSSIZE     (-19)
+#define PCRE_ERROR_DFA_RECURSE    (-20)
+#define PCRE_ERROR_RECURSIONLIMIT (-21)
+#define PCRE_ERROR_NULLWSLIMIT    (-22)
+#define PCRE_ERROR_BADNEWLINE     (-23)
+
+/* Request types for pcre_fullinfo() */
+
+#define PCRE_INFO_OPTIONS            0
+#define PCRE_INFO_SIZE               1
+#define PCRE_INFO_CAPTURECOUNT       2
+#define PCRE_INFO_BACKREFMAX         3
+#define PCRE_INFO_FIRSTBYTE          4
+#define PCRE_INFO_FIRSTCHAR          4  /* For backwards compatibility */
+#define PCRE_INFO_FIRSTTABLE         5
+#define PCRE_INFO_LASTLITERAL        6
+#define PCRE_INFO_NAMEENTRYSIZE      7
+#define PCRE_INFO_NAMECOUNT          8
+#define PCRE_INFO_NAMETABLE          9
+#define PCRE_INFO_STUDYSIZE         10
+#define PCRE_INFO_DEFAULT_TABLES    11
+
+/* Request types for pcre_config(). Do not re-arrange, in order to remain
+compatible. */
+
+#define PCRE_CONFIG_UTF8                    0
+#define PCRE_CONFIG_NEWLINE                 1
+#define PCRE_CONFIG_LINK_SIZE               2
+#define PCRE_CONFIG_POSIX_MALLOC_THRESHOLD  3
+#define PCRE_CONFIG_MATCH_LIMIT             4
+#define PCRE_CONFIG_STACKRECURSE            5
+#define PCRE_CONFIG_UNICODE_PROPERTIES      6
+#define PCRE_CONFIG_MATCH_LIMIT_RECURSION   7
+
+/* Bit flags for the pcre_extra structure. Do not re-arrange or redefine
+these bits, just add new ones on the end, in order to remain compatible. */
+
+#define PCRE_EXTRA_STUDY_DATA             0x0001
+#define PCRE_EXTRA_MATCH_LIMIT            0x0002
+#define PCRE_EXTRA_CALLOUT_DATA           0x0004
+#define PCRE_EXTRA_TABLES                 0x0008
+#define PCRE_EXTRA_MATCH_LIMIT_RECURSION  0x0010
+
+/* Types */
+
+struct real_pcre;                 /* declaration; the definition is private  */
+typedef struct real_pcre pcre;
+
+/* When PCRE is compiled as a C++ library, the subject pointer type can be
+replaced with a custom type. For conventional use, the public interface is a
+const char *. */
+
+#ifndef PCRE_SPTR
+#define PCRE_SPTR const char *
+#endif
+
+/* The structure for passing additional data to pcre_exec(). This is defined in
+such as way as to be extensible. Always add new fields at the end, in order to
+remain compatible. */
+
+typedef struct pcre_extra {
+  unsigned long int flags;        /* Bits for which fields are set */
+  void *study_data;               /* Opaque data from pcre_study() */
+  unsigned long int match_limit;  /* Maximum number of calls to match() */
+  void *callout_data;             /* Data passed back in callouts */
+  const unsigned char *tables;    /* Pointer to character tables */
+  unsigned long int match_limit_recursion; /* Max recursive calls to match() */
+} pcre_extra;
+
+/* The structure for passing out data via the pcre_callout_function. We use a
+structure so that new fields can be added on the end in future versions,
+without changing the API of the function, thereby allowing old clients to work
+without modification. */
+
+typedef struct pcre_callout_block {
+  int          version;           /* Identifies version of block */
+  /* ------------------------ Version 0 ------------------------------- */
+  int          callout_number;    /* Number compiled into pattern */
+  int         *offset_vector;     /* The offset vector */
+  PCRE_SPTR    subject;           /* The subject being matched */
+  int          subject_length;    /* The length of the subject */
+  int          start_match;       /* Offset to start of this match attempt */
+  int          current_position;  /* Where we currently are in the subject */
+  int          capture_top;       /* Max current capture */
+  int          capture_last;      /* Most recently closed capture */
+  void        *callout_data;      /* Data passed in with the call */
+  /* ------------------- Added for Version 1 -------------------------- */
+  int          pattern_position;  /* Offset to next item in the pattern */
+  int          next_item_length;  /* Length of next item in the pattern */
+  /* ------------------------------------------------------------------ */
+} pcre_callout_block;
+
+/* Indirection for store get and free functions. These can be set to
+alternative malloc/free functions if required. Special ones are used in the
+non-recursive case for "frames". There is also an optional callout function
+that is triggered by the (?) regex item. For Virtual Pascal, these definitions
+have to take another form. */
+
+#ifndef VPCOMPAT
+PCRE_DATA_SCOPE void *(*pcre_malloc)(size_t);
+PCRE_DATA_SCOPE void  (*pcre_free)(void *);
+PCRE_DATA_SCOPE void *(*pcre_stack_malloc)(size_t);
+PCRE_DATA_SCOPE void  (*pcre_stack_free)(void *);
+PCRE_DATA_SCOPE int   (*pcre_callout)(pcre_callout_block *);
+#else   /* VPCOMPAT */
+PCRE_DATA_SCOPE void *pcre_malloc(size_t);
+PCRE_DATA_SCOPE void  pcre_free(void *);
+PCRE_DATA_SCOPE void *pcre_stack_malloc(size_t);
+PCRE_DATA_SCOPE void  pcre_stack_free(void *);
+PCRE_DATA_SCOPE int   pcre_callout(pcre_callout_block *);
+#endif  /* VPCOMPAT */
+
+/* Exported PCRE functions */
+
+PCRE_DATA_SCOPE pcre *pcre_compile(const char *, int, const char **, int *,
+                  const unsigned char *);
+PCRE_DATA_SCOPE pcre *pcre_compile2(const char *, int, int *, const char **,
+                  int *, const unsigned char *);
+PCRE_DATA_SCOPE int  pcre_config(int, void *);
+PCRE_DATA_SCOPE int  pcre_copy_named_substring(const pcre *, const char *,
+                  int *, int, const char *, char *, int);
+PCRE_DATA_SCOPE int  pcre_copy_substring(const char *, int *, int, int, char *,
+                  int);
+PCRE_DATA_SCOPE int  pcre_dfa_exec(const pcre *, const pcre_extra *,
+                  const char *, int, int, int, int *, int , int *, int);
+PCRE_DATA_SCOPE int  pcre_exec(const pcre *, const pcre_extra *, PCRE_SPTR,
+                   int, int, int, int *, int);
+PCRE_DATA_SCOPE void pcre_free_substring(const char *);
+PCRE_DATA_SCOPE void pcre_free_substring_list(const char **);
+PCRE_DATA_SCOPE int  pcre_fullinfo(const pcre *, const pcre_extra *, int,
+                  void *);
+PCRE_DATA_SCOPE int  pcre_get_named_substring(const pcre *, const char *,
+                  int *, int, const char *, const char **);
+PCRE_DATA_SCOPE int  pcre_get_stringnumber(const pcre *, const char *);
+PCRE_DATA_SCOPE int  pcre_get_stringtable_entries(const pcre *, const char *,
+                  char **, char **);
+PCRE_DATA_SCOPE int  pcre_get_substring(const char *, int *, int, int,
+                  const char **);
+PCRE_DATA_SCOPE int  pcre_get_substring_list(const char *, int *, int,
+                  const char ***);
+PCRE_DATA_SCOPE int  pcre_info(const pcre *, int *, int *);
+PCRE_DATA_SCOPE const unsigned char *pcre_maketables(void);
+PCRE_DATA_SCOPE int  pcre_refcount(pcre *, int);
+PCRE_DATA_SCOPE pcre_extra *pcre_study(const pcre *, int, const char **);
+PCRE_DATA_SCOPE const char *pcre_version(void);
+
+#ifdef __cplusplus
+}  /* extern "C" */
+#endif
+
+#endif /* End of pcre.h */
Index: build_todo.txt
===================================================================
--- build_todo.txt    (revision 0)
+++ build_todo.txt    (revision 29)
@@ -0,0 +1,8 @@
+- Make sure RunTest eventually doesn't use the LINK_SIZE, UTF variables
+  and it doesn't get converted from RunTest.in to RunTest by autoconf.
+  Instead have it use the output of pcretest -C
+
+- The EBCDIC cpp symbol is currently supposed to be set to 0 or 1. This                               
+  should be changed to defined/not-defined, to match the usual convention                             
+  for binary compile-time switches.                                                                   
+
Index: autogen.sh
===================================================================
--- autogen.sh    (revision 0)
+++ autogen.sh    (revision 29)
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+rm -rf autom4te.cache/
+
+################################################################################
+echo "-- Running aclocal"
+################################################################################
+aclocal
+
+################################################################################
+echo "-- Running autoheader"
+################################################################################
+autoheader
+
+################################################################################
+echo "-- Running libtoolize"
+################################################################################
+libtoolize --force --copy
+
+################################################################################
+echo "-- Running automake"
+################################################################################
+automake -a
+
+################################################################################
+echo "-- Running autoconf"
+################################################################################
+autoconf -f
Index: Makefile.am
===================================================================
--- Makefile.am    (revision 0)
+++ Makefile.am    (revision 29)
@@ -0,0 +1,228 @@
+# Process this file with automake to produce Makefile.in
+
+dist_doc_DATA = \
+  doc/Tech.Notes \
+  doc/pcre.txt \
+  doc/pcregrep.txt \
+  doc/pcretest.txt \
+  doc/perltest.txt \
+  AUTHORS \
+  COPYING \
+  ChangeLog \
+  INSTALL \
+  LICENCE \
+  NEWS \
+  NON-UNIX-USE \
+  README
+
+htmldir = $(docdir)/html
+dist_html_DATA = \
+  doc/html/index.html \
+  doc/html/pcreapi.html \
+  doc/html/pcrebuild.html \
+  doc/html/pcrecallout.html \
+  doc/html/pcrecompat.html \
+  doc/html/pcre_compile2.html \
+  doc/html/pcre_compile.html \
+  doc/html/pcre_config.html \
+  doc/html/pcre_copy_named_substring.html \
+  doc/html/pcre_copy_substring.html \
+  doc/html/pcre_dfa_exec.html \
+  doc/html/pcre_exec.html \
+  doc/html/pcre_free_substring.html \
+  doc/html/pcre_free_substring_list.html \
+  doc/html/pcre_fullinfo.html \
+  doc/html/pcre_get_named_substring.html \
+  doc/html/pcre_get_stringnumber.html \
+  doc/html/pcre_get_stringtable_entries.html \
+  doc/html/pcre_get_substring.html \
+  doc/html/pcre_get_substring_list.html \
+  doc/html/pcregrep.html \
+  doc/html/pcre.html \
+  doc/html/pcre_info.html \
+  doc/html/pcre_maketables.html \
+  doc/html/pcrematching.html \
+  doc/html/pcrepartial.html \
+  doc/html/pcrepattern.html \
+  doc/html/pcreperform.html \
+  doc/html/pcreposix.html \
+  doc/html/pcreprecompile.html \
+  doc/html/pcre_refcount.html \
+  doc/html/pcresample.html \
+  doc/html/pcrestack.html \
+  doc/html/pcre_study.html \
+  doc/html/pcretest.html \
+  doc/html/pcre_version.html
+
+if WITH_PCRE_CPP
+dist_html_DATA += doc/html/pcrecpp.html
+endif # WITH_PCRE_CPP
+
+# The libraries (.so's) to install.  We'll add to this later.
+lib_LTLIBRARIES =
+
+# unittests you want to run when people type 'make check'.
+# TESTS is for binary unittests, check_SCRIPTS for script-based tests
+TESTS =
+check_SCRIPTS =
+noinst_SCRIPTS =
+
+# Some of the binaries we make are to be installed, and others are
+# (non-user-visible) helper programs needed to build libpcre.
+bin_PROGRAMS = 
+noinst_PROGRAMS = 
+
+## These are the header files we'll install
+include_HEADERS = \
+  pcre.h \
+  pcreposix.h
+
+## These will install too, if they did --enable-cpp
+if WITH_PCRE_CPP
+include_HEADERS += \
+  pcrecpp.h \
+  pcrecpparg.h \
+  pcre_stringpiece.h \
+  pcre_scanner.h
+endif # WITH_PCRE_CPP
+
+bin_SCRIPTS = pcre-config
+
+## ---------------------------------------------------------------
+## Some helper programs used to compile libpcre.  They aren't user-visible.
+noinst_PROGRAMS += dftables
+dftables_SOURCES = dftables.c
+
+pcre_chartables.c: dftables$(EXEEXT)
+    ./dftables$(EXEEXT) $@
+
+## The main pcre library
+lib_LTLIBRARIES += libpcre.la
+libpcre_la_SOURCES = \
+  pcre_chartables.c \
+  pcre_compile.c \
+  pcre_config.c \
+  pcre_dfa_exec.c \
+  pcre_exec.c \
+  pcre_fullinfo.c \
+  pcre_get.c \
+  pcre_globals.c \
+  pcre_info.c \
+  pcre_maketables.c \
+  pcre_newline.c \
+  pcre_ord2utf8.c \
+  pcre_refcount.c \
+  pcre_study.c \
+  pcre_tables.c \
+  pcre_try_flipped.c \
+  pcre_ucp_searchfuncs.c \
+  pcre_valid_utf8.c \
+  pcre_version.c \
+  pcre_xclass.c
+BUILT_SOURCES = pcre_chartables.c
+libpcre_la_LDFLAGS = $(EXTRA_LIBPCRE_LDFLAGS)
+
+## A version of the main pcre library that has a posix re API.
+lib_LTLIBRARIES += libpcreposix.la
+libpcreposix_la_SOURCES = \
+  pcreposix.c
+libpcreposix_la_LDFLAGS = $(EXTRA_LIBPCREPOSIX_LDFLAGS)
+libpcreposix_la_LIBADD = libpcre.la
+
+## There's a C++ library as well.
+if WITH_PCRE_CPP
+
+lib_LTLIBRARIES += libpcrecpp.la
+libpcrecpp_la_SOURCES = \
+  pcrecpp.cc \
+  pcre_scanner.cc \
+  pcre_stringpiece.cc
+libpcrecpp_la_LDFLAGS = $(EXTRA_LIBPCRECPP_LDFLAGS)
+libpcrecpp_la_LIBADD = libpcre.la
+
+TESTS += pcrecpp_unittest
+noinst_PROGRAMS += pcrecpp_unittest
+pcrecpp_unittest_SOURCES = pcrecpp_unittest.cc
+pcrecpp_unittest_LDADD = libpcrecpp.la
+
+TESTS += pcre_scanner_unittest
+noinst_PROGRAMS += pcre_scanner_unittest
+pcre_scanner_unittest_SOURCES = pcre_scanner_unittest.cc
+pcre_scanner_unittest_LDADD = libpcrecpp.la
+
+TESTS += pcre_stringpiece_unittest
+noinst_PROGRAMS += pcre_stringpiece_unittest
+pcre_stringpiece_unittest_SOURCES = pcre_stringpiece_unittest.cc
+pcre_stringpiece_unittest_LDADD = libpcrecpp.la
+
+endif # WITH_PCRE_CPP
+
+## The main unit-tests
+
+# Each unittest is a binary plus a script that runs that binary in various ways
+# We install these test binaries in case folks find it helpful.
+
+TESTS += RunTest
+noinst_SCRIPTS += RunTest
+bin_PROGRAMS += pcretest
+pcretest_SOURCES = pcretest.c
+pcretest_LDADD = libpcre.la libpcreposix.la
+
+TESTS += RunGrepTest
+noinst_SCRIPTS += RunGrepTest
+bin_PROGRAMS += pcregrep
+pcregrep_SOURCES = pcregrep.c
+pcregrep_LDADD = libpcre.la libpcreposix.la
+
+## Utility rules, documentation, etc.
+
+# A compatibility line, the old build system worked with 'make test'
+test: check ;
+
+# TODO(csilvers): I don't know exactly what all this is
+pkgconfigdir = $(prefix)/lib/pkgconfig
+pkgconfig_DATA = libpcre.pc
+if WITH_PCRE_CPP
+pkgconfig_DATA += libpcrecpp.pc
+endif # WITH_PCRE_CPP
+
+dist_man_MANS = \
+  doc/pcretest.1 \
+  doc/pcregrep.1 \
+  doc/pcre.3 \
+  doc/pcreapi.3 \
+  doc/pcrebuild.3 \
+  doc/pcrecallout.3 \
+  doc/pcrecompat.3 \
+  doc/pcre_compile2.3 \
+  doc/pcre_compile.3 \
+  doc/pcre_config.3 \
+  doc/pcre_copy_named_substring.3 \
+  doc/pcre_copy_substring.3 \
+  doc/pcre_dfa_exec.3 \
+  doc/pcre_exec.3 \
+  doc/pcre_free_substring.3 \
+  doc/pcre_free_substring_list.3 \
+  doc/pcre_fullinfo.3 \
+  doc/pcre_get_named_substring.3 \
+  doc/pcre_get_stringnumber.3 \
+  doc/pcre_get_stringtable_entries.3 \
+  doc/pcre_get_substring.3 \
+  doc/pcre_get_substring_list.3 \
+  doc/pcre_info.3 \
+  doc/pcre_maketables.3 \
+  doc/pcrematching.3 \
+  doc/pcrepartial.3 \
+  doc/pcrepattern.3 \
+  doc/pcreperform.3 \
+  doc/pcreposix.3 \
+  doc/pcreprecompile.3 \
+  doc/pcre_refcount.3 \
+  doc/pcresample.3 \
+  doc/pcrestack.3 \
+  doc/pcre_study.3 \
+  doc/pcre_version.3
+
+if WITH_PCRE_CPP
+dist_man_MANS += doc/pcrecpp.3
+endif # WITH_PCRE_CPP
Index: pcre-config.in
===================================================================
--- pcre-config.in    (revision 2)
+++ pcre-config.in    (working copy)
@@ -43,7 +43,7 @@
       echo $exec_prefix
       ;;
     --version)
-      echo @PCRE_VERSION@
+      echo @PACKAGE_VERSION@
       ;;
     --cflags | --cflags-posix)
       if test @includedir@ != /usr/include ; then
Index: configure.ac
===================================================================
--- configure.ac    (revision 2)
+++ configure.ac    (working copy)
@@ -1,104 +1,143 @@
 dnl Process this file with autoconf to produce a configure script.


-dnl This configure.in file has been hacked around quite a lot as a result of
-dnl patches that various people have sent to me (PH). Sometimes the information
-dnl I get is contradictory. I've tried to put in comments that explain things,
-dnl but in some cases the information is second-hand and I have no way of
-dnl verifying it. I am not an autoconf or libtool expert!
+AC_PREREQ(2.57)

-dnl This is required at the start; the name is the name of a file
-dnl it should be seeing, to verify it is in the same directory.
+m4_define(pcre_major, 7)                                                                        
+m4_define(pcre_minor, 0)                                                                        
+m4_define(pcre_prerelease, )                                                                          
+m4_define(pcre_date, 18-Dec-2006)                                                                     


-AC_INIT(dftables.c)
-AC_CONFIG_SRCDIR([pcre.h])
+AC_INIT(pcre, pcre_major.pcre_minor[pcre_prerelease])
+AC_CONFIG_SRCDIR([pcre.h.in])
+AM_INIT_AUTOMAKE
+AC_CONFIG_HEADERS(config.h)
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_INSTALL
+AC_LIBTOOL_WIN32_DLL
+AC_PROG_LIBTOOL

-dnl A safety precaution
+PCRE_MAJOR="pcre_major"
+PCRE_MINOR="pcre_minor"
+PCRE_PRERELEASE="pcre_prerelease"
+PCRE_DATE="pcre_date"

-AC_PREREQ(2.57)
+dnl Define all variables that represents the AC_ARG_ENABLE options.
+ac_pcre_cpp="yes"
+ac_pcre_utf8="no"
+ac_pcre_unicode_properties="no"
+ac_pcre_unicode_properties_set="no"
+ac_pcre_newline=10
+ac_pcre_ebcdic=0
+ac_pcre_no_recurse="yes"
+ac_pcre_posix_malloc_threshold=10
+ac_pcre_link_size=2
+ac_pcre_match_limit=10000000
+ac_pcre_match_limit_recursion=$ac_pcre_match_limit
+ac_pcre_match_limit_recursion_set="no"

-dnl Arrange to build config.h from config.h.in.
-dnl Manual says this macro should come right after AC_INIT.
-AC_CONFIG_HEADER(config.h)
+AC_ARG_ENABLE(cpp, AC_HELP_STRING([--disable-cpp],[disable C++ support]),
+ac_pcre_cpp="no")

-dnl Default values for miscellaneous macros
+dnl Handle --enable-utf8
+AC_ARG_ENABLE(utf8, AC_HELP_STRING([--enable-utf8],[enable UTF8 support]),
+ac_pcre_utf8="yes")

-POSIX_MALLOC_THRESHOLD=-DPOSIX_MALLOC_THRESHOLD=10
+dnl Handle --enable-unicode-properties
+AC_ARG_ENABLE(unicode-properties, AC_HELP_STRING([--enable-unicode-properties],
+[enable Unicode properties support (turns on --enable-utf8)]),
+ac_pcre_unicode_properties="yes"
+ac_pcre_unicode_properties_set="yes")

-dnl Provide versioning information for libtool shared libraries that
-dnl are built by default on Unix systems.
+dnl Handle --enable-newline-is-cr
+AC_ARG_ENABLE(newline-is-cr, AC_HELP_STRING([--enable-newline-is-cr],
+[use CR as the newline character]),
+ac_pcre_newline=13)

-PCRE_LIB_VERSION=0:1:0
-PCRE_POSIXLIB_VERSION=0:0:0
-PCRE_CPPLIB_VERSION=0:0:0
+dnl Handle --enable-newline-is-lf
+AC_ARG_ENABLE(newline-is-lf, AC_HELP_STRING([--enable-newline-is-lf],
+[use LF as the newline character]),
+ac_pcre_newline=10)

-dnl Find the PCRE version from the pcre.h file. The PCRE_VERSION variable is
-dnl substituted in pcre-config.in.
+dnl Handle --enable-newline-is-crlf
+AC_ARG_ENABLE(newline-is-crlf, AC_HELP_STRING([--enable-newline-is-crlf],
+[use CRLF as the newline sequence]),
+ac_pcre_newline=3338)

-PCRE_MAJOR=`grep '#define PCRE_MAJOR' ${srcdir}/pcre.h | cut -c 29-`
-PCRE_MINOR=`grep '#define PCRE_MINOR' ${srcdir}/pcre.h | cut -c 29-`
-PCRE_PRERELEASE=`grep '#define PCRE_PRERELEASE' ${srcdir}/pcre.h | cut -c 29-`
-PCRE_VERSION=${PCRE_MAJOR}.${PCRE_MINOR}${PCRE_PRERELEASE}
+dnl Handle --enable-newline-is-any
+AC_ARG_ENABLE(newline-is-any, AC_HELP_STRING([--enable-newline-is-any],
+[use any Unicode newline sequence]),
+ac_pcre_newline=-1)

-dnl Handle --disable-cpp
+dnl Handle --enable-ebcdic
+AC_ARG_ENABLE(ebcdic, AC_HELP_STRING([--enable-ebcdic],
+[assume EBCDIC coding rather than ASCII]),
+ac_pcre_ebcdic=1)

-AC_ARG_ENABLE(cpp,
-[  --disable-cpp           disable C++ support],
-want_cpp="$enableval", want_cpp=yes)
+dnl Handle --disable-stack-for-recursion
+AC_ARG_ENABLE(stack-for-recursion, AC_HELP_STRING([--disable-stack-for-recursion],
+[disable use of stack recursion when matching]),
+ac_pcre_no_recurse="no")


-dnl Checks for programs.
+dnl Handle --with-posix-malloc-threshold=n
+AC_ARG_WITH(posix-malloc-threshold, AC_HELP_STRING([--with-posix-malloc-threshold],
+[threshold for POSIX malloc usage (default=10)]),
+ac_pcre_posix_malloc_threshold=$withval)

-AC_PROG_CC
+dnl Handle --with-link-size=n
+AC_ARG_WITH(link-size, AC_HELP_STRING([--with-link-size],
+[internal link size (2, 3, or 4 allowed) (default=2)]),
+ac_pcre_link_size=$withval)

-dnl Test for C++ for the C++ wrapper libpcrecpp. It seems, however, that
-dnl AC_PROC_CXX will set $CXX to "g++" when no C++ compiler is installed, even
-dnl though that is completely bogus. (This may happen only on certain systems
-dnl with certain versions of autoconf, of course.) An attempt to include this
-dnl test inside a check for want_cpp was criticized by a libtool expert, who
-dnl tells me that it isn't allowed.
+dnl Handle --with-match-limit=n
+AC_ARG_WITH(match-limit, AC_HELP_STRING([--with-match-limit],
+[default limit on internal looping (default=10000000)]),
+ac_pcre_match_limit=$withval)

-AC_PROG_CXX
+dnl Handle --with-match-limit_recursion=n
+AC_ARG_WITH(match-limit-recursion, AC_HELP_STRING([--with-match-limit-recursion],
+[default limit on internal recursion (default 10000000)]),
+ac_pcre_match_limit_recursion=$withval
+ac_pcre_match_limit_recursion_set="yes")

-dnl The icc compiler has the same options as gcc, so let the rest of the
-dnl configure script think it has gcc when setting up dnl options etc.
-dnl This is a nasty hack which no longer seems necessary with the update
-dnl to the latest libtool files, so I have commented it out.
-dnl
-dnl if test "$CC" = "icc" ; then GCC=yes ; fi
+dnl Make sure that ac_pcre_match_limit_recursion is the same as ac_pcre_match_limit
+dnl unless the user explicitly set ac_pcre_match_limit_recursion
+if test "$ac_pcre_match_limit_recursion_set" = "no"; then
+ ac_pcre_match_limit_recursion=$ac_pcre_match_limit
+fi

-AC_PROG_INSTALL
-AC_LIBTOOL_WIN32_DLL
-AC_PROG_LIBTOOL
+dnl Make sure that if ac_pcre_unicode_properties was set, that utf8 support
+dnl is enabled
+if test "$ac_pcre_unicode_properties_set" = "yes"; then
+ ac_pcre_utf8="yes"
+fi

-dnl We need to find a compiler for compiling a program to run on the local host
-dnl while building. It needs to be different from CC when cross-compiling.
-dnl There is a macro called AC_PROG_CC_FOR_BUILD in the GNU archive for
-dnl figuring this out automatically. Unfortunately, it does not work with the
-dnl latest versions of autoconf. So for the moment, we just default to the
-dnl same values as the "main" compiler. People who are cross-compiling will
-dnl just have to adjust the Makefile by hand or set these values when they
-dnl run "configure".
+AH_TOP([
+/* On Unix-like systems config.in is converted by "configure" into
+config.h. Some other environments also support the use of "configure".
+PCRE is written in Standard C, but there are a few non-standard things
+it can cope with, allowing it to run on SunOS4 and other "close to
+standard" systems.

-CC_FOR_BUILD=${CC_FOR_BUILD:-'$(CC)'}
-CXX_FOR_BUILD=${CXX_FOR_BUILD:-'$(CXX)'}
-CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD:-'$(CFLAGS)'}
-CPPFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD:-'$(CPPFLAGS)'}
-CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD:-'$(CXXFLAGS)'}
-BUILD_EXEEXT=${BUILD_EXEEXT:-'$(EXEEXT)'}
-BUILD_OBJEXT=${BUILD_OBJEXT:-'$(OBJEXT)'}
+On a non-Unix-like system you should just copy this file into config.h,
+and set up the macros the way you need them. You should normally change
+the definitions of HAVE_STRERROR and HAVE_MEMMOVE to 1. Unfortunately,
+because of the way autoconf works, these cannot be made the defaults.
+If your system has bcopy() and not memmove(), change the definition of
+HAVE_BCOPY instead of HAVE_MEMMOVE. If your system has neither bcopy()
+nor memmove(), leave them both as 0; an emulation function will be
+used. */])

dnl Checks for header files.
-
AC_HEADER_STDC
-AC_CHECK_HEADERS(limits.h)
+AC_CHECK_HEADERS(limits.h sys/types.h sys/stat.h dirent.h windows.h)

-dnl The files below are C++ header files. One person told me (PH) that
-dnl AC_LANG_CPLUSPLUS unsets CXX if it was explicitly set to something which
-dnl doesn't work. However, this doesn't always seem to be the case.
-
-if test "x$want_cpp" = "xyes" -a -n "$CXX"
+dnl The files below are C++ header files.
+pcre_have_type_traits="0"
+pcre_have_bits_type_traits="0"
+if test "x$ac_pcre_cpp" = "xyes" -a -n "$CXX"
then
-AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
+AC_LANG_PUSH(C++)

 dnl We could be more clever here, given we're doing AC_SUBST with this
 dnl (eg set a var to be the name of the include file we want).  But we're not
@@ -110,21 +149,13 @@
 AC_CHECK_HEADERS(type_traits.h, [pcre_have_type_traits="1"],
                                 [pcre_have_type_traits="0"])
 dnl Using AC_SUBST eliminates the need to include config.h in a public .h file
+AC_LANG_POP
+fi
+AC_SUBST(pcre_have_type_traits)
 AC_SUBST(pcre_have_bits_type_traits)
-AC_SUBST(pcre_have_type_traits)
-AC_LANG_RESTORE
-fi


-dnl From the above, we now have enough info to know if C++ is fully installed
-if test "x$want_cpp" = "xyes" -a -n "$CXX" -a "$pcre_have_cpp_headers" = 1; then
- MAYBE_CPP_TARGETS='$(CPP_TARGETS)'
- HAVE_CPP=
-else
- MAYBE_CPP_TARGETS=
- HAVE_CPP="#"
-fi
-AC_SUBST(MAYBE_CPP_TARGETS)
-AC_SUBST(HAVE_CPP)
+dnl Conditional compilation
+AM_CONDITIONAL(WITH_PCRE_CPP, test "$ac_pcre_cpp" = "yes")

dnl Checks for typedefs, structures, and compiler characteristics.

@@ -140,172 +171,157 @@

AC_CHECK_FUNCS(bcopy memmove strerror strtoq strtoll)

-dnl Handle --enable-utf8
-
-AC_ARG_ENABLE(utf8,
-[  --enable-utf8           enable UTF8 support],
-if test "$enableval" = "yes"; then
-  UTF8=-DSUPPORT_UTF8
+if test "x$enable_shared" = "xno" ; then
+    AC_DEFINE([PCRE_STATIC],[1],[to link statically])
 fi
-)


-dnl Handle --enable-unicode-properties
-
-AC_ARG_ENABLE(unicode-properties,
-[ --enable-unicode-properties enable Unicode properties support],
-if test "$enableval" = "yes"; then
- UCP=-DSUPPORT_UCP
+dnl Here is where pcre specific defines are handled
+if test "$ac_pcre_utf8" = "yes"; then
+ AC_DEFINE([SUPPORT_UTF8], [], [UTF8 support])
fi
-)

-dnl Handle --enable-newline-is-cr
-
-AC_ARG_ENABLE(newline-is-cr,
-[ --enable-newline-is-cr use CR as the newline character],
-if test "$enableval" = "yes"; then
- NEWLINE=-DNEWLINE=13
+if test "$ac_pcre_unicode_properties" = "yes"; then
+ AC_DEFINE([SUPPORT_UCP], [], [unicode properties support])
fi
-)

-dnl Handle --enable-newline-is-lf
-
-AC_ARG_ENABLE(newline-is-lf,
-[  --enable-newline-is-lf  use LF as the newline character],
-if test "$enableval" = "yes"; then
-  NEWLINE=-DNEWLINE=10
+if test "$ac_pcre_no_recurse" = "no"; then
+  AC_DEFINE([NO_RECURSE], [], [
+    PCRE uses recursive function calls to handle backtracking while 
+    matching.  This can sometimes be a problem on systems that have 
+    stacks of limited size.  Define NO_RECURSE to get a version that 
+    doesn't use recursion in the match() function; instead it creates 
+    its own stack by steam using pcre_recurse_malloc() to obtain memory 
+    from the heap. For more detail, see the comments and other stuff 
+    just above the match() function. On systems that support it, 
+    "configure" can be used to set this in the Makefile 
+    (use --disable-stack-for-recursion).])
 fi
-)


-dnl Handle --enable-newline-is-crlf
+AC_DEFINE_UNQUOTED([NEWLINE], [$ac_pcre_newline], [
+ The value of NEWLINE determines the newline character. The default is
+ to leave it up to the compiler, but some sites want to force a
+ particular value. On Unix-like systems, "configure" can be used to
+ override this default.])

-AC_ARG_ENABLE(newline-is-crlf,
-[ --enable-newline-is-crlf use CRLF as the newline sequence],
-if test "$enableval" = "yes"; then
- NEWLINE=-DNEWLINE=3338
-fi
-)
+AC_DEFINE_UNQUOTED([LINK_SIZE], [$ac_pcre_link_size], [
+ The value of LINK_SIZE determines the number of bytes used to store
+ links as offsets within the compiled regex. The default is 2, which
+ allows for compiled patterns up to 64K long. This covers the vast
+ majority of cases. However, PCRE can also be compiled to use 3 or 4
+ bytes instead. This allows for longer patterns in extreme cases. On
+ systems that support it, "configure" can be used to override this default.])

-dnl Handle --enable-newline-is-any
+AC_DEFINE_UNQUOTED([POSIX_MALLOC_THRESHOLD], [$ac_pcre_posix_malloc_threshold], [
+ When calling PCRE via the POSIX interface, additional working storage
+ is required for holding the pointers to capturing substrings because
+ PCRE requires three integers per substring, whereas the POSIX
+ interface provides only two. If the number of expected substrings is
+ small, the wrapper function uses space on the stack, because this is
+ faster than using malloc() for each call. The threshold above which
+ the stack is no longer used is defined by POSIX_MALLOC_THRESHOLD. On
+ systems that support it, "configure" can be used to override this
+ default.])

-AC_ARG_ENABLE(newline-is-any,
-[ --enable-newline-is-any use any Unicode newline sequence],
-if test "$enableval" = "yes"; then
- NEWLINE=-DNEWLINE=-1
-fi
-)
+AC_DEFINE_UNQUOTED([MATCH_LIMIT], [$ac_pcre_match_limit], [
+ The value of MATCH_LIMIT determines the default number of times the
+ internal match() function can be called during a single execution of
+ pcre_exec(). There is a runtime interface for setting a different
+ limit. The limit exists in order to catch runaway regular
+ expressions that take for ever to determine that they do not match.
+ The default is set very large so that it does not accidentally catch
+ legitimate cases. On systems that support it, "configure" can be
+ used to override this default default.])

-dnl Handle --enable-ebcdic
+AC_DEFINE_UNQUOTED([MATCH_LIMIT_RECURSION], [$ac_pcre_match_limit_recursion], [
+ The above limit applies to all calls of match(), whether or not they
+ increase the recursion depth. In some environments it is desirable
+ to limit the depth of recursive calls of match() more strictly, in
+ order to restrict the maximum amount of stack (or heap, if
+ NO_RECURSE is defined) that is used. The value of
+ MATCH_LIMIT_RECURSION applies only to recursive calls of match(). To
+ have any useful effect, it must be less than the value of
+ MATCH_LIMIT. There is a runtime method for setting a different
+ limit. On systems that support it, "configure" can be used to
+ override this default default.])

-AC_ARG_ENABLE(ebcdic,
-[  --enable-ebcdic         assume EBCDIC coding rather than ASCII],
-if test "$enableval" = "yes"; then
-  EBCDIC=-DEBCDIC=1
-fi
-)
+AC_DEFINE([MAX_NAME_SIZE], [32], [
+  This limit is parameterized just in case anybody ever wants to
+  change it. Care must be taken if it is increased, because it guards
+  against integer overflow caused by enormously large patterns.])


-dnl Handle --disable-stack-for-recursion
+AC_DEFINE([MAX_NAME_COUNT], [10000], [
+ This limit is parameterized just in case anybody ever wants to
+ change it. Care must be taken if it is increased, because it guards
+ against integer overflow caused by enormously large patterns.])

-AC_ARG_ENABLE(stack-for-recursion,
-[ --disable-stack-for-recursion disable use of stack recursion when matching],
-if test "$enableval" = "no"; then
- NO_RECURSE=-DNO_RECURSE
-fi
-)
+AC_DEFINE([MAX_DUPLENGTH], [30000], [
+ This limit is parameterized just in case anybody ever wants to
+ change it. Care must be taken if it is increased, because it guards
+ against integer overflow caused by enormously large patterns.])

-dnl There doesn't seem to be a straightforward way of having parameters
-dnl that set values, other than fudging the --with thing. So that's what
-dnl I've done.
+AH_VERBATIM([PCRE_DATA_SCOPE], [
+/* If you are compiling for a system other than a Unix-like system or
+ Win32, and it needs some magic to be inserted before the definition
+ of a function that is exported by the library, define this macro to
+ contain the relevant magic. If you do not define this macro, it
+ defaults to "extern" for a C compiler and "extern C" for a C++
+ compiler on non-Win32 systems. This macro apears at the start of
+ every exported function that is part of the external API. It does
+ not appear on functions that are "external" in the C sense, but
+ which are internal to the library. */
+#undef PCRE_DATA_SCOPE])

-dnl Handle --with-posix-malloc-threshold=n
+AC_DEFINE_UNQUOTED([EBCDIC], [$ac_pcre_ebcdic], [
+ If you are compiling for a system that uses EBCDIC instead of ASCII
+ character codes, define this macro as 1. On systems that can use
+ "configure", this can be done via --enable-ebcdic.])

-AC_ARG_WITH(posix-malloc-threshold,
-[  --with-posix-malloc-threshold=10  threshold for POSIX malloc usage],
-  POSIX_MALLOC_THRESHOLD=-DPOSIX_MALLOC_THRESHOLD=$withval
-)
+dnl Platform specific issues
+NO_UNDEFINED=
+EXPORT_ALL_SYMBOLS=
+case $host_os in
+  cygwin* | mingw* )
+    if test X"$enable_shared" = Xyes; then
+      NO_UNDEFINED="-no-undefined"
+      EXPORT_ALL_SYMBOLS="-Wl,--export-all-symbols"
+    fi
+    ;;
+esac


-dnl Handle --with-link-size=n
+dnl Here is where pcre specific substs are handled
+dnl These 3 are only used by RunTest.in.
+dnl TODO: remove once RunTest uses pcretest -C instead.
+AC_SUBST(LINK_SIZE, $ac_pcre_link_size)
+AC_SUBST(UTF8, $ac_pcre_utf8)
+AC_SUBST(UCP, $ac_pcre_unicode_properties)
+dnl Used for version numbers in pcre.h.in
+AC_SUBST(PCRE_MAJOR)
+AC_SUBST(PCRE_MINOR)
+AC_SUBST(PCRE_PRERELEASE)
+AC_SUBST(PCRE_DATE)
+dnl The extra LDFLAGS for each particular library

-AC_ARG_WITH(link-size,
-[  --with-link-size=2    internal link size (2, 3, or 4 allowed)],
-  LINK_SIZE=-DLINK_SIZE=$withval
-)
+dnl Provide versioning information for libtool shared libraries that
+dnl are built by default on Unix systems.
+PCRE_LIB_VERSION=0:1:0
+PCRE_POSIXLIB_VERSION=0:0:0
+PCRE_CPPLIB_VERSION=0:0:0


-dnl Handle --with-match-limit=n
+EXTRA_LIBPCRE_LDFLAGS="$EXTRA_LIBPCRE_LDFLAGS $NO_UNDEFINED"
+EXTRA_LIBPCRE_LDFLAGS="$EXTRA_LIBPCRE_LDFLAGS -version-info $PCRE_LIB_VERSION"

-AC_ARG_WITH(match-limit,
-[ --with-match-limit=10000000 default limit on internal looping],
- MATCH_LIMIT=-DMATCH_LIMIT=$withval
-)
+EXTRA_LIBPCREPOSIX_LDFLAGS="$EXTRA_LIBPCREPOSIX_LDFLAGS $NO_UNDEFINED"
+EXTRA_LIBPCREPOSIX_LDFLAGS="$EXTRA_LIBPCREPOSIX_LDFLAGS -version-info $PCRE_POSIXLIB_VERSION"

-dnl Handle --with-match-limit_recursion=n
+EXTRA_LIBPCRECPP_LDFLAGS="$EXTRA_LIBPCRECPP_LDFLAGS $NO_UNDEFINED"
+EXTRA_LIBPCRECPP_LDFLAGS="$EXTRA_LIBPCRECPP_LDFLAGS -version-info $PCRE_CPPLIB_VERSION"

-AC_ARG_WITH(match-limit-recursion,
-[ --with-match-limit-recursion=10000000 default limit on internal recursion],
- MATCH_LIMIT_RECURSION=-DMATCH_LIMIT_RECURSION=$withval
-)
+AC_SUBST(EXTRA_LIBPCRE_LDFLAGS)
+AC_SUBST(EXTRA_LIBPCREPOSIX_LDFLAGS)
+AC_SUBST(EXTRA_LIBPCRECPP_LDFLAGS)

-dnl Unicode character property support implies UTF-8 support
-
-if test "$UCP" != "" ; then
-  UTF8=-DSUPPORT_UTF8
-fi
-
-dnl "Export" these variables
-
-AC_SUBST(BUILD_EXEEXT)
-AC_SUBST(BUILD_OBJEXT)
-AC_SUBST(CC_FOR_BUILD)
-AC_SUBST(CXX_FOR_BUILD)
-AC_SUBST(CFLAGS_FOR_BUILD)
-AC_SUBST(CXXFLAGS_FOR_BUILD)
-AC_SUBST(CXXLDFLAGS)
-AC_SUBST(EBCDIC)
-AC_SUBST(HAVE_MEMMOVE)
-AC_SUBST(HAVE_STRERROR)
-AC_SUBST(LINK_SIZE)
-AC_SUBST(MATCH_LIMIT)
-AC_SUBST(MATCH_LIMIT_RECURSION)
-AC_SUBST(NEWLINE)
-AC_SUBST(NO_RECURSE)
-AC_SUBST(PCRE_LIB_VERSION)
-AC_SUBST(PCRE_POSIXLIB_VERSION)
-AC_SUBST(PCRE_CPPLIB_VERSION)
-AC_SUBST(PCRE_VERSION)
-AC_SUBST(POSIX_MALLOC_THRESHOLD)
-AC_SUBST(UCP)
-AC_SUBST(UTF8)
-
-dnl Stuff to make MinGW work better. Special treatment is no longer
-dnl needed for Cygwin.
-
-case $host_os in
-mingw* )
-    POSIX_OBJ=pcreposix.o
-    POSIX_LOBJ=pcreposix.lo
-    POSIX_LIB=
-    ON_WINDOWS=
-    NOT_ON_WINDOWS="#"
-    WIN_PREFIX=
-    ;;
-* )
-    ON_WINDOWS="#"
-    NOT_ON_WINDOWS=
-    POSIX_OBJ=
-    POSIX_LOBJ=
-    POSIX_LIB=libpcreposix.la
-    WIN_PREFIX=
-    ;;
-esac
-AC_SUBST(WIN_PREFIX)
-AC_SUBST(ON_WINDOWS)
-AC_SUBST(NOT_ON_WINDOWS)
-AC_SUBST(POSIX_OBJ)
-AC_SUBST(POSIX_LOBJ)
-AC_SUBST(POSIX_LIB)
-
-if test "x$enable_shared" = "xno" ; then
-    AC_DEFINE([PCRE_STATIC],[1],[to link statically])
-fi
-
 dnl This must be last; it determines what files are written as well as config.h
-AC_OUTPUT(Makefile pcre-config:pcre-config.in libpcre.pc:libpcre.pc.in libpcrecpp.pc:libpcrecpp.pc.in pcrecpparg.h:pcrecpparg.h.in pcre_stringpiece.h:pcre_stringpiece.h.in RunGrepTest:RunGrepTest.in RunTest:RunTest.in,[chmod a+x RunTest RunGrepTest pcre-config])
+AC_CONFIG_FILES(Makefile pcre-config libpcre.pc libpcrecpp.pc pcre.h pcrecpparg.h \
+pcre_stringpiece.h RunGrepTest RunTest)
+AC_CONFIG_COMMANDS([do-chmod],[chmod a+x RunTest RunGrepTest pcre-config])
+AC_OUTPUT
Index: libpcre.pc.in
===================================================================
--- libpcre.pc.in    (revision 2)
+++ libpcre.pc.in    (working copy)
@@ -7,6 +7,6 @@


 Name: libpcre
 Description: PCRE - Perl compatible regular expressions C library
-Version: @PCRE_VERSION@
+Version: @PACKAGE_VERSION@
 Libs: -L${libdir} -lpcre
 Cflags: -I${includedir}
Index: pcregrep.c
===================================================================
--- pcregrep.c    (revision 2)
+++ pcregrep.c    (working copy)
@@ -56,7 +56,6 @@


typedef int BOOL;

-#define VERSION "4.4 29-Nov-2006"
#define MAX_PATTERN_COUNT 100

#if BUFSIZ > 8192
@@ -244,7 +243,7 @@

/************* Directory scanning in Unix ***********/

-#if IS_UNIX
+#if defined HAVE_SYS_STAT_H && defined HAVE_DIRENT_H && defined HAVE_SYS_TYPES_H
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
@@ -314,7 +313,7 @@
when it did not exist. */


-#elif HAVE_WIN32API
+#elif HAVE_WINDOWS_H

#ifndef STRICT
# define STRICT
@@ -436,8 +435,8 @@
typedef void directory_type;

int isdirectory(char *filename) { return 0; }
-directory_type * opendirectory(char *filename) {}
-char *readdirectory(directory_type *dir) {}
+directory_type * opendirectory(char *filename) { return (directory_type*)0;}
+char *readdirectory(directory_type *dir) { return (char*)0;}
void closedirectory(directory_type *dir) {}


@@ -1328,8 +1327,7 @@
case 'x': process_options |= PO_LINE_MATCH; break;

case 'V':
- fprintf(stderr, "pcregrep version %s using ", VERSION);
- fprintf(stderr, "PCRE version %s\n", pcre_version());
+ fprintf(stderr, "pcregrep version %s\n", pcre_version());
exit(0);
break;

Index: libpcrecpp.pc.in
===================================================================
--- libpcrecpp.pc.in    (revision 2)
+++ libpcrecpp.pc.in    (working copy)
@@ -7,6 +7,6 @@


Name: libpcrecpp
Description: PCRECPP - C++ wrapper for PCRE
-Version: @PCRE_VERSION@
+Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lpcre -lpcrecpp
Cflags: -I${includedir}