summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-08-15 06:54:32 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-08-15 06:54:32 +0200
commitd6b829effe803c60b14e00cab4d9d6f801dcaae2 (patch)
tree376c80b976613c48816a2f29fa6626cc6f5c846f
parentd6085504ce305c9cd9e4ac3d2f408dbb9eac8aab (diff)
downloadfastd-d6b829effe803c60b14e00cab4d9d6f801dcaae2.tar
fastd-d6b829effe803c60b14e00cab4d9d6f801dcaae2.zip
Don't require NaCl when it is not used
-rw-r--r--CMakeLists.txt129
1 files changed, 68 insertions, 61 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b260f77..606ce93 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,19 +4,6 @@ project(FASTD C)
set(CMAKE_MODULE_PATH ${FASTD_SOURCE_DIR})
set(FASTD_VERSION "v8+")
-find_package(BISON 2.5 REQUIRED)
-
-set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
-find_package(Threads)
-if(NOT CMAKE_USE_PTHREADS_INIT)
- MESSAGE(FATAL_ERROR "No pthread support found.")
-endif(NOT CMAKE_USE_PTHREADS_INIT)
-
-find_package(PkgConfig REQUIRED)
-pkg_check_modules(UECC REQUIRED libuecc>=3)
-
-find_package(NaCl REQUIRED)
-
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(LINUX TRUE)
@@ -25,46 +12,6 @@ else()
endif()
-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)
-
-
set(USE_BINDTODEVICE ${LINUX})
set(USE_PMTU ${LINUX})
set(USE_PKTINFO ${LINUX})
@@ -77,14 +24,6 @@ set(WITH_CMDLINE_OPERATION TRUE CACHE BOOL "Include support for setting options
set(WITH_CMDLINE_COMMANDS TRUE CACHE BOOL "Include support for setting handler scripts (e.g. --on-up) on the command line")
-if(WITH_CAPABILITIES)
- find_package(CAP REQUIRED)
-else(WITH_CAPABILITIES)
- set(CAP_INCLUDE_DIR "")
- set(CAP_LIBRARY "")
-endif(WITH_CAPABILITIES)
-
-
set(WITH_CRYPTO_AES128CTR_NACL TRUE CACHE BOOL "Include the AES128-CTR implementation from the NaCl library")
set(WITH_CRYPTO_GHASH_BUILTIN TRUE CACHE BOOL "Include the built-in GHASH implementation")
@@ -130,6 +69,74 @@ if(USE_CRYPTO_GHASH AND NOT WITH_CRYPTO_GHASH)
endif(USE_CRYPTO_GHASH AND NOT WITH_CRYPTO_GHASH)
+find_package(BISON 2.5 REQUIRED)
+
+set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
+find_package(Threads)
+if(NOT CMAKE_USE_PTHREADS_INIT)
+ MESSAGE(FATAL_ERROR "No pthread support found.")
+endif(NOT CMAKE_USE_PTHREADS_INIT)
+
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(UECC REQUIRED libuecc>=3)
+
+
+if(WITH_METHOD_XSALSA20_POLY1305 OR WITH_CRYPTO_AES128CTR_NACL)
+ find_package(NaCl REQUIRED)
+else(WITH_METHOD_XSALSA20_POLY1305 OR WITH_CRYPTO_AES128CTR_NACL)
+ set(NACL_INCLUDE_DIR "")
+ set(NACL_LIBRARY "")
+endif(WITH_METHOD_XSALSA20_POLY1305 OR WITH_CRYPTO_AES128CTR_NACL)
+
+
+if(WITH_CAPABILITIES)
+ find_package(CAP REQUIRED)
+else(WITH_CAPABILITIES)
+ set(CAP_INCLUDE_DIR "")
+ set(CAP_LIBRARY "")
+endif(WITH_CAPABILITIES)
+
+
+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)
+
+
configure_file(${FASTD_SOURCE_DIR}/config.h.in ${FASTD_BINARY_DIR}/config.h)
add_subdirectory(src)