164 lines
5.5 KiB
CMake
164 lines
5.5 KiB
CMake
# include here the requirements to build Bongo
|
|
# anything which isn't necessary should be marked [optional]
|
|
|
|
include(CheckIncludeFile)
|
|
include(CheckLibraryExists)
|
|
|
|
# look for header files we need first
|
|
check_include_file(inttypes.h HAVE_INTTYPES_H)
|
|
check_include_file(sys/kstat.h HAVE_KSTAT_H)
|
|
check_include_file(sys/vfs.h HAVE_SYS_VFS_H)
|
|
check_include_file(sys/stat.h HAVE_SYS_STAT_H)
|
|
check_include_file(sys/statvfs.h HAVE_SYS_STATVFS_H)
|
|
check_include_file(time.h HAVE_TIME_H)
|
|
check_include_file(semaphore.h HAVE_SEMAPHORE_H)
|
|
|
|
# look for zlib
|
|
find_library(HAVE_ZLIB NAMES z zlib)
|
|
if (NOT HAVE_ZLIB)
|
|
message(FATAL_ERROR "Bongo requires zlib")
|
|
endif (NOT HAVE_ZLIB)
|
|
|
|
# look for PThreads
|
|
include(FindThreads)
|
|
if (NOT CMAKE_USE_PTHREADS_INIT)
|
|
message(FATAL_ERROR "Bongo requires a platform with PThreads")
|
|
endif (NOT CMAKE_USE_PTHREADS_INIT)
|
|
|
|
# check for LDAP [optional]
|
|
check_include_file(ldap.h HAVE_LDAP_H)
|
|
if (HAVE_LDAP_H)
|
|
check_library_exists(ldap ldap_init "" HAVE_LDAP)
|
|
endif (HAVE_LDAP_H)
|
|
|
|
# check for ODBC [optional]
|
|
check_include_file(odbcinst.h HAVE_ODBCINST_H)
|
|
if (HAVE_ODBCINST_H)
|
|
check_library_exists(odbc SQLConnect "" HAVE_ODBC)
|
|
endif (HAVE_ODBCINST_H)
|
|
|
|
# check for resolv
|
|
#check_library_exists(resolv res_init "" HAVE_RESOLV)
|
|
#if (NOT HAVE_RESOLV)
|
|
# message(FATAL_ERROR "Cannot find resolv library")
|
|
#endif (NOT HAVE_RESOLV)
|
|
|
|
# check for gettext
|
|
check_include_file(libintl.h HAVE_LIBINTL_H)
|
|
include (FindGettext)
|
|
if (NOT GETTEXT_FOUND)
|
|
message(FATAL_ERROR "Bongo needs Gettext developer support available")
|
|
endif (NOT GETTEXT_FOUND)
|
|
|
|
check_include_file(kstat.h HAVE_KSTAT_H)
|
|
|
|
# check for log4c
|
|
include(cmake/FindLog4C.cmake)
|
|
include_directories(AFTER ${CMAKE_CURRENT_SOURCE_DIR}/import/log4c/)
|
|
|
|
# check for glib
|
|
find_package(GLib2 2.10 REQUIRED)
|
|
# memmgr.h is a public legacy header and includes glib.h directly.
|
|
include_directories(AFTER ${GLib2_INCLUDE_DIRS})
|
|
|
|
# check for GMime
|
|
find_package(GMime 2.6 REQUIRED)
|
|
|
|
# check for gcrypt
|
|
check_library_exists(gcrypt gcry_control "" HAVE_GCRYPT)
|
|
if (HAVE_GCRYPT)
|
|
set(GCRYPT_LIBRARIES "gcrypt")
|
|
else (HAVE_GCRYPT)
|
|
message(FATAL_ERROR "Bongo couldn't find the libgcrypt runtime library")
|
|
endif (HAVE_GCRYPT)
|
|
|
|
# check for gnutls
|
|
find_package(GnuTLS REQUIRED)
|
|
|
|
# check for sqlite3
|
|
find_package(SQLite3 REQUIRED)
|
|
if(NOT TARGET SQLite3::SQLite3)
|
|
add_library(SQLite3::SQLite3 ALIAS SQLite::SQLite3)
|
|
endif()
|
|
|
|
# Secure IMAP, POP3 and SMTP client transport.
|
|
find_package(CURL 7.61 REQUIRED)
|
|
|
|
# RFC 5228 Sieve parser and validator used by the filter UI and ManageSieve.
|
|
find_path(MAILUTILS_INCLUDE_DIR mailutils/sieve.h REQUIRED)
|
|
find_library(MAILUTILS_SIEVE_LIBRARY NAMES mu_sieve REQUIRED)
|
|
find_library(MAILUTILS_LIBRARY NAMES mailutils REQUIRED)
|
|
set(MAILUTILS_LIBRARIES ${MAILUTILS_SIEVE_LIBRARY} ${MAILUTILS_LIBRARY})
|
|
|
|
# Shared SASL implementation for SMTP, IMAP, POP3 and ManageSieve.
|
|
find_package(CyrusSASL 2.1.28 REQUIRED)
|
|
|
|
# Native mail authentication. Bongo links to the protocol libraries directly;
|
|
# it does not require the corresponding milter daemons at runtime.
|
|
find_package(SPF2 REQUIRED)
|
|
find_package(OpenDKIM REQUIRED)
|
|
find_package(OpenDMARC REQUIRED)
|
|
find_package(SRS2 REQUIRED)
|
|
find_package(LibPSL 0.21 REQUIRED)
|
|
|
|
# check for libical
|
|
check_include_file(libical/ical.h HAVE_ICAL_H)
|
|
if (NOT HAVE_ICAL_H)
|
|
check_include_file(ical.h HAVE_OLD_ICAL_H)
|
|
if (NOT HAVE_OLD_ICAL_H)
|
|
message(FATAL_ERROR "Bongo needs libical in order to compile")
|
|
endif (NOT HAVE_OLD_ICAL_H)
|
|
endif (NOT HAVE_ICAL_H)
|
|
|
|
check_library_exists(ical icaltime_compare "" HAVE_ICAL)
|
|
if (HAVE_ICAL)
|
|
set(LIBICAL_LIBRARIES "ical")
|
|
else (HAVE_ICAL)
|
|
message(FATAL_ERROR "Bongo couldn't find the libical runtime library")
|
|
endif (HAVE_ICAL)
|
|
|
|
# check for Python
|
|
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
|
|
set(PYTHON_EXECUTABLE "${Python3_EXECUTABLE}")
|
|
set(PYTHON_LIBRARIES "${Python3_LIBRARIES}")
|
|
set(PYTHON_INCLUDE_DIRS "${Python3_INCLUDE_DIRS}")
|
|
set(PYTHON_INCLUDE_PATH "${Python3_INCLUDE_DIRS}")
|
|
function(python_add_module target)
|
|
add_library(${target} MODULE ${ARGN})
|
|
endfunction()
|
|
if (NOT Python3_Development_FOUND)
|
|
message(FATAL_ERROR "Bongo requires Python development libraries installed")
|
|
endif ()
|
|
|
|
execute_process(
|
|
COMMAND "${Python3_EXECUTABLE}" -c "import dateutil, nh3, vobject"
|
|
RESULT_VARIABLE PYTHON_NH3_FOUND
|
|
)
|
|
if (NOT PYTHON_NH3_FOUND EQUAL 0)
|
|
message(FATAL_ERROR "Bongo requires the Python dateutil, nh3, and vobject modules")
|
|
endif ()
|
|
|
|
execute_process(COMMAND "${Python3_EXECUTABLE}" -c "import sysconfig; print(sysconfig.get_path('purelib', vars={'base':'', 'platbase':''}))"
|
|
RESULT_VARIABLE PYTHON_SITEPACKAGES_FOUND
|
|
OUTPUT_VARIABLE PYTHON_SITEPACKAGES_PATH_RAW
|
|
)
|
|
string(STRIP "${PYTHON_SITEPACKAGES_PATH_RAW}" PYTHON_SITEPACKAGES_PATH_RAW)
|
|
|
|
execute_process(COMMAND "${Python3_EXECUTABLE}" -c "import sysconfig; print(sysconfig.get_path('platlib', vars={'base':'', 'platbase':''}))"
|
|
RESULT_VARIABLE PYTHON_SITELIB_FOUND
|
|
OUTPUT_VARIABLE PYTHON_SITELIB_PATH_RAW
|
|
)
|
|
string(STRIP "${PYTHON_SITELIB_PATH_RAW}" PYTHON_SITELIB_PATH_RAW)
|
|
|
|
if (PYTHON_SITEPACKAGES_FOUND EQUAL 0)
|
|
# sysconfig returns paths relative to an empty base with a leading slash.
|
|
# Prefix them exactly once so /usr/local never becomes /usr/local/usr.
|
|
set(PYTHON_SITEPACKAGES_PATH "${CMAKE_INSTALL_PREFIX}${PYTHON_SITEPACKAGES_PATH_RAW}")
|
|
set(PYTHON_SITELIB_PATH "${CMAKE_INSTALL_PREFIX}${PYTHON_SITELIB_PATH_RAW}")
|
|
else (PYTHON_SITEPACKAGES_FOUND EQUAL 0)
|
|
message(FATAL_ERROR "Couldn't determine where to install Python modules")
|
|
endif (PYTHON_SITEPACKAGES_FOUND EQUAL 0)
|
|
|
|
# check for Doxygen [optional]
|
|
include(FindDoxygen)
|