]> jfr.im git - irc/atheme/atheme.git/blob - configure.ac
Merge pull request #927 from runxiyu/master
[irc/atheme/atheme.git] / configure.ac
1 # SPDX-License-Identifier: ISC
2 # SPDX-URL: https://spdx.org/licenses/ISC.html
3 #
4 # Copyright (C) 2005-2015 Atheme Project (http://atheme.org/)
5 # Copyright (C) 2015-2019 Atheme Development Group (https://atheme.github.io/)
6
7 AC_PREREQ([2.69])
8
9 AC_LANG([C])
10 AC_INIT([Atheme IRC Services], [7.3.0-rc2], [https://github.com/atheme/atheme/issues/], [atheme], [https://atheme.github.io/])
11
12 AC_CONFIG_AUX_DIR([build-aux])
13 AC_CONFIG_FILES([buildsys.mk extra.mk])
14 AC_CONFIG_HEADERS([include/atheme/sysconf.h])
15 AC_CONFIG_MACRO_DIR([m4])
16 AC_CONFIG_SRCDIR([src/services/main.c])
17 AC_PREFIX_DEFAULT([~/atheme])
18 AS_IF([test "x${prefix}" = "xNONE"], [prefix="${ac_default_prefix}"])
19
20 AS_IF([test -d ".git"], [
21 AC_MSG_CHECKING([if you read GIT-Access.txt])
22 AS_IF([test -f "libmowgli-2/Makefile" -a -f "modules/contrib/Makefile"], [
23 AC_MSG_RESULT([yes])
24 ], [
25 AC_MSG_RESULT([no])
26 AC_MSG_ERROR([please read GIT-Access.txt before trying to build from git])
27 ])
28 ], [
29 AC_MSG_CHECKING([if you downloaded the correct source code tarball])
30 AS_IF([test -f "include/atheme/serno.h"], [
31 AC_MSG_RESULT([yes])
32 ], [
33 AC_MSG_RESULT([no])
34 AC_MSG_ERROR([please read the Obtaining Atheme section of README.md])
35 ])
36 ])
37
38 AH_TOP([
39 #ifndef ATHEME_INC_SYSCONF_H
40 #define ATHEME_INC_SYSCONF_H 1
41
42 #define ATHEME_API_DIGEST_FRONTEND_INTERNAL 0x00U
43 #define ATHEME_API_DIGEST_FRONTEND_MBEDTLS 0x01U
44 #define ATHEME_API_DIGEST_FRONTEND_OPENSSL 0x02U
45 #define ATHEME_API_DIGEST_FRONTEND_GCRYPT 0x03U
46
47 #define ATHEME_API_RANDOM_FRONTEND_INTERNAL 0x00U
48 #define ATHEME_API_RANDOM_FRONTEND_MBEDTLS 0x01U
49 #define ATHEME_API_RANDOM_FRONTEND_ARC4RANDOM 0x02U
50 #define ATHEME_API_RANDOM_FRONTEND_SODIUM 0x03U
51 #define ATHEME_API_RANDOM_FRONTEND_OPENSSL 0x04U
52 ])
53
54 AH_BOTTOM([
55 #ifndef ATHEME_API_DIGEST_FRONTEND
56 # error "No Digest API frontend was selected by the build system"
57 #endif /* !ATHEME_API_DIGEST_FRONTEND */
58
59 #ifndef ATHEME_API_RANDOM_FRONTEND
60 # error "No RNG API frontend was selected by the build system"
61 #endif /* !ATHEME_API_RANDOM_FRONTEND */
62
63 #endif /* !ATHEME_INC_SYSCONF_H */
64 ])
65
66 # If CFLAGS is empty or unset, explicitly set it to the empty string, so that
67 # AC_PROG_CC (below) does not add "-O2 -g", as this will conflict with the
68 # optimisation flags that the compiler sanitizers feature uses, and the
69 # more advanced debugging flags detection that the CFLAGS feature test uses
70 AS_IF([test "x${CFLAGS:-}" = "x"], [CFLAGS=""])
71
72 # Programs required by the build system
73 AC_PROG_CC
74 AC_PROG_CC_C99
75 AS_IF([test "x${ac_cv_prog_cc_c99}" = "xno"], [
76 AC_MSG_FAILURE([This program requires a C99 compiler])
77 ])
78 AC_CHECK_TOOL([AR], [ar])
79 AC_PATH_PROG([CP], [cp])
80 AC_PROG_INSTALL
81 AC_PATH_PROG([LN], [ln])
82 AC_PROG_LN_S
83 AC_PROG_MAKE_SET
84 AC_PATH_PROG([MV], [mv])
85 AC_PROG_RANLIB
86 AC_PATH_PROG([RM], [rm])
87 AC_PROG_SED
88 AC_PATH_PROG([TAR], [tar])
89 PKG_PROG_PKG_CONFIG
90 AS_IF([test -z "${PKG_CONFIG}"], [
91 AC_MSG_WARN([please consider installing pkg-config])
92 AC_MSG_WARN([many of this script's library and feature detection tests rely upon it being available])
93 AC_MSG_WARN([if you choose to do so, please re-run this script again])
94 ])
95
96 # Does what its name implies. The above block can't be put into this function
97 # because of autotools black magic voodoo crap that no-one understands ...
98 ATHEME_CHECK_BUILD_REQUIREMENTS
99
100 # Automake compatibility. --nenolod
101 AC_SUBST([PACKAGE], [AC_PACKAGE_TARNAME])
102 AC_SUBST([VERSION], [AC_PACKAGE_VERSION])
103 AC_SUBST([VENDOR_STRING], ["Atheme Development Group <https://atheme.github.io/>"])
104 AC_SUBST([PACKAGE_BUGREPORT_I18N], ["ircs://irc.libera.chat:6697/atheme-i18n"])
105 AC_DEFINE_UNQUOTED([PACKAGE], ["${PACKAGE}"], [Name of package])
106 AC_DEFINE_UNQUOTED([VERSION], ["${VERSION}"], [Version number of package])
107 AC_DEFINE_UNQUOTED([VENDOR_STRING], ["${VENDOR_STRING}"], [Vendor string for in-tree module headers])
108 AC_DEFINE_UNQUOTED([PACKAGE_BUGREPORT_I18N], ["${PACKAGE_BUGREPORT_I18N}"], [Where to report translation bugs])
109
110 # This should be before any library tests so that insufficient header
111 # inclusions in those tests are caught before they become a runtime
112 # problem
113 ATHEME_TEST_CC_FLAGS([-Werror=implicit])
114
115 # Conditional libraries for standard functions (no option to control detection)
116 ATHEME_LIBTEST_DL
117 ATHEME_LIBTEST_MATH
118 ATHEME_LIBTEST_SOCKET
119
120 # Libraries that are autodetected (alphabetical)
121 ATHEME_LIBTEST_ARGON2
122 ATHEME_LIBTEST_CRACK
123 ATHEME_LIBTEST_CRYPT
124 ATHEME_LIBTEST_CRYPTO
125 ATHEME_LIBTEST_GCRYPT
126 ATHEME_LIBTEST_IDN
127 ATHEME_LIBTEST_LDAP
128 ATHEME_LIBTEST_MBEDCRYPTO
129 ATHEME_LIBTEST_MOWGLI
130 ATHEME_LIBTEST_NETTLE
131 ATHEME_LIBTEST_PASSWDQC
132 ATHEME_LIBTEST_PCRE
133 ATHEME_LIBTEST_QRENCODE
134 ATHEME_LIBTEST_SODIUM
135
136 # Libraries that need to be explicitly enabled (alphabetical)
137 ATHEME_LIBTEST_PERL
138
139 # Digest and RNG frontend to use in libathemecore
140 ATHEME_DECIDE_DIGEST_FRONTEND
141 ATHEME_DECIDE_RANDOM_FRONTEND
142
143 # Optional features
144 # These must be after library tests, because some of them depend on the
145 # library detection logic in the tests to set appropriate variables
146 ATHEME_FEATURETEST_CONTRIB
147 ATHEME_FEATURETEST_CRYPTO_BENCHMARKING
148 ATHEME_FEATURETEST_ECDH_X25519_TOOL
149 ATHEME_FEATURETEST_ECDSA_NIST256P_TOOLS
150 ATHEME_FEATURETEST_FHSPATHS
151 ATHEME_FEATURETEST_HEAP_ALLOCATOR
152 ATHEME_FEATURETEST_LARGENET
153 ATHEME_FEATURETEST_LEGACY_PWCRYPTO
154 ATHEME_FEATURETEST_REPROBUILDS
155
156 # These must be here, not above, or they might interfere with library and feature tests
157 # Explanation is that these modify one or more of CFLAGS, CPPFLAGS, LDFLAGS, and LIBS
158 # Warnings should be last so that diagnostics don't clutter the contents of config.log
159 # Sanitizers must be before CFLAGS and LDFLAGS
160 ATHEME_FEATURETEST_COMPILER_SANITIZERS
161 ATHEME_FEATURETEST_CPPFLAGS
162 ATHEME_FEATURETEST_CFLAGS
163 ATHEME_FEATURETEST_LDFLAGS
164 ATHEME_FEATURETEST_NLS
165 ATHEME_FEATURETEST_WARNINGS
166
167 # Handle enabling and configuration of submodules
168 ATHEME_HANDLE_SUBMODULES
169
170 # Now add libmowgli and libpcre to CFLAGS and LIBS because the whole codebase uses them
171 AS_IF([test "x${LIBMOWGLI_CFLAGS}" != "x"], [CFLAGS="${LIBMOWGLI_CFLAGS} ${CFLAGS}"])
172 AS_IF([test "x${LIBMOWGLI_LIBS}" != "x"], [LIBS="${LIBMOWGLI_LIBS} ${LIBS}"])
173 AS_IF([test "x${LIBPCRE_CFLAGS}" != "x"], [CFLAGS="${LIBPCRE_CFLAGS} ${CFLAGS}"])
174 AS_IF([test "x${LIBPCRE_LIBS}" != "x"], [LIBS="${LIBPCRE_LIBS} ${LIBS}"])
175
176
177
178 AC_OUTPUT
179 BUILDSYS_TOUCH_DEPS
180 ATHEME_PRINT_CONFIGURATION