CMake check_include and struct cleanup

Move to WinPR what should be there.
This commit is contained in:
akallabeth 2022-04-29 10:36:37 +02:00 committed by akallabeth
parent 5e259d13b1
commit 860f44f762
7 changed files with 53 additions and 87 deletions

View File

@ -463,22 +463,6 @@ endif()
add_definitions(-DFREERDP_EXPORTS)
# Include files
if(NOT IOS)
check_include_files(unistd.h HAVE_UNISTD_H)
check_include_files(execinfo.h HAVE_EXECINFO_H)
check_include_files(inttypes.h HAVE_INTTYPES_H)
else()
set(HAVE_UNISTD_H 1)
set(HAVE_INTTYPES_H 1)
endif()
if(NOT IOS)
check_struct_has_member("struct tm" tm_gmtoff time.h HAVE_TM_GMTOFF)
else()
set(HAVE_TM_GMTOFF 1)
endif()
# Mac OS X
if(APPLE)
if(IOS)
@ -567,19 +551,6 @@ else()
endif()
if(UNIX OR CYGWIN)
if (FREEBSD)
list(APPEND CMAKE_REQUIRED_INCLUDES ${EPOLLSHIM_INCLUDE_DIR})
endif()
if (FREEBSD)
list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES ${EPOLLSHIM_INCLUDE_DIR})
endif()
option(WITH_POLL "Check for and include poll.h" ON)
if (WITH_POLL)
check_include_files(poll.h HAVE_POLL_H)
endif()
list(APPEND CMAKE_REQUIRED_LIBRARIES m)
check_symbol_exists(ceill math.h HAVE_MATH_C99_LONG_DOUBLE)
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES m)
set(X11_FEATURE_TYPE "RECOMMENDED")
set(WAYLAND_FEATURE_TYPE "RECOMMENDED")
else()

View File

@ -47,10 +47,6 @@
#include "tsmf_decoder.h"
#include "tsmf_platform.h"
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
/* 1 second = 10,000,000 100ns units*/
#define SEEK_TOLERANCE 10 * 1000 * 1000

View File

@ -4,18 +4,9 @@
#include <winpr/config.h>
/* Include files */
#if defined(__APPLE__) && !defined(__IOS__)
#cmakedefine01 HAVE_UNISTD_H
#else
#cmakedefine HAVE_UNISTD_H
#endif
#cmakedefine HAVE_INTTYPES_H
#cmakedefine HAVE_TM_GMTOFF
#cmakedefine HAVE_POLL_H
#cmakedefine HAVE_SYSLOG_H
#cmakedefine HAVE_JOURNALD_H
#cmakedefine HAVE_VALGRIND_MEMCHECK_H
#cmakedefine HAVE_EXECINFO_H
#cmakedefine HAVE_STRNDUP
/* Features */
@ -33,7 +24,6 @@
#cmakedefine WITH_JPEG
#cmakedefine WITH_WIN8
#cmakedefine WITH_RDPSND_DSOUND
#cmakedefine HAVE_MATH_C99_LONG_DOUBLE
#cmakedefine WITH_WINMM
#cmakedefine WITH_MACAUDIO

View File

@ -75,12 +75,12 @@ include (SetFreeRDPCMakeInstallDir)
add_definitions(-DRDTK_EXPORTS)
if (NOT IOS)
check_include_files(stdbool.h WINPR_HAVE_STDBOOL_H)
if (NOT WINPR_HAVE_STDBOOL_H)
check_include_files(stdbool.h HAVE_STDBOOL_H)
if (NOT HAVE_STDBOOL_H)
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../compat/stdbool)
endif()
else()
set(WINPR_HAVE_STDBOOL_H 1)
set(HAVE_STDBOOL_H 1)
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)

View File

