From: Michihiro NAKAJIMA Date: Tue, 10 May 2011 14:53:42 +0000 (-0400) Subject: Fix build failure through cmake on linux. X-Git-Tag: v3.0.0a~393 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a0f5fe6e0a12e30132e85346defd7df359e3f459;p=thirdparty%2Flibarchive.git Fix build failure through cmake on linux. It needs some macro such as _GNU_SOURCE to use extension functions. including previous changes of build/cmake/config.h.in. SVN-Revision: 3293 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index f8731b977..96b0ccdb0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -286,6 +286,20 @@ LA_CHECK_INCLUDE_FILE("wctype.h" HAVE_WCTYPE_H) LA_CHECK_INCLUDE_FILE("windows.h" HAVE_WINDOWS_H) LA_CHECK_INCLUDE_FILE("winioctl.h" HAVE_WINIOCTL_H) +# +# Check whether use of __EXTENSIONS__ is safe. +# We need some macro such as _GNU_SOURCE to use extension functions. +# +SET(_INCLUDE_FILES) +FOREACH (it ${_HEADER}) + SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n") +ENDFOREACH (it) + +CHECK_C_SOURCE_COMPILES( + "#define __EXTENSIONS__ 1 + ${_INCLUDE_FILES} + int main() { return 0;}" + SAFE_TO_DEFINE_EXTENSIONS) # # Find OpenSSL diff --git a/build/cmake/config.h.in b/build/cmake/config.h.in index f9055247d..c1a1a6258 100644 --- a/build/cmake/config.h.in +++ b/build/cmake/config.h.in @@ -982,6 +982,9 @@ typedef uint64_t uintmax_t; /* Define to 1 if you can safely include both and . */ #cmakedefine TIME_WITH_SYS_TIME 1 +/* + * Some platform requires a macro to use extension functions. + */ #cmakedefine SAFE_TO_DEFINE_EXTENSIONS 1 #ifdef SAFE_TO_DEFINE_EXTENSIONS /* Enable extensions on AIX 3, Interix. */