summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt21
-rw-r--r--src/CMakeLists.txt2
2 files changed, 21 insertions, 2 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})
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index aed5b24..10e5656 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -39,7 +39,7 @@ add_executable(fastd
${METHODS}
)
set_target_properties(fastd PROPERTIES COMPILE_FLAGS -pthread ${UECC_CFLAGS_OTHER} COMPILE_DEFINITIONS _GNU_SOURCE LINK_FLAGS -pthread ${UECC_LDFLAGS_OTHER})
-target_link_libraries(fastd rt ${CAP_LIBRARY} ${UECC_LIBRARIES} ${NACL_LIBRARY})
+target_link_libraries(fastd ${RT_LIBRARY} ${CAP_LIBRARY} ${UECC_LIBRARIES} ${NACL_LIBRARY})
add_custom_target(
version