This repository has been archived by the owner on Feb 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathconfigure.ac
89 lines (77 loc) · 4.27 KB
/
configure.ac
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
## AC_INIT(package, version, [bug-report], [tarname], [url])
AC_INIT([poseidon], [master], [[email protected]], [poseidon], [https://github.com/lhmouse/poseidon])
AC_LANG([C++])
AC_CONFIG_SRCDIR([poseidon/main.cpp])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_CXX
LT_INIT([disable-static])
LT_LANG([C++])
AM_INIT_AUTOMAKE([foreign subdir-objects])
AM_SILENT_RULES([yes])
## Define ABI information
AS_VAR_SET([abi_major], [1])
AS_VAR_SET([abi_minor], [0])
AS_VAR_SET([abi_suffix], [beta.0])
## Check for required libraries
AC_CHECK_LIB([dl], [dlopen], [], [AC_MSG_ERROR(dl library not found)])
AC_CHECK_LIB([pthread], [pthread_create], [], [AC_MSG_ERROR(pthread library not found)])
AC_CHECK_LIB([asteria], [_ZN7asteria18null_value_storageE], [], [AC_MSG_ERROR(Asteria not found)])
AC_CHECK_LIB([ssl], [TLS_method], [], [AC_MSG_ERROR(OpenSSL 1.1 not found)])
AC_CHECK_LIB([crypto], [ERR_error_string], [], [AC_MSG_ERROR(OpenSSL not found)])
AC_CHECK_LIB([z], [deflate], [], [AC_MSG_ERROR(zlib not found)])
AC_CHECK_LIB([http_parser], [http_parser_execute], [], [AC_MSG_ERROR(http-parser library not found)])
## Check for assertions
AC_ARG_ENABLE([debug-checks], AS_HELP_STRING([--enable-debug-checks], [enable assertions]))
AM_CONDITIONAL([enable_debug_checks], [test "${enable_debug_checks}" == "yes"])
AM_COND_IF([enable_debug_checks], [
AC_DEFINE([_GLIBCXX_DEBUG], [1], [Define to 1 to enable debug checks of libstdc++.])
AC_DEFINE([_LIBCPP_DEBUG], [1], [Define to 1 to enable debug checks of libc++.])
AC_DEFINE([_DEBUG], [1], [Define to 1 to enable debug checks of MSVC standard library.])
])
## Check for pre-compiled headers
AC_ARG_ENABLE([pch], AS_HELP_STRING([--disable-pch], [do not use pre-compiled headers]))
AM_CONDITIONAL([enable_pch], [test "${enable_pch}" != "no"])
## Set up optional features
AC_ARG_ENABLE([sanitizer], AS_HELP_STRING([--enable-sanitizer=address|thread],
[enable sanitizer (address sanitizer and thread sanitizer cannot be enabled at the same time)]))
AS_VAR_SET([sanitizer_flags])
AM_CONDITIONAL([enable_address_sanitizer], [test "${enable_sanitizer}" == "address"])
AM_COND_IF([enable_address_sanitizer], [
AC_CHECK_LIB([asan], [__asan_report_error], [], [AC_MSG_ERROR([address sanitizer not found])])
AC_DEFINE([POSEIDON_ENABLE_ADDRESS_SANITIZER], [1], [Define to 1 to enable address sanitizer.])
AS_VAR_APPEND([sanitizer_flags], [" -fsanitize=address"])
])
AM_CONDITIONAL([enable_thread_sanitizer], [test "${enable_sanitizer}" == "thread"])
AM_COND_IF([enable_thread_sanitizer], [
AC_CHECK_LIB([tsan], [__tsan_on_report], [], [AC_MSG_ERROR([thread sanitizer not found])])
AC_DEFINE([POSEIDON_ENABLE_THREAD_SANITIZER], [1], [Define to 1 to enable thread sanitizer.])
AS_VAR_APPEND([sanitizer_flags], [" -fsanitize=thread"])
])
AC_ARG_ENABLE([mysql], AS_HELP_STRING([--disable-mysql], [disable MySQL support]))
AM_CONDITIONAL([enable_mysql], [test "${enable_mysql}" != "no"])
AM_COND_IF([enable_mysql], [
AC_CHECK_LIB([mysqlclient], [mysql_real_connect], [], [AC_MSG_ERROR([libmysqlclient not found (pass `--disable-mysql` to disable MySQL)])])
AC_DEFINE([POSEIDON_ENABLE_MYSQL], [1], [Define to 1 to build the MySQL daemon.])
])
AC_ARG_ENABLE([mongodb], AS_HELP_STRING([--disable-mongodb], [disable MongoDB support]))
AM_CONDITIONAL([enable_mongodb], [test "${enable_mongodb}" != "no"])
AM_COND_IF([enable_mongodb], [
AC_CHECK_LIB([bson-1.0], [bson_new], [], [AC_MSG_ERROR([libbson-1.0 not found (pass `--disable-mongodb` to disable MongoDB)])])
AC_CHECK_LIB([mongoc-1.0], [mongoc_uri_new_for_host_port], [], [AC_MSG_ERROR([libmongoc-1.0 not found (pass `--disable-mongodb` to disable MongoDB)])])
AC_DEFINE([POSEIDON_ENABLE_MONGODB], [1], [Define to 1 to build the MongoDB daemon.])
])
AC_ARG_ENABLE([magic], AS_HELP_STRING([--disable-magic], [disable magic number recognition]))
AM_CONDITIONAL([enable_magic], [test "${enable_magic}" != "no"])
AM_COND_IF([enable_magic], [
AC_CHECK_LIB([magic], [magic_open], [], [AC_MSG_ERROR([libmagic not found (pass `--disable-magic` to disable libmagic)])])
AC_DEFINE([POSEIDON_ENABLE_MAGIC], [1], [Define to 1 to build the Magic daemon.])
])
## Finish
AC_SUBST([abi_major])
AC_SUBST([abi_minor])
AC_SUBST([abi_suffix])
AC_SUBST([sanitizer_flags])
AC_CONFIG_FILES([Makefile poseidon/version.h])
AC_OUTPUT