summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2014-11-15 19:54:01 +0100
committerNick Wellnhofer <wellnhofer@aevum.de>2014-11-16 21:31:56 +0100
commit76b7e4241c840480beaef5ac6b711301f066251e (patch)
tree04df5b2c9c0281db3c96ae44945e807d42d66bec /src
parent4dcdc715910b61a2b58f1ea8ae5f86d041e3c229 (diff)
Probe for stdbool.h
Let cmake create a cmark_config.h file to deal with platforms missing stdbool.h.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/ast.h2
-rw-r--r--src/blocks.c2
-rw-r--r--src/buffer.h2
-rw-r--r--src/cmark.c1
-rw-r--r--src/config.h.in8
-rw-r--r--src/html/html.c2
-rw-r--r--src/inlines.c2
-rw-r--r--src/main.c2
9 files changed, 18 insertions, 7 deletions
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 <stdbool.h>
#include <stdio.h>
+#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 <stdlib.h>
#include <assert.h>
#include <stdio.h>
-#include <stdbool.h>
#include <ctype.h>
+#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 <stdbool.h>
#include <stddef.h>
#include <stdarg.h>
+#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 <stdlib.h>
#include <assert.h>
#include <stdio.h>
-#include <stdbool.h>
#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 <stdbool.h>
+#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 <stdlib.h>
#include <stdio.h>
-#include <stdbool.h>
#include <string.h>
#include <assert.h>
+#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 <stdlib.h>
#include <string.h>
#include <stdio.h>
-#include <stdbool.h>
#include <ctype.h>
+#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 <stdio.h>
#include <string.h>
#include <errno.h>
-#include <stdbool.h>
+#include "config.h"
#include "cmark.h"
#include "debug.h"
#include "bench.h"