summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2014-12-31 16:24:14 +0100
committerNick Wellnhofer <wellnhofer@aevum.de>2014-12-31 16:27:33 +0100
commit0e38a3706039607fb276228648f726ca9e15f6f0 (patch)
tree4a930159ce6552c56e9ad27484f97cf8f78dd859
parentd605ead4bc5dc96022a3f13bdbf05d2b63da3fd4 (diff)
Feature test for va_copy
MSVC doesn't support va_copy.
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/buffer.c1
-rw-r--r--src/config.h.in6
3 files changed, 9 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 87651bc..bb0c7c1 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -117,6 +117,7 @@ install(FILES cmark.h ${CMAKE_CURRENT_BINARY_DIR}/cmark_export.h
# Feature tests
include(CheckIncludeFile)
include(CheckCSourceCompiles)
+include(CheckSymbolExists)
CHECK_INCLUDE_FILE(stdbool.h HAVE_STDBOOL_H)
CHECK_C_SOURCE_COMPILES(
"int main() { __builtin_expect(0,0); return 0; }"
@@ -125,6 +126,7 @@ CHECK_C_SOURCE_COMPILES("
int f(void) __attribute__ (());
int main() { return 0; }
" HAVE___ATTRIBUTE__)
+CHECK_SYMBOL_EXISTS(va_copy stdarg.h HAVE_VA_COPY)
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
diff --git a/src/buffer.c b/src/buffer.c
index 15a6d05..87d817b 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5,6 +5,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include "config.h"
#include "cmark_ctype.h"
#include "buffer.h"
diff --git a/src/config.h.in b/src/config.h.in
index 5294bc9..c1e9597 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -15,3 +15,9 @@
#else
#define CMARK_ATTRIBUTE(list)
#endif
+
+#cmakedefine HAVE_VA_COPY
+
+#ifndef HAVE_VA_COPY
+ #define va_copy(dest, src) ((dest) = (src))
+#endif