From 3d96858a5d972ece808c8bb79a8add51f6235603 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Wed, 16 Jan 2019 08:14:49 +0100 Subject: [PATCH] fix FreeBSD builds --- CMakeLists.txt | 1 + src/include/xbt/parmap.hpp | 4 ++++ src/internal_config.h.in | 4 +++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e610062a4..be9a19019d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -286,6 +286,7 @@ endif() # Checks for header libraries functions. CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_POSIX_GETTIME) CHECK_LIBRARY_EXISTS(pthread pthread_setaffinity_np "" HAVE_PTHREAD_SETAFFINITY) +CHECK_INCLUDE_FILE("pthread_np" HAVE_PTHREAD_NP_H) # for pthread_setaffinity_np() on FreeBSD if(CMAKE_SYSTEM_NAME MATCHES "Darwin") set(CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700 -D_DARWIN_C_SOURCE") diff --git a/src/include/xbt/parmap.hpp b/src/include/xbt/parmap.hpp index e28e78af61..f2360eb4d3 100644 --- a/src/include/xbt/parmap.hpp +++ b/src/include/xbt/parmap.hpp @@ -22,6 +22,10 @@ #include #endif +#if HAVE_PTHREAD_NP_H +#include +#endif + XBT_LOG_EXTERNAL_CATEGORY(xbt_parmap); namespace simgrid { diff --git a/src/internal_config.h.in b/src/internal_config.h.in index c32f594fb8..854107028c 100644 --- a/src/internal_config.h.in +++ b/src/internal_config.h.in @@ -41,8 +41,10 @@ #cmakedefine01 HAVE_UCONTEXT_CONTEXTS /* Variables for the thread contexts (and parallel mode of raw contexts) */ -/* Does not seems defined on Mac nor Windows */ +/* pthread_setaffinity_np() is Linux and FreeBSD but not on Mac nor Windows */ #cmakedefine01 HAVE_PTHREAD_SETAFFINITY +/* pthread_setaffinity_np() defined in pthread_np.h on FreeBSD but not Linux */ +#cmakedefine01 HAVE_PTHREAD_NP_H /* Variables for the raw contexts (to select the right assembly code) */ #cmakedefine01 SIMGRID_PROCESSOR_i686 -- 2.20.1