From 76b7e4241c840480beaef5ac6b711301f066251e Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Sat, 15 Nov 2014 19:54:01 +0100 Subject: Probe for stdbool.h Let cmake create a cmark_config.h file to deal with platforms missing stdbool.h. --- src/CMakeLists.txt | 4 ++++ src/ast.h | 2 +- src/blocks.c | 2 +- src/buffer.h | 2 +- src/cmark.c | 1 - src/config.h.in | 8 ++++++++ src/html/html.c | 2 +- src/inlines.c | 2 +- src/main.c | 2 +- 9 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 src/config.h.in (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9bae3b5..4378ba6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -96,6 +96,10 @@ install(FILES cmark.h ${CMAKE_CURRENT_BINARY_DIR}/cmark_export.h include (CheckIncludeFile) CHECK_INCLUDE_FILE (stdbool.h HAVE_STDBOOL_H) +CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in + ${CMAKE_CURRENT_BINARY_DIR}/config.h) + # Always compile with warnings if(MSVC) # Force to always compile with W4 diff --git a/src/ast.h b/src/ast.h index 6c77c68..dc8df41 100644 --- a/src/ast.h +++ b/src/ast.h @@ -1,8 +1,8 @@ #ifndef CMARK_AST_H #define CMARK_AST_H -#include #include +#include "config.h" #include "buffer.h" #include "chunk.h" diff --git a/src/blocks.c b/src/blocks.c index c0c2342..f95e94e 100644 --- a/src/blocks.c +++ b/src/blocks.c @@ -1,9 +1,9 @@ #include #include #include -#include #include +#include "config.h" #include "ast.h" #include "cmark.h" #include "references.h" diff --git a/src/buffer.h b/src/buffer.h index 1627813..fa1639e 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -1,9 +1,9 @@ #ifndef CMARK_BUFFER_H #define CMARK_BUFFER_H -#include #include #include +#include "config.h" #include "cmark_export.h" typedef struct { diff --git a/src/cmark.c b/src/cmark.c index 14901af..f793499 100644 --- a/src/cmark.c +++ b/src/cmark.c @@ -1,7 +1,6 @@ #include #include #include -#include #include "references.h" #include "html/houdini.h" #include "cmark.h" diff --git a/src/config.h.in b/src/config.h.in new file mode 100644 index 0000000..2165d03 --- /dev/null +++ b/src/config.h.in @@ -0,0 +1,8 @@ +#cmakedefine HAVE_STDBOOL_H + +#ifdef HAVE_STDBOOL_H + #include +#elif !defined(__cplusplus) + typedef char bool; +#endif + diff --git a/src/html/html.c b/src/html/html.c index faa570b..a0be6f2 100644 --- a/src/html/html.c +++ b/src/html/html.c @@ -1,9 +1,9 @@ #include #include -#include #include #include +#include "config.h" #include "cmark.h" #include "buffer.h" #include "ast.h" diff --git a/src/inlines.c b/src/inlines.c index 76a70bc..e3d71f7 100644 --- a/src/inlines.c +++ b/src/inlines.c @@ -1,9 +1,9 @@ #include #include #include -#include #include +#include "config.h" #include "ast.h" #include "references.h" #include "cmark.h" diff --git a/src/main.c b/src/main.c index 7818f00..9b98718 100644 --- a/src/main.c +++ b/src/main.c @@ -2,7 +2,7 @@ #include #include #include -#include +#include "config.h" #include "cmark.h" #include "debug.h" #include "bench.h" -- cgit v1.2.3