maybe fix iopCreateCl race
[hiphop-php.git] / CMake / FollySetup.cmake
blob66a08db23c536dad4e8288677f2039ca79534369
1 # folly-config.h is a generated file from autotools
2 # We need to do the equivalent checks here and use
3 # add_definitions as needed
4 add_definitions(-DFOLLY_NO_CONFIG=1)
6 INCLUDE(CheckCXXSourceCompiles)
7 CHECK_CXX_SOURCE_COMPILES("
8 extern \"C\" void (*test_ifunc(void))() { return 0; }
9 void func() __attribute__((ifunc(\"test_ifunc\")));
10 " FOLLY_IFUNC)
11 if (FOLLY_IFUNC)
12         add_definitions("-DHAVE_IFUNC=1")
13 endif()
15 set(CMAKE_REQUIRED_LIBRARIES rt)
16 CHECK_CXX_SOURCE_COMPILES("#include <time.h>
17 int main() {
18   clock_gettime((clockid_t)0, NULL);
19   return 0;
20 }" HAVE_CLOCK_GETTIME)
22 if (HAVE_CLOCK_GETTIME)
23         add_definitions("-DFOLLY_HAVE_CLOCK_GETTIME=1")
24 endif()
25 set(CMAKE_REQUIRED_LIBRARIES)
27 find_path(FEATURES_H_INCLUDE_DIR NAMES features.h)
28 if (FEATURES_H_INCLUDE_DIR)
29         include_directories("${FEATURES_H_INCLUDE_DIR}")
30         add_definitions("-DFOLLY_HAVE_FEATURES_H=1")
31 endif()