[Pcre-svn] [486] code/trunk: Fix HP compile problem for pcre…

Página Inicial
Delete this message
Autor: Subversion repository
Data:  
Para: pcre-svn
Assunto: [Pcre-svn] [486] code/trunk: Fix HP compile problem for pcrecpp.cc.
Revision: 486
          http://vcs.pcre.org/viewvc?view=rev&revision=486
Author:   ph10
Date:     2010-01-05 17:44:57 +0000 (Tue, 05 Jan 2010)


Log Message:
-----------
Fix HP compile problem for pcrecpp.cc.

Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/configure.ac
    code/trunk/pcrecpp.cc


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2010-01-05 17:13:14 UTC (rev 485)
+++ code/trunk/ChangeLog    2010-01-05 17:44:57 UTC (rev 486)
@@ -1,7 +1,7 @@
 ChangeLog for PCRE
 ------------------


-Version 8.01 11-Dec-09
+Version 8.01 06-Jan-10
----------------------

 1.  If a pattern contained a conditional subpattern with only one branch (in
@@ -67,48 +67,53 @@
       - The compiler thus generates a "C" signature for the test function.
       - The linker fails to find the "C" function.
       - PCRE fails to configure if asked to do so against libbz2.
-      
+
 11. When running libtoolize from libtool-2.2.6b as part of autogen.sh, these
     messages were output:


       Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
       rerunning libtoolize, to keep the correct libtool macros in-tree.
       Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
-      
+
     I have done both of these things.
-    
+
 12. Although pcre_dfa_exec() does not use nearly as much stack as pcre_exec()
-    most of the time, it *can* run out if it is given a pattern that contains a 
-    runaway infinite recursion. I updated the discussion in the pcrestack man 
-    page.  
-    
-13. Now that we have gone to the x.xx style of version numbers, the minor 
-    version may start with zero. Using 08 or 09 is a bad idea because users 
-    might check the value of PCRE_MINOR in their code, and 08 or 09 may be 
-    interpreted as invalid octal numbers. I've updated the previous comment in 
-    configure.ac, and also added a check that gives an error if 08 or 09 are 
+    most of the time, it *can* run out if it is given a pattern that contains a
+    runaway infinite recursion. I updated the discussion in the pcrestack man
+    page.
+
+13. Now that we have gone to the x.xx style of version numbers, the minor
+    version may start with zero. Using 08 or 09 is a bad idea because users
+    might check the value of PCRE_MINOR in their code, and 08 or 09 may be
+    interpreted as invalid octal numbers. I've updated the previous comment in
+    configure.ac, and also added a check that gives an error if 08 or 09 are
     used.
-    
+
 14. Change 8.00/11 was not quite complete: code had been accidentally omitted,
     causing partial matching to fail when the end of the subject matched \W
     in a UTF-8 pattern where \W was quantified with a minimum of 3.
-    
+
 15. There were some discrepancies between the declarations in pcre_internal.h
-    of _pcre_is_newline(), _pcre_was_newline(), and _pcre_valid_utf8() and 
+    of _pcre_is_newline(), _pcre_was_newline(), and _pcre_valid_utf8() and
     their definitions. The declarations used "const uschar *" and the
     definitions used USPTR. Even though USPTR is normally defined as "const
     unsigned char *" (and uschar is typedeffed as "unsigned char"), it was
     reported that: "This difference in casting confuses some C++ compilers, for
     example, SunCC recognizes above declarations as different functions and
-    generates broken code for hbpcre." I have changed the declarations to use 
+    generates broken code for hbpcre." I have changed the declarations to use
     USPTR.
-    
-16. GNU libtool is named differently on some systems. The autogen.sh script now 
+
+16. GNU libtool is named differently on some systems. The autogen.sh script now
     tries several variants such as glibtoolize (MacOSX) and libtoolize1x
     (FreeBSD).
- 


+17. Applied Craig's patch that fixes an HP aCC compile error in pcre 8.00
+    (strtoXX undefined when compiling pcrecpp.cc). The patch contains this
+    comment: "Figure out how to create a longlong from a string: strtoll and
+    equivalent. It's not enough to call AC_CHECK_FUNCS: hpux has a strtoll, for
+    instance, but it only takes 2 args instead of 3!"


+
Version 8.00 19-Oct-09
----------------------


Modified: code/trunk/configure.ac
===================================================================
--- code/trunk/configure.ac    2010-01-05 17:13:14 UTC (rev 485)
+++ code/trunk/configure.ac    2010-01-05 17:44:57 UTC (rev 486)
@@ -11,7 +11,7 @@
 m4_define(pcre_major, [8])
 m4_define(pcre_minor, [01])
 m4_define(pcre_prerelease, [-RC1])
-m4_define(pcre_date, [2010-01-02])
+m4_define(pcre_date, [2010-01-06])


 # Libtool shared library interface versions (current:revision:age)
 m4_define(libpcre_version, [0:1:0])
@@ -340,6 +340,49 @@
 AC_CHECK_HEADERS(type_traits.h, [pcre_have_type_traits="1"],
                                 [pcre_have_type_traits="0"])


+# (This isn't c++-specific, but is only used in pcrecpp.cc, so try this
+# in a c++ context.  This matters becuase strtoimax is C99 and may not
+# be supported by the C++ compiler.)
+# Figure out how to create a longlong from a string: strtoll and
+# equiv.  It's not enough to call AC_CHECK_FUNCS: hpux has a
+# strtoll, for instance, but it only takes 2 args instead of 3!
+# We have to call AH_TEMPLATE since AC_DEFINE_UNQUOTED below is complex.
+AH_TEMPLATE(HAVE_STRTOQ, [Define to 1 if you have `strtoq'.])
+AH_TEMPLATE(HAVE_STRTOLL, [Define to 1 if you have `strtoll'.])
+AH_TEMPLATE(HAVE__STRTOI64, [Define to 1 if you have `_strtoi64'.])
+AH_TEMPLATE(HAVE_STRTOIMAX, [Define to 1 if you have `strtoimax'.])
+have_strto_fn=0
+for fn in srtoq strtoll _strtoi64 strtoimax; do
+  AC_MSG_CHECKING([for $fn])
+  if test "$fn" = strtoimax; then
+    include=stdint.h
+  else
+    include=stdlib.h
+  fi
+  AC_COMPILE_IFELSE(AC_LANG_PROGRAM([#include <$include>],
+                                    [char* e; return $fn("100", &e, 10)]),
+                    [AC_MSG_RESULT(yes)
+                     AC_DEFINE_UNQUOTED(HAVE_`echo $fn | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`, 1,
+                                        [Define to 1 if you have `$fn'.])
+                     have_strto_fn=1
+                     break],
+                    [AC_MSG_RESULT(no)])
+done
+
+if test "$have_strto_fn" = 1; then
+  AC_CHECK_TYPES([long long],
+                 [pcre_have_long_long="1"],
+                 [pcre_have_long_long="0"])
+  AC_CHECK_TYPES([unsigned long long],
+                 [pcre_have_ulong_long="1"],
+                 [pcre_have_ulong_long="0"])
+else
+  pcre_have_long_long="0"
+  pcre_have_ulong_long="0"
+fi
+AC_SUBST(pcre_have_long_long)
+AC_SUBST(pcre_have_ulong_long)
+
 AC_LANG_POP
 fi
 # Using AC_SUBST eliminates the need to include config.h in a public .h file
@@ -355,24 +398,6 @@
 AC_C_CONST
 AC_TYPE_SIZE_T


-pcre_have_strotolonglong=0
-AC_CHECK_FUNCS(strtoq strtoll _strtoi64, [pcre_have_strotolonglong="1"; break])
-# If we can't convert a string to a long long, pretend we don't even
-# have a long long.
-if test $pcre_have_strotolonglong = "0"; then
-   pcre_have_long_long="0"
-   pcre_have_ulong_long="0"
-else
-  AC_CHECK_TYPES([long long],
-                 [pcre_have_long_long="1"],
-                 [pcre_have_long_long="0"])
-  AC_CHECK_TYPES([unsigned long long],
-                 [pcre_have_ulong_long="1"],
-                 [pcre_have_ulong_long="0"])
-fi
-AC_SUBST(pcre_have_long_long)
-AC_SUBST(pcre_have_ulong_long)
-
 # Checks for library functions.


AC_CHECK_FUNCS(bcopy memmove strerror)

Modified: code/trunk/pcrecpp.cc
===================================================================
--- code/trunk/pcrecpp.cc    2010-01-05 17:13:14 UTC (rev 485)
+++ code/trunk/pcrecpp.cc    2010-01-05 17:44:57 UTC (rev 486)
@@ -821,6 +821,8 @@
   long long r = strtoll(str, &end, radix);
 #elif defined HAVE__STRTOI64
   long long r = _strtoi64(str, &end, radix);
+#elif defined HAVE_STRTOIMAX
+  long long r = strtoimax(str, &end, radix);
 #else
 #error parse_longlong_radix: cannot convert input to a long-long
 #endif
@@ -851,6 +853,8 @@
   unsigned long long r = strtoull(str, &end, radix);
 #elif defined HAVE__STRTOI64
   unsigned long long r = _strtoui64(str, &end, radix);
+#elif defined HAVE_STRTOIMAX
+  unsigned long long r = strtoumax(str, &end, radix);
 #else
 #error parse_ulonglong_radix: cannot convert input to a long-long
 #endif