Make stdint.h an optional inclusion, in case it's not present in some systems.
Use inttypes.h instead if it exists.
This commit is contained in:
parent
b4aaf222d7
commit
7aaced3475
|
@ -80,6 +80,7 @@
|
||||||
# 2017-03-11 PH turned HEAP_MATCH_RECURSE into a NO-OP for 10.30
|
# 2017-03-11 PH turned HEAP_MATCH_RECURSE into a NO-OP for 10.30
|
||||||
# 2017-04-08 PH added HEAP_LIMIT
|
# 2017-04-08 PH added HEAP_LIMIT
|
||||||
# 2017-06-15 ZH added SUPPORT_JIT_SEALLOC support
|
# 2017-06-15 ZH added SUPPORT_JIT_SEALLOC support
|
||||||
|
# 2018-06-19 PH added checks for stdint.h and inttypes.h
|
||||||
|
|
||||||
PROJECT(PCRE2 C)
|
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(unistd.h HAVE_UNISTD_H)
|
||||||
CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_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(bcopy HAVE_BCOPY)
|
||||||
CHECK_FUNCTION_EXISTS(memmove HAVE_MEMMOVE)
|
CHECK_FUNCTION_EXISTS(memmove HAVE_MEMMOVE)
|
||||||
CHECK_FUNCTION_EXISTS(strerror HAVE_STRERROR)
|
CHECK_FUNCTION_EXISTS(strerror HAVE_STRERROR)
|
||||||
|
|
|
@ -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
|
16. Another Windows related patch for pcregrep to ensure that WIN32 is
|
||||||
undefiined under Cygwin.
|
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
|
Version 10.31 12-February-2018
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
13
configure.ac
13
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
|
but if you do, default values will be taken from config.h for non-boolean
|
||||||
macros that are not defined on the command line.
|
macros that are not defined on the command line.
|
||||||
|
|
||||||
Boolean macros such as HAVE_STDLIB_H and SUPPORT_PCRE2_8 should either be defined
|
Boolean macros such as HAVE_STDLIB_H and SUPPORT_PCRE2_8 should either be
|
||||||
(conventionally to 1) for TRUE, and not defined at all for FALSE. All such
|
defined (conventionally to 1) for TRUE, and not defined at all for FALSE. All
|
||||||
macros are listed as a commented #undef in config.h.generic. Macros such as
|
such macros are listed as a commented #undef in config.h.generic. Macros such
|
||||||
MATCH_LIMIT, whose actual value is relevant, have defaults defined, but are
|
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.
|
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
|
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([windows.h], [HAVE_WINDOWS_H=1])
|
||||||
AC_CHECK_HEADERS([sys/wait.h], [HAVE_SYS_WAIT_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
|
# Conditional compilation
|
||||||
AM_CONDITIONAL(WITH_PCRE2_8, test "x$enable_pcre2_8" = "xyes")
|
AM_CONDITIONAL(WITH_PCRE2_8, test "x$enable_pcre2_8" = "xyes")
|
||||||
AM_CONDITIONAL(WITH_PCRE2_16, test "x$enable_pcre2_16" = "xyes")
|
AM_CONDITIONAL(WITH_PCRE2_16, test "x$enable_pcre2_16" = "xyes")
|
||||||
|
|
|
@ -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
|
but if you do, default values will be taken from config.h for non-boolean
|
||||||
macros that are not defined on the command line.
|
macros that are not defined on the command line.
|
||||||
|
|
||||||
Boolean macros such as HAVE_STDLIB_H and SUPPORT_PCRE2_8 should either be defined
|
Boolean macros such as HAVE_STDLIB_H and SUPPORT_PCRE2_8 should either be
|
||||||
(conventionally to 1) for TRUE, and not defined at all for FALSE. All such
|
defined (conventionally to 1) for TRUE, and not defined at all for FALSE. All
|
||||||
macros are listed as a commented #undef in config.h.generic. Macros such as
|
such macros are listed as a commented #undef in config.h.generic. Macros such
|
||||||
MATCH_LIMIT, whose actual value is relevant, have defaults defined, but are
|
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.
|
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
|
PCRE2 uses memmove() if HAVE_MEMMOVE is defined; otherwise it uses bcopy() if
|
||||||
|
|
|
@ -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
|
but if you do, default values will be taken from config.h for non-boolean
|
||||||
macros that are not defined on the command line.
|
macros that are not defined on the command line.
|
||||||
|
|
||||||
Boolean macros such as HAVE_STDLIB_H and SUPPORT_PCRE2_8 should either be defined
|
Boolean macros such as HAVE_STDLIB_H and SUPPORT_PCRE2_8 should either be
|
||||||
(conventionally to 1) for TRUE, and not defined at all for FALSE. All such
|
defined (conventionally to 1) for TRUE, and not defined at all for FALSE. All
|
||||||
macros are listed as a commented #undef in config.h.generic. Macros such as
|
such macros are listed as a commented #undef in config.h.generic. Macros such
|
||||||
MATCH_LIMIT, whose actual value is relevant, have defaults defined, but are
|
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.
|
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
|
PCRE2 uses memmove() if HAVE_MEMMOVE is defined; otherwise it uses bcopy() if
|
||||||
|
|
16
src/pcre2.h
16
src/pcre2.h
|
@ -46,6 +46,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#define PCRE2_PRERELEASE -RC1
|
#define PCRE2_PRERELEASE -RC1
|
||||||
#define PCRE2_DATE 2018-02-19
|
#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
|
/* 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
|
imported have to be identified as such. When building PCRE2, the appropriate
|
||||||
export setting is defined in pcre2_internal.h, which includes this file. So we
|
export setting is defined in pcre2_internal.h, which includes this file. So we
|
||||||
|
@ -81,12 +87,18 @@ set, we ensure here that it has no effect. */
|
||||||
#define PCRE2_CALL_CONVENTION
|
#define PCRE2_CALL_CONVENTION
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Have to include limits.h, stdlib.h and stdint.h to ensure that size_t and
|
/* Have to include limits.h, stdlib.h and stdint.h (or inttypes.h) to ensure
|
||||||
uint8_t, UCHAR_MAX, etc are defined. */
|
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 <limits.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#if PCRE2_HAVE_STDINT_H
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#elif PCRE2_HAVE_INTTYPES_H
|
||||||
|
#include <inttypes.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Allow for C++ users compiling this directly. */
|
/* Allow for C++ users compiling this directly. */
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#define PCRE2_PRERELEASE -RC1
|
#define PCRE2_PRERELEASE -RC1
|
||||||
#define PCRE2_DATE 2018-02-19
|
#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
|
/* 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
|
imported have to be identified as such. When building PCRE2, the appropriate
|
||||||
export setting is defined in pcre2_internal.h, which includes this file. So we
|
export setting is defined in pcre2_internal.h, which includes this file. So we
|
||||||
|
@ -81,12 +87,18 @@ set, we ensure here that it has no effect. */
|
||||||
#define PCRE2_CALL_CONVENTION
|
#define PCRE2_CALL_CONVENTION
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Have to include limits.h, stdlib.h and stdint.h to ensure that size_t and
|
/* Have to include limits.h, stdlib.h and stdint.h (or inttypes.h) to ensure
|
||||||
uint8_t, UCHAR_MAX, etc are defined. */
|
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 <limits.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#if PCRE2_HAVE_STDINT_H
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#elif PCRE2_HAVE_INTTYPES_H
|
||||||
|
#include <inttypes.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Allow for C++ users compiling this directly. */
|
/* Allow for C++ users compiling this directly. */
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#define PCRE2_PRERELEASE @PCRE2_PRERELEASE@
|
#define PCRE2_PRERELEASE @PCRE2_PRERELEASE@
|
||||||
#define PCRE2_DATE @PCRE2_DATE@
|
#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
|
/* 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
|
imported have to be identified as such. When building PCRE2, the appropriate
|
||||||
export setting is defined in pcre2_internal.h, which includes this file. So we
|
export setting is defined in pcre2_internal.h, which includes this file. So we
|
||||||
|
@ -81,12 +87,18 @@ set, we ensure here that it has no effect. */
|
||||||
#define PCRE2_CALL_CONVENTION
|
#define PCRE2_CALL_CONVENTION
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Have to include limits.h, stdlib.h and stdint.h to ensure that size_t and
|
/* Have to include limits.h, stdlib.h and stdint.h (or inttypes.h) to ensure
|
||||||
uint8_t, UCHAR_MAX, etc are defined. */
|
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 <limits.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#if PCRE2_HAVE_STDINT_H
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#elif PCRE2_HAVE_INTTYPES_H
|
||||||
|
#include <inttypes.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Allow for C++ users compiling this directly. */
|
/* Allow for C++ users compiling this directly. */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue