summaryrefslogtreecommitdiffstats
path: root/cmake/checks.cmake
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-11-02 17:42:30 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-11-02 17:47:20 +0100
commit38b7d50694b4a9929cc0d5bca884a52d5aeaa8a4 (patch)
tree8d5c690296423b9261a864c1b8cfde06b85d9d9a /cmake/checks.cmake
parentcd47acaf3cc874f8d26acca56fa6cef6110d946d (diff)
downloadfastd-38b7d50694b4a9929cc0d5bca884a52d5aeaa8a4.tar
fastd-38b7d50694b4a9929cc0d5bca884a52d5aeaa8a4.zip
Separate cmake files
Diffstat (limited to 'cmake/checks.cmake')
-rw-r--r--cmake/checks.cmake38
1 files changed, 38 insertions, 0 deletions
diff --git a/cmake/checks.cmake b/cmake/checks.cmake
new file mode 100644
index 0000000..cd80856
--- /dev/null
+++ b/cmake/checks.cmake
@@ -0,0 +1,38 @@
+include(CheckCSourceCompiles)
+include(CheckPrototypeDefinition)
+include(CheckSymbolExists)
+include(CheckTypeSize)
+set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE")
+
+
+check_c_source_compiles("
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+
+int main() {
+ return AI_ADDRCONFIG;
+}
+" 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_RT)
+ if(NOT HAVE_CLOCK_GETTIME_RT)
+ message(FATAL_ERROR "clock_gettime() not found")
+ endif(NOT HAVE_CLOCK_GETTIME_RT)
+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)