summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-08-11 19:21:03 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-08-11 19:21:03 +0200
commitfe344be938fb5d4644553a6886f6455fa337ce72 (patch)
tree6985c997b0af85fd16b13e08bc598d59b07761e7 /CMakeLists.txt
parenta5a567bd18151de76ac62f41c3d54c285deb92b9 (diff)
downloadfastd-fe344be938fb5d4644553a6886f6455fa337ce72.tar
fastd-fe344be938fb5d4644553a6886f6455fa337ce72.zip
Only link with librt when necessary
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt21
1 files changed, 20 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0fa9d72..9a98adb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,10 +28,11 @@ endif()
include(CheckCSourceCompiles)
include(CheckPrototypeDefinition)
+include(CheckSymbolExists)
include(CheckTypeSize)
-set(CMAKE_EXTRA_INCLUDE_FILES "netinet/if_ether.h")
set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE")
+
check_c_source_compiles("
#include <sys/types.h>
#include <sys/socket.h>
@@ -42,11 +43,29 @@ int main() {
}
" HAVE_AI_ADDRCONFIG)
+
check_prototype_definition("get_current_dir_name" "char *get_current_dir_name(void)" "NULL" "unistd.h" HAVE_GET_CURRENT_DIR_NAME)
+
+set(RT_LIBRARY "")
+check_symbol_exists("clock_gettime" "time.h" HAVE_CLOCK_GETTIME)
+
+if(NOT HAVE_CLOCK_GETTIME)
+ set(RT_LIBRARY "rt")
+ list(append CMAKE_REQUIRED_LIBRARIES "rt")
+
+ check_symbol_exists("clock_gettime" "time.h" HAVE_CLOCK_GETTIME)
+ if(NOT HAVE_CLOCK_GETTIME)
+ message(FATAL_ERROR "clock_gettime() not found")
+ endif(NOT HAVE_CLOCK_GETTIME)
+endif(NOT HAVE_CLOCK_GETTIME)
+
+
+set(CMAKE_EXTRA_INCLUDE_FILES "netinet/if_ether.h")
check_type_size("struct ethhdr" SIZEOF_ETHHDR)
string(COMPARE NOTEQUAL "${SIZEOF_ETHHDR}" "" HAVE_ETHHDR)
+
set(USE_BINDTODEVICE ${LINUX})
set(USE_PMTU ${LINUX})
set(USE_PKTINFO ${LINUX})