@ -28,13 +28,13 @@ if (NOT FREERDP_UNIFIED_BUILD)
# Default to build shared libs
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
option(EXPORT_ALL_SYMBOLS "Export all symbols form library" OFF)
if(CMAKE_COMPILER_IS_GNUCC)
if(NOT EXPORT_ALL_SYMBOLS)
message(STATUS "GCC default symbol visibility: hidden")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
endif()
endif()
option(EXPORT_ALL_SYMBOLS "Export all symbols form library" OFF)
if(CMAKE_COMPILER_IS_GNUCC)
if(NOT EXPORT_ALL_SYMBOLS)
message(STATUS "GCC default symbol visibility: hidden")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
endif()
endif()
endif()
set(DEFAULT_DEBUG_OPTION OFF)
@ -78,12 +78,12 @@ endif()
option(WITH_DEBUG_NTLM "Print NTLM debug messages" ${DEFAULT_DEBUG_OPTION})
if(WITH_DEBUG_NTLM)
message(WARNING "WITH_DEBUG_NTLM=ON, the build might leak sensitive information, do not use with release builds!")
message(WARNING "WITH_DEBUG_NTLM=ON, the build might leak sensitive information, do not use with release builds!")
endif()
option(WITH_DEBUG_NLA "Print authentication related debug messages." ${DEFAULT_DEBUG_OPTION})
if(WITH_DEBUG_NLA)
message(WARNING "WITH_DEBUG_NLA=ON, the build might leak sensitive information, do not use with release builds!")
message(WARNING "WITH_DEBUG_NLA=ON, the build might leak sensitive information, do not use with release builds!")
endif()
if (WITH_WINPR_DEPRECATED)
@ -91,7 +91,7 @@ if (WITH_WINPR_DEPRECATED)
endif()
if (WITH_VERBOSE_WINPR_ASSERT)
add_definitions(-DWITH_VERBOSE_WINPR_ASSERT)
add_definitions(-DWITH_VERBOSE_WINPR_ASSERT)
endif()
@ -118,7 +118,7 @@ include(SetFreeRDPCMakeInstallDir)
include(CMakePackageConfigHelpers)
if (NOT WIN32)
add_definitions(-DWINPR_CRITICAL_SECTION_DISABLE_SPINCOUNT)
add_definitions(-DWINPR_CRITICAL_SECTION_DISABLE_SPINCOUNT)
endif()
# Soname versioning
@ -148,20 +148,23 @@ else()
endif()
if(NOT IOS)
check_include_files(stdint.h WINPR_HAVE_STDINT_H)
check_include_files(inttypes.h WINPR_HAVE_INTTYPES_H)
check_include_files(unistd.h HAVE_UNISTD_H)
check_include_files(execinfo.h HAVE_EXECINFO_H)
check_include_files(inttypes.h HAVE_INTTYPES_H)
check_include_files(stdint.h HAVE_STDINT_H)
check_include_files(inttypes.h HAVE_INTTYPES_H)
else(NOT IOS)
set(WINPR_HAVE_STDINT_H 1)
set(WINPR_HAVE_INTTYPES_H 1)
set(HAVE_STDINT_H 1)
set(HAVE_INTTYPES_H 1)
endif(NOT IOS)
if (NOT IOS)
check_include_files(stdbool.h WINPR_HAVE_STDBOOL_H)
if (NOT WINPR_HAVE_STDBOOL_H)
check_include_files(stdbool.h HAVE_STDBOOL_H)
if (NOT HAVE_STDBOOL_H)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../compat/stdbool)
endif()
else()
set(WINPR_HAVE_STDBOOL_H 1)
set(HAVE_STDBOOL_H 1)
endif()
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
@ -189,17 +192,26 @@ if(NOT IOS)
include(CheckFunctionExists)
check_function_exists(getlogin_r HAVE_GETLOGIN_R)
check_function_exists(getpwuid_r HAVE_GETPWUID_R)
check_struct_has_member("struct tm" tm_gmtoff time.h HAVE_TM_GMTOFF)
else()
set(HAVE_FCNTL_H 1)
set(HAVE_UNISTD_H 1)
set(HAVE_INTTYPES_H 1)
set(HAVE_SYS_FILIO_H 1)
set(HAVE_TM_GMTOFF 1)
endif()
if(NOT IOS)
check_struct_has_member("struct tm" tm_gmtoff time.h HAVE_TM_GMTOFF)
else()
set(HAVE_TM_GMTOFF 1)
if(UNIX OR CYGWIN)
if (FREEBSD)
list(APPEND CMAKE_REQUIRED_INCLUDES ${EPOLLSHIM_INCLUDE_DIR})
endif()
if (FREEBSD)
list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES ${EPOLLSHIM_INCLUDE_DIR})
endif()
option(WITH_POLL "Check for and include poll.h" ON)
if (WITH_POLL)
check_include_files(poll.h HAVE_POLL_H)
endif()
endif()
if(NOT WIN32 AND NOT IOS)
@ -239,9 +251,9 @@ set(OPENSSL_FEATURE_TYPE "RECOMMENDED")
add_definitions("-DWITH_MBEDTLS")
endif()
if (NOT OPENSSL_FOUND AND NOT MBEDTLS_FOUND)
message(FATAL_ERROR "OpenSSL or MBedTLS are required, none enabled/found")
endif()
if (NOT OPENSSL_FOUND AND NOT MBEDTLS_FOUND)
message(FATAL_ERROR "OpenSSL or MBedTLS are required, none enabled/found")
endif()
enable_testing()

