Include json_inttypes.h in json_object.h since we use types like int32_t in the API and some systems need that header to compile.
As part of this create a public json_config.h with a custom define to decide whether to include inttypes.h to avoid conflicting with other projects config.h header.
This commit is contained in:
@@ -13,6 +13,7 @@ libjsoninclude_HEADERS = \
|
||||
bits.h \
|
||||
debug.h \
|
||||
json.h \
|
||||
json_config.h \
|
||||
json_inttypes.h \
|
||||
json_object.h \
|
||||
json_object_private.h \
|
||||
@@ -21,6 +22,11 @@ libjsoninclude_HEADERS = \
|
||||
linkhash.h \
|
||||
printbuf.h
|
||||
|
||||
#libjsonx_includedir = $(libdir)/json-c-@VERSION@
|
||||
#
|
||||
#libjsonx_include_HEADERS = \
|
||||
# json_config.h
|
||||
|
||||
libjson_la_LDFLAGS = -version-info 1:0:1 -no-undefined
|
||||
|
||||
libjson_la_SOURCES = \
|
||||
|
||||
12
config.h.in
12
config.h.in
@@ -80,6 +80,13 @@
|
||||
/* Define to 1 if you have the `vsyslog' function. */
|
||||
#undef HAVE_VSYSLOG
|
||||
|
||||
/* Public define for json_inttypes.h */
|
||||
#undef JSON_C_HAVE_INTTYPES_H
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
#undef LT_OBJDIR
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
@@ -95,6 +102,9 @@
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
@@ -113,5 +123,5 @@
|
||||
/* Define to rpl_realloc if the replacement function should be used. */
|
||||
#undef realloc
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
||||
|
||||
@@ -11,8 +11,10 @@ AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
|
||||
|
||||
# Checks for header files.
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_CONFIG_HEADER(json_config.h)
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(fcntl.h limits.h strings.h syslog.h unistd.h [sys/param.h] stdarg.h)
|
||||
AC_CHECK_HEADER(inttypes.h,[AC_DEFINE([JSON_C_HAVE_INTTYPES_H],[1],[Public define for json_inttypes.h])])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
|
||||
3
json_config.h.in
Normal file
3
json_config.h.in
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef JSON_C_HAVE_INTTYPES_H
|
||||
@@ -2,6 +2,8 @@
|
||||
#ifndef _json_inttypes_h_
|
||||
#define _json_inttypes_h_
|
||||
|
||||
#include "json_config.h"
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1600
|
||||
|
||||
/* Anything less than Visual Studio C++ 10 is missing stdint.h and inttypes.h */
|
||||
@@ -14,7 +16,7 @@ typedef __int64 int64_t;
|
||||
|
||||
#else
|
||||
|
||||
#ifdef HAVE_INTTYPES_H
|
||||
#ifdef JSON_C_HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
/* inttypes.h includes stdint.h */
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#ifndef _json_object_h_
|
||||
#define _json_object_h_
|
||||
|
||||
#include "json_inttypes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user