blob: 2e8423878a65c7865e6ce37d0175175f7d4842cd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
PROJECT(eurephia C)
cmake_minimum_required(VERSION 2.6)
OPTION(DEBUG "Add more verbose debug information" OFF)
OPTION(SHOW_SECRETS "Show passwords as clear text in logs." OFF)
OPTION(SQLITE3 "Build database driver for SQLite3" OFF)
OPTION(EUREPHIADM "Build command line based admin utility" OFF)
OPTION(PLUGIN "Build the eurephia plugin for OpenVPN" OFF)
SET(OPENVPN_SRC "" CACHE STRING "Path to OpenVPN source code")
SET(PREFIX "/etc/openvpn/eurephia" CACHE STRING "Install prefix for eurephia")
SET(CMAKE_INSTALL_PREFIX ${PREFIX})
IF(SQLITE3)
message(STATUS "Will build database interface for SQLite")
SET(subdirs ${subdirs} database/sqlite)
SET(DATABASE ON)
ENDIF(SQLITE3)
IF(EUREPHIADM)
message(STATUS "Will build command line based admin utility")
SET(subdirs ${subdirs} eurephiadm)
SET(ADMIN_ENABLED on)
ENDIF(EUREPHIADM)
IF(ADMIN_ENABLED)
find_package(PkgConfig)
pkg_search_module(LIBXML2 REQUIRED libxml-2.0 libxml2 libxml>=2.6)
INCLUDE_DIRECTORIES(BEFORE ${LIBXML2_INCLUDE_DIRS})
ADD_DEFINITIONS(-DHAVE_LIBXML2)
SET(EXTRA_LIBS ${LIBXML2_LIBRARIES})
ENDIF(ADMIN_ENABLED)
IF(NOT DATABASE)
message(FATAL_ERROR "Cannot build eurephia without any database drivers.")
ENDIF(NOT DATABASE)
IF(FW_IPTABLES)
SET(FIREWALL on)
ENDIF(FW_IPTABLES)
IF(DEBUG)
message(STATUS "DEBUG enabled - might be a security issue")
ADD_DEFINITIONS(-DENABLE_DEBUG)
IF(SHOW_SECRETS)
message(STATUS "SHOW_SECRETS ENABLED -- THIS WILL LOG PASSWORDS IN CLEAR TEXT")
ADD_DEFINITIONS(-DSHOW_SECRETS)
ENDIF(SHOW_SECRETS)
ENDIF(DEBUG)
IF(PLUGIN)
IF(NOT OPENVPN_SRC)
message(FATAL_ERROR "Missing path to OpenVPN source - try running ./configure again")
ENDIF(NOT OPENVPN_SRC)
message(STATUS "Building eurephia plug-in for OpenVPN")
SET(CHECK_INCL_FILE "${OPENVPN_SRC}/openvpn-plugin.h")
IF(NOT EXISTS ${CHECK_INCL_FILE})
message(FATAL_ERROR "Missing openvpn-plugin.h ... Is the OpenVPN source code really located here? ${OPENVPN_SRC}")
ENDIF(NOT EXISTS ${CHECK_INCL_FILE})
INCLUDE_DIRECTORIES(BEFORE ${OPENVPN_SRC} .)
SET(subdirs ${subdirs} plugin)
ENDIF(PLUGIN)
INCLUDE(CheckIncludeFile)
CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H)
INCLUDE(CheckLibraryExists)
CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_DLOPEN)
CHECK_LIBRARY_EXISTS(dl dlclose "" HAVE_DLCLOSE)
IF(NOT HAVE_DLOPEN OR NOT HAVE_DLCLOSE)
message(FATAL_ERROR "Missing proper dl library")
ENDIF(NOT HAVE_DLOPEN OR NOT HAVE_DLCLOSE)
CHECK_INCLUDE_FILE(openssl/rand.h HAVE_OPENSSL_RAND_H)
CHECK_LIBRARY_EXISTS(crypto RAND_load_file "" HAVE_OPENSSL_RAND_LOAD_FILE)
CHECK_LIBRARY_EXISTS(crypto RAND_pseudo_bytes "" HAVE_OPENSSL_RAND_PSEUDO_BYTES)
IF(NOT HAVE_OPENSSL_RAND_H OR NOT HAVE_OPENSSL_RAND_LOAD_FILE OR NOT HAVE_OPENSSL_RAND_PSEUDO_BYTES)
message(FATAL_ERROR "Missing OpenSSL crypto support")
ENDIF(NOT HAVE_OPENSSL_RAND_H OR NOT HAVE_OPENSSL_RAND_LOAD_FILE OR NOT HAVE_OPENSSL_RAND_PSEUDO_BYTES)
CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H)
CHECK_LIBRARY_EXISTS(pthread pthread_mutex_lock "" HAVE_PTHREAD_MUTEX_LOCK)
CHECK_LIBRARY_EXISTS(pthread pthread_mutex_unlock "" HAVE_PTHREAD_MUTEX_UNLOCK)
IF(NOT HAVE_PTHREAD_MUTEX_LOCK OR NOT HAVE_PTHREAD_MUTEX_UNLOCK)
message(FATAL_ERROR "Missing proper pthread_mutex support")
ENDIF(NOT HAVE_PTHREAD_MUTEX_LOCK OR NOT HAVE_PTHREAD_MUTEX_UNLOCK)
ADD_DEFINITIONS(-g -Wall)
SUBDIRS(${subdirs})
|