diff --git a/CMakeLists.txt b/CMakeLists.txt index 033a953..384ab38 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,8 @@ find_package(Sqlite3) include(TestBigEndian) include(CheckSymbolExists) +include(CheckIncludeFile) +include(CheckTypeSize) #Some functions need this to be found add_definitions(-D_GNU_SOURCE) @@ -62,6 +64,11 @@ if (MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS) endif() +check_include_file(sys/types.h HAVE_SYS_TYPES_H) +if (HAVE_SYS_TYPES_H) +set (CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} "sys/types.h") +endif() +check_type_size( ssize_t SSIZE_T ) check_symbol_exists(memmem string.h HAVE_MEMMEM) check_symbol_exists(strndup string.h HAVE_STRNDUP) diff --git a/src/system.h.in b/src/system.h.in index a946d3a..8264e2d 100644 --- a/src/system.h.in +++ b/src/system.h.in @@ -34,7 +34,6 @@ #endif #if defined(__CYGWIN__) || defined(__MINGW32__) -#define HAVE_SSIZE_T #define NEED_GETOPT #endif @@ -69,6 +68,10 @@ #include #include +#cmakedefine HAVE_SYS_TYPES_H +#ifdef HAVE_SYS_TYPES_H +#include +#endif #if !defined(WIN32) #include #include @@ -77,10 +80,10 @@ #include #define HAVE_DLOPEN #define HAVE_GETOPT -#define HAVE_SSIZE_T #include #define HAVE_GETRLIMIT #endif +#cmakedefine HAVE_SSIZE_T #cmakedefine HAVE_STRNDUP #cmakedefine HAVE_MEMMEM