summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt13
-rw-r--r--ChangeLog4
-rw-r--r--configure.ac13
-rw-r--r--src/config.h.generic8
-rw-r--r--src/config.h.in8
-rw-r--r--src/pcre2.h24
-rw-r--r--src/pcre2.h.generic24
-rw-r--r--src/pcre2.h.in24
8 files changed, 88 insertions, 30 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 59f4ef5..9186970 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -80,6 +80,7 @@
# 2017-03-11 PH turned HEAP_MATCH_RECURSE into a NO-OP for 10.30
# 2017-04-08 PH added HEAP_LIMIT
# 2017-06-15 ZH added SUPPORT_JIT_SEALLOC support
+# 2018-06-19 PH added checks for stdint.h and inttypes.h
PROJECT(PCRE2 C)
@@ -113,6 +114,18 @@ CHECK_INCLUDE_FILE(sys/types.h HAVE_SYS_TYPES_H)
CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H)
CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H)
+IF(HAVE_INTTYPES_H)
+ SET(PCRE2_HAVE_INTTYPES_H 1)
+ELSE(HAVE_INTTYPES_H)
+ SET(PCRE2_HAVE_INTTYPES_H 0)
+ENDIF(HAVE_INTTYPES_H)
+
+IF(HAVE_STDINT_H)
+ SET(PCRE2_HAVE_STDINT_H 1)
+ELSE(HAVE_STDINT_H)
+ SET(PCRE2_HAVE_STDINT_H 0)
+ENDIF(HAVE_STDINT_H)
+
CHECK_FUNCTION_EXISTS(bcopy HAVE_BCOPY)
CHECK_FUNCTION_EXISTS(memmove HAVE_MEMMOVE)
CHECK_FUNCTION_EXISTS(strerror HAVE_STRERROR)
diff --git a/ChangeLog b/ChangeLog
index 5da4cd6..d922ffd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -70,6 +70,10 @@ failed. All such tests now set 10 000 000 as the upper limit.
16. Another Windows related patch for pcregrep to ensure that WIN32 is
undefiined under Cygwin.
+17. Test for the presence of stdint.h and inttypes.h in configure and CMake and
+include whichever exists (stdint preferred) instead of unconditionally
+including stdint. This makes life easier for old and non-standard systems.
+
Version 10.31 12-February-2018
------------------------------
diff --git a/configure.ac b/configure.ac
index ad41469..639258b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -435,10 +435,10 @@ to set the macro values. In this case, you do not have to set -DHAVE_CONFIG_H,
but if you do, default values will be taken from config.h for non-boolean
macros that are not defined on the command line.
-Boolean macros such as HAVE_STDLIB_H and SUPPORT_PCRE2_8 should either be defined
-(conventionally to 1) for TRUE, and not defined at all for FALSE. All such
-macros are listed as a commented #undef in config.h.generic. Macros such as
-MATCH_LIMIT, whose actual value is relevant, have defaults defined, but are
+Boolean macros such as HAVE_STDLIB_H and SUPPORT_PCRE2_8 should either be
+defined (conventionally to 1) for TRUE, and not defined at all for FALSE. All
+such macros are listed as a commented #undef in config.h.generic. Macros such
+as MATCH_LIMIT, whose actual value is relevant, have defaults defined, but are
surrounded by #ifndef/#endif lines so that the value can be overridden by -D.
PCRE2 uses memmove() if HAVE_MEMMOVE is defined; otherwise it uses bcopy() if
@@ -451,6 +451,11 @@ AC_CHECK_HEADERS(limits.h sys/types.h sys/stat.h dirent.h)
AC_CHECK_HEADERS([windows.h], [HAVE_WINDOWS_H=1])
AC_CHECK_HEADERS([sys/wait.h], [HAVE_SYS_WAIT_H=1])
+AC_CHECK_HEADERS([stdint.h], [PCRE2_HAVE_STDINT_H=1])
+AC_CHECK_HEADERS([inttypes.h], [PCRE2_HAVE_INTTYPES_H=1])
+AC_SUBST([PCRE2_HAVE_STDINT_H])
+AC_SUBST([PCRE2_HAVE_INTTYPES_H])
+
# Conditional compilation
AM_CONDITIONAL(WITH_PCRE2_8, test "x$enable_pcre2_8" = "xyes")
AM_CONDITIONAL(WITH_PCRE2_16, test "x$enable_pcre2_16" = "xyes")
diff --git a/src/config.h.generic b/src/config.h.generic
index dfce8a7..a21213a 100644
--- a/src/config.h.generic
+++ b/src/config.h.generic
@@ -18,10 +18,10 @@ to set the macro values. In this case, you do not have to set -DHAVE_CONFIG_H,
but if you do, default values will be taken from config.h for non-boolean
macros that are not defined on the command line.
-Boolean macros such as HAVE_STDLIB_H and SUPPORT_PCRE2_8 should either be defined
-(conventionally to 1) for TRUE, and not defined at all for FALSE. All such
-macros are listed as a commented #undef in config.h.generic. Macros such as
-MATCH_LIMIT, whose actual value is relevant, have defaults defined, but are
+Boolean macros such as HAVE_STDLIB_H and SUPPORT_PCRE2_8 should either be
+defined (conventionally to 1) for TRUE, and not defined at all for FALSE. All
+such macros are listed as a commented #undef in config.h.generic. Macros such
+as MATCH_LIMIT, whose actual value is relevant, have defaults defined, but are
surrounded by #ifndef/#endif lines so that the value can be overridden by -D.
PCRE2 uses memmove() if HAVE_MEMMOVE is defined; otherwise it uses bcopy() if
diff --git a/src/config.h.in b/src/config.h.in
index 833cf12..d8a5280 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -18,10 +18,10 @@ to set the macro values. In this case, you do not have to set -DHAVE_CONFIG_H,
but if you do, default values will be taken from config.h for non-boolean
macros that are not defined on the command line.
-Boolean macros such as HAVE_STDLIB_H and SUPPORT_PCRE2_8 should either be defined
-(conventionally to 1) for TRUE, and not defined at all for FALSE. All such
-macros are listed as a commented #undef in config.h.generic. Macros such as
-MATCH_LIMIT, whose actual value is relevant, have defaults defined, but are
+Boolean macros such as HAVE_STDLIB_H and SUPPORT_PCRE2_8 should either be
+defined (conventionally to 1) for TRUE, and not defined at all for FALSE. All
+such macros are listed as a commented #undef in config.h.generic. Macros such
+as MATCH_LIMIT, whose actual value is relevant, have defaults defined, but are
surrounded by #ifndef/#endif lines so that the value can be overridden by -D.
PCRE2 uses memmove() if HAVE_MEMMOVE is defined; otherwise it uses bcopy() if
diff --git a/src/pcre2.h b/src/pcre2.h
index 6ed08ef..4422d29 100644
--- a/src/pcre2.h
+++ b/src/pcre2.h
@@ -41,10 +41,16 @@ POSSIBILITY OF SUCH DAMAGE.
/* The current PCRE version information. */
-#define PCRE2_MAJOR 10
-#define PCRE2_MINOR 32
-#define PCRE2_PRERELEASE -RC1
-#define PCRE2_DATE 2018-02-19
+#define PCRE2_MAJOR 10
+#define PCRE2_MINOR 32
+#define PCRE2_PRERELEASE -RC1
+#define PCRE2_DATE 2018-02-19
+
+/* For the benefit of systems without stdint.h, an alternative is to use
+inttypes.h. The existence of these headers is checked by configure or CMake. */
+
+#define PCRE2_HAVE_STDINT_H 1
+#define PCRE2_HAVE_INTTYPES_H 1
/* When an application links to a PCRE DLL in Windows, the symbols that are
imported have to be identified as such. When building PCRE2, the appropriate
@@ -81,12 +87,18 @@ set, we ensure here that it has no effect. */
#define PCRE2_CALL_CONVENTION
#endif
-/* Have to include limits.h, stdlib.h and stdint.h to ensure that size_t and
-uint8_t, UCHAR_MAX, etc are defined. */
+/* Have to include limits.h, stdlib.h and stdint.h (or inttypes.h) to ensure
+that size_t and uint8_t, UCHAR_MAX, etc are defined. If the system has neither
+header, the relevant values must be provided by some other means. */
#include <limits.h>
#include <stdlib.h>
+
+#if PCRE2_HAVE_STDINT_H
#include <stdint.h>
+#elif PCRE2_HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
/* Allow for C++ users compiling this directly. */
diff --git a/src/pcre2.h.generic b/src/pcre2.h.generic
index 6ed08ef..4422d29 100644
--- a/src/pcre2.h.generic
+++ b/src/pcre2.h.generic
@@ -41,10 +41,16 @@ POSSIBILITY OF SUCH DAMAGE.
/* The current PCRE version information. */
-#define PCRE2_MAJOR 10
-#define PCRE2_MINOR 32
-#define PCRE2_PRERELEASE -RC1
-#define PCRE2_DATE 2018-02-19
+#define PCRE2_MAJOR 10
+#define PCRE2_MINOR 32
+#define PCRE2_PRERELEASE -RC1
+#define PCRE2_DATE 2018-02-19
+
+/* For the benefit of systems without stdint.h, an alternative is to use
+inttypes.h. The existence of these headers is checked by configure or CMake. */
+
+#define PCRE2_HAVE_STDINT_H 1
+#define PCRE2_HAVE_INTTYPES_H 1
/* When an application links to a PCRE DLL in Windows, the symbols that are
imported have to be identified as such. When building PCRE2, the appropriate
@@ -81,12 +87,18 @@ set, we ensure here that it has no effect. */
#define PCRE2_CALL_CONVENTION
#endif
-/* Have to include limits.h, stdlib.h and stdint.h to ensure that size_t and
-uint8_t, UCHAR_MAX, etc are defined. */
+/* Have to include limits.h, stdlib.h and stdint.h (or inttypes.h) to ensure
+that size_t and uint8_t, UCHAR_MAX, etc are defined. If the system has neither
+header, the relevant values must be provided by some other means. */
#include <limits.h>
#include <stdlib.h>
+
+#if PCRE2_HAVE_STDINT_H
#include <stdint.h>
+#elif PCRE2_HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
/* Allow for C++ users compiling this directly. */
diff --git a/src/pcre2.h.in b/src/pcre2.h.in
index a3a3fa6..66191a7 100644
--- a/src/pcre2.h.in
+++ b/src/pcre2.h.in
@@ -41,10 +41,16 @@ POSSIBILITY OF SUCH DAMAGE.
/* The current PCRE version information. */
-#define PCRE2_MAJOR @PCRE2_MAJOR@
-#define PCRE2_MINOR @PCRE2_MINOR@
-#define PCRE2_PRERELEASE @PCRE2_PRERELEASE@
-#define PCRE2_DATE @PCRE2_DATE@
+#define PCRE2_MAJOR @PCRE2_MAJOR@
+#define PCRE2_MINOR @PCRE2_MINOR@
+#define PCRE2_PRERELEASE @PCRE2_PRERELEASE@
+#define PCRE2_DATE @PCRE2_DATE@
+
+/* For the benefit of systems without stdint.h, an alternative is to use
+inttypes.h. The existence of these headers is checked by configure or CMake. */
+
+#define PCRE2_HAVE_STDINT_H @PCRE2_HAVE_STDINT_H@
+#define PCRE2_HAVE_INTTYPES_H @PCRE2_HAVE_INTTYPES_H@
/* When an application links to a PCRE DLL in Windows, the symbols that are
imported have to be identified as such. When building PCRE2, the appropriate
@@ -81,12 +87,18 @@ set, we ensure here that it has no effect. */
#define PCRE2_CALL_CONVENTION
#endif
-/* Have to include limits.h, stdlib.h and stdint.h to ensure that size_t and
-uint8_t, UCHAR_MAX, etc are defined. */
+/* Have to include limits.h, stdlib.h and stdint.h (or inttypes.h) to ensure
+that size_t and uint8_t, UCHAR_MAX, etc are defined. If the system has neither
+header, the relevant values must be provided by some other means. */
#include <limits.h>
#include <stdlib.h>
+
+#if PCRE2_HAVE_STDINT_H
#include <stdint.h>
+#elif PCRE2_HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
/* Allow for C++ users compiling this directly. */