diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 21 |
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}) |