1 # SPDX-License-Identifier: ISC
2 # SPDX-URL: https://spdx.org/licenses/ISC.html
4 # Copyright (C) 2005-2015 Atheme Project (http://atheme.org/)
5 # Copyright (C) 2015-2019 Atheme Development Group (https://atheme.github.io/)
10 AC_INIT([Atheme IRC Services], [7.3.0-rc2], [https://github.com/atheme/atheme/issues/], [atheme], [https://atheme.github.io/])
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}"])
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"], [
26 AC_MSG_ERROR([please read GIT-Access.txt before trying to build from git])
29 AC_MSG_CHECKING([if you downloaded the correct source code tarball])
30 AS_IF([test -f "include/atheme/serno.h"], [
34 AC_MSG_ERROR([please read the Obtaining Atheme section of README.md])
39 #ifndef ATHEME_INC_SYSCONF_H
40 #define ATHEME_INC_SYSCONF_H 1
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
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
55 #ifndef ATHEME_API_DIGEST_FRONTEND
56 # error "No Digest API frontend was selected by the build system"
57 #endif /* !ATHEME_API_DIGEST_FRONTEND */
59 #ifndef ATHEME_API_RANDOM_FRONTEND
60 # error "No RNG API frontend was selected by the build system"
61 #endif /* !ATHEME_API_RANDOM_FRONTEND */
63 #endif /* !ATHEME_INC_SYSCONF_H */
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=""])
72 # Programs required by the build system
75 AS_IF([test "x${ac_cv_prog_cc_c99}" = "xno"], [
76 AC_MSG_FAILURE([This program requires a C99 compiler])
78 AC_CHECK_TOOL([AR], [ar])
79 AC_PATH_PROG([CP], [cp])
81 AC_PATH_PROG([LN], [ln])
84 AC_PATH_PROG([MV], [mv])
86 AC_PATH_PROG([RM], [rm])
88 AC_PATH_PROG([TAR], [tar])
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])
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
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])
110 # This should be before any library tests so that insufficient header
111 # inclusions in those tests are caught before they become a runtime
113 ATHEME_TEST_CC_FLAGS([-Werror=implicit])
115 # Conditional libraries for standard functions (no option to control detection)
118 ATHEME_LIBTEST_SOCKET
120 # Libraries that are autodetected (alphabetical)
121 ATHEME_LIBTEST_ARGON2
124 ATHEME_LIBTEST_CRYPTO
125 ATHEME_LIBTEST_GCRYPT
128 ATHEME_LIBTEST_MBEDCRYPTO
129 ATHEME_LIBTEST_MOWGLI
130 ATHEME_LIBTEST_NETTLE
131 ATHEME_LIBTEST_PASSWDQC
133 ATHEME_LIBTEST_QRENCODE
134 ATHEME_LIBTEST_SODIUM
136 # Libraries that need to be explicitly enabled (alphabetical)
139 # Digest and RNG frontend to use in libathemecore
140 ATHEME_DECIDE_DIGEST_FRONTEND
141 ATHEME_DECIDE_RANDOM_FRONTEND
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
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
167 # Handle enabling and configuration of submodules
168 ATHEME_HANDLE_SUBMODULES
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}"])
180 ATHEME_PRINT_CONFIGURATION