diff --git a/CMakeLists.txt b/CMakeLists.txt index da6854034..36c72ab8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,7 +68,6 @@ if(WITH_CLANG_FORMAT) endif() include(CompilerFlags) -include(DetectBSD) include(CheckIncludeFiles) include(CheckLibraryExists) include(CheckSymbolExists) @@ -779,18 +778,6 @@ endif() add_subdirectory(libfreerdp) -if(BSD) - if(IS_DIRECTORY /usr/local/include) - include_directories(/usr/local/include) - link_directories(/usr/local/lib) - endif() - if(OPENBSD) - if(IS_DIRECTORY /usr/X11R6/include) - include_directories(/usr/X11R6/include) - endif() - endif() -endif() - if(WITH_CHANNELS) add_subdirectory(channels) endif() diff --git a/cmake/DetectBSD.cmake b/cmake/DetectBSD.cmake deleted file mode 100644 index 5c5b3b0ee..000000000 --- a/cmake/DetectBSD.cmake +++ /dev/null @@ -1,18 +0,0 @@ -# BSD -if(${CMAKE_SYSTEM_NAME} MATCHES "BSD") - set(BSD TRUE CACHE INTERNAL "BSD detection") - if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") - set(FREEBSD TRUE CACHE INTERNAL "BSD detection") - endif() - if(${CMAKE_SYSTEM_NAME} MATCHES "kFreeBSD") - set(KFREEBSD TRUE CACHE INTERNAL "BSD detection") - endif() - if(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") - set(OPENBSD TRUE CACHE INTERNAL "BSD detection") - endif() -endif() - -if(${CMAKE_SYSTEM_NAME} MATCHES "DragonFly") - set(BSD TRUE CACHE INTERNAL "BSD detection") - set(FREEBSD TRUE CACHE INTERNAL "BSD detection") -endif() diff --git a/cmake/PlatformDefaults.cmake b/cmake/PlatformDefaults.cmake index a621124b8..1182d3cfd 100644 --- a/cmake/PlatformDefaults.cmake +++ b/cmake/PlatformDefaults.cmake @@ -3,7 +3,7 @@ # # Compilation will fail without a replacement defining the symbols, but that can be # done by supplying a TOOLCHAIN_FILE defining these. -option(USE_PLATFORM_DEFAULT "Use this configuration file for platform defaults. Supply -DCMAKE_TOOLCHAIN_FILE= otherwise." ON) +option(USE_PLATFORM_DEFAULT "Use this configuration file for platform defaults. Supply -DCMAKE_TOOLCHAIN_FILE=." ON) if (USE_PLATFORM_DEFAULT) # default defines or other required preferences per platform if((CMAKE_SYSTEM_NAME MATCHES "WindowsStore") AND (CMAKE_SYSTEM_VERSION MATCHES "10.0")) @@ -19,6 +19,8 @@ if (USE_PLATFORM_DEFAULT) endif() if("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD") + set(BSD TRUE CACHE INTERNAL "platform default") + set(FREEBSD TRUE CACHE INTERNAL "platform default") # we want POSIX 2008. FreeBSD 14 does only support 2001 fully, but the subset we require from 2008 # is implemented, so ignore _POSIX_VERSION from unistd.h add_definitions("-D_POSIX_C_SOURCE=200809L") @@ -51,6 +53,35 @@ if (USE_PLATFORM_DEFAULT) add_definitions("-D_DARWIN_C_SOURCE") endif() + if(${CMAKE_SYSTEM_NAME} MATCHES "kFreeBSD") + set(BSD TRUE CACHE INTERNAL "platform default") + set(KFREEBSD TRUE CACHE INTERNAL "platform default") + add_definitions(-DKFREEBSD) + add_definitions("-D_GNU_SOURCE") + endif() + + if(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") + set(BSD TRUE CACHE INTERNAL "platform default") + set(OPENBSD TRUE CACHE INTERNAL "platform default") + endif() + + if(${CMAKE_SYSTEM_NAME} MATCHES "DragonFly") + set(BSD TRUE CACHE INTERNAL "platform default") + set(FREEBSD TRUE CACHE INTERNAL "platform default") + + # we want POSIX 2008. FreeBSD 14 does only support 2001 fully, but the subset we require from 2008 + # is implemented, so ignore _POSIX_VERSION from unistd.h + add_definitions("-D_POSIX_C_SOURCE=200809L") + # TODO: FreeBSD allows mixing POSIX and BSD API calls if we do not set + # _POSIX_C_SOURCE but lack a macro to reenable the BSD calls... + add_definitions("-D__BSD_VISIBLE") + + # There are some symbols only visible for XOpen standard + add_definitions("-D_XOPEN_SOURCE=700") + add_definitions("-D_FILE_OFFSET_BITS=64") + set(WINPR_TIMEZONE_FILE "/var/db/zoneinfo") + endif() + # define a fallback for systems that do not support a timezone file or we did not yet test. # since most of these are BSD try a sensible default if (NOT WINPR_TIMEZONE_FILE) diff --git a/winpr/libwinpr/file/file.c b/winpr/libwinpr/file/file.c index 831f8ae6d..648455dcb 100644 --- a/winpr/libwinpr/file/file.c +++ b/winpr/libwinpr/file/file.c @@ -23,11 +23,6 @@ #include #include -#if defined(__FreeBSD_kernel__) && defined(__GLIBC__) -#define _GNU_SOURCE -#define KFREEBSD -#endif - #include #include #include