From 0e38a3706039607fb276228648f726ca9e15f6f0 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Wed, 31 Dec 2014 16:24:14 +0100 Subject: Feature test for va_copy MSVC doesn't support va_copy. --- src/CMakeLists.txt | 2 ++ src/buffer.c | 1 + src/config.h.in | 6 ++++++ 3 files changed, 9 insertions(+) (limited to 'src') 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 #include +#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 -- cgit v1.2.3