View File

@ -3,12 +3,9 @@
/* Include files */
#cmakedefine HAVE_FCNTL_H
#if defined(__APPLE__) && !defined(__IOS__)
#cmakedefine01 HAVE_UNISTD_H
#else
#cmakedefine HAVE_UNISTD_H
#endif
#cmakedefine HAVE_INTTYPES_H
#cmakedefine HAVE_STDBOOL_H
#cmakedefine HAVE_AIO_H
#cmakedefine HAVE_SYS_FILIO_H
#cmakedefine HAVE_SYS_SELECT_H

View File

@ -21,12 +21,12 @@
#define WINPR_WTYPES_H
/* Set by CMake during configuration */
#cmakedefine WINPR_HAVE_STDINT_H
#cmakedefine WINPR_HAVE_STDBOOL_H
#cmakedefine HAVE_STDINT_H
#cmakedefine HAVE_STDBOOL_H
#if !defined(_MSC_VER) || _MSC_VER >= 1900
/* Microsoft's inttypes.h is broken before MSVC 2015 */
#cmakedefine WINPR_HAVE_INTTYPES_H
#cmakedefine HAVE_INTTYPES_H
#endif
/* MSDN: Windows Data Types - http://msdn.microsoft.com/en-us/library/aa383751/ */
@ -37,15 +37,15 @@
#include <winpr/spec.h>
#ifdef WINPR_HAVE_STDBOOL_H
#ifdef HAVE_STDBOOL_H
#include <stdbool.h>
#endif
#ifdef WINPR_HAVE_STDINT_H
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef WINPR_HAVE_INTTYPES_H
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
@ -96,7 +96,7 @@ typedef LONG_PTR SSIZE_T;
#define NEAR
#endif
#ifdef WINPR_HAVE_STDINT_H
#ifdef HAVE_STDINT_H
typedef int8_t __int8;
typedef uint8_t __uint8;
typedef int16_t __int16;
@ -138,9 +138,9 @@ typedef unsigned long long __uint64;
#else
#error "64-bit type not configured"
#endif
#endif /* WINPR_HAVE_STDINT_H */
#endif /* HAVE_STDINT_H */
#ifdef WINPR_HAVE_STDINT_H
#ifdef HAVE_STDINT_H
#if defined(__ILP64__) || defined(__LP64__)
#define __int3264 int64_t
#define __uint3264 uint64_t
@ -156,7 +156,7 @@ typedef unsigned long long __uint64;
#define __int3264 __int32
#define __uint3264 __uint32
#endif
#endif /* WINPR_HAVE_STDINT_H */
#endif /* HAVE_STDINT_H */
typedef void* PVOID, *LPVOID, *PVOID64, *LPVOID64;
@ -486,7 +486,7 @@ typedef const BYTE* LPCBYTE;
#endif
/* integer format specifiers */
#ifndef WINPR_HAVE_INTTYPES_H
#ifndef HAVE_INTTYPES_H
#define PRId8 "hhd"
#define PRIi8 "hhi"
#define PRIu8 "hhu"
@ -535,7 +535,7 @@ typedef const BYTE* LPCBYTE;
#define PRIX64 "llX"
#endif
#endif /* _MSC_VER */
#endif /* WINPR_HAVE_INTTYPES_H not defined*/
#endif /* HAVE_INTTYPES_H not defined*/
#ifndef SSIZE_MAX
#if defined(_POSIX_SSIZE_MAX)