]> git.ipfire.org Git - thirdparty/pdns.git/blob - configure.ac
Merge pull request #14066 from PowerDNS/dependabot/pip/regression-tests.ixfrdist...
[thirdparty/pdns.git] / configure.ac
1 AC_PREREQ([2.61])
2
3 AC_INIT([pdns], m4_esyscmd([builder-support/gen-version]))
4
5 AC_CONFIG_SRCDIR([pdns/receiver.cc])
6 AC_CONFIG_MACRO_DIR([m4])
7 AC_CONFIG_HEADERS([config.h])
8 AC_CONFIG_AUX_DIR([build-aux])
9
10 AC_SUBST([pdns_configure_args], ["$ac_configure_args"])
11 AC_DEFINE_UNQUOTED([PDNS_CONFIG_ARGS],
12 ["$pdns_configure_args"],
13 [pdns configure arguments]
14 )
15
16 AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip tar-ustar -Wno-portability subdir-objects parallel-tests 1.11])
17 AM_SILENT_RULES([yes])
18
19 AC_CANONICAL_HOST
20 # Add some default CFLAGS and CXXFLAGS, can be appended to using the environment variables
21 CFLAGS="-Wall -g -O2 $CFLAGS"
22 CXXFLAGS="-Wall -g -O2 $CXXFLAGS"
23
24 AC_PROG_CC
25 AM_PROG_CC_C_O
26 PDNS_CHECK_BISON
27 PDNS_CHECK_FLEX
28 AC_PROG_INSTALL
29 AC_PROG_MAKE_SET
30
31 AC_PROG_CXX
32 AS_IF([test "x$CXX" = "xno" || test "x$CXX:x$GXX" = "xg++:x"],
33 [AC_MSG_ERROR([no C++ compiler found])]
34 )
35
36 AC_LANG([C++])
37
38 AC_DEFINE([_GNU_SOURCE], [1],
39 [Define _GNU_SOURCE so that we get all necessary prototypes]
40 )
41
42 # Warn when pkg.m4 is missing
43 m4_pattern_forbid([^_?PKG_[A-Z_]+$], [*** pkg.m4 missing, please install pkg-config])
44
45 PDNS_CHECK_OS
46 PTHREAD_SET_NAME
47
48 PDNS_WITH_LUA
49 PDNS_CHECK_LUA_HPP
50
51 AX_CXX_COMPILE_STDCXX_11
52
53 AC_MSG_CHECKING([whether we will enable compiler security checks])
54 AC_ARG_ENABLE([hardening],
55 [AS_HELP_STRING([--disable-hardening], [disable compiler security checks @<:@default=no@:>@])],
56 [enable_hardening=$enableval],
57 [enable_hardening=yes]
58 )
59 AC_MSG_RESULT([$enable_hardening])
60
61 AS_IF([test "x$enable_hardening" != "xno"], [
62 AC_CC_PIE
63 AC_CC_STACK_PROTECTOR
64 AC_CC_PARAM_SSP_BUFFER_SIZE([4])
65 AC_CC_D_FORTIFY_SOURCE
66 AC_LD_RELRO
67 ])
68
69 PDNS_ENABLE_KISS
70
71 PDNS_CHECK_NETWORK_LIBS
72
73 LT_PREREQ([2.2.2])
74 LT_INIT([disable-static dlopen])
75
76
77 MC_TM_GMTOFF
78
79 # Define full_libdir to be the fully expanded (${exec_prefix}, etc.)
80 # "system" library path.
81 # We use this to search for other libraries.
82 eval full_libdir="\"$libdir\""
83
84 # detect pkg-config explicitly
85 PKG_PROG_PKG_CONFIG
86
87 AC_CHECK_HEADERS(
88 [sys/mman.h],
89 [AC_CHECK_FUNC(
90 [mmap],
91 [AC_DEFINE(HAVE_MMAP, [1], [Define to 1 if you have mmap])],
92 [have_mmap=no]
93 )],
94 [have_mmap=no]
95 )
96
97 PDNS_WITH_LIBSODIUM
98 PDNS_WITH_LIBDECAF
99 PDNS_CHECK_LIBCRYPTO([
100 ],[
101 AC_MSG_ERROR([OpenSSL/libcrypto not found])
102 ]
103 )
104 PDNS_CHECK_LIBCRYPTO_ECDSA
105 PDNS_CHECK_LIBCRYPTO_EDDSA
106
107 PDNS_CHECK_RAGEL([pdns/dnslabeltext.cc], [www.powerdns.com])
108 PDNS_CHECK_CLOCK_GETTIME
109
110 BOOST_REQUIRE([1.42])
111 # Boost accumulators, as used by dnsbulktest and dnstcpbench, need 1.48+
112 # to be compatible with C++11
113 AM_CONDITIONAL([HAVE_BOOST_GE_148], [test "$boost_major_version" -ge 148])
114 AS_IF([test "$boost_major_version" -ge 148], [
115 AC_DEFINE(HAVE_BOOST_GE_148, [1], [Define to 1 if you have boost >= 1.48])
116 ])
117
118 BOOST_PROGRAM_OPTIONS([mt])
119 AS_IF([test "$boost_cv_lib_program_options" = "no"], [
120 AC_MSG_ERROR([Boost Program Options library not found])
121 ])
122 PDNS_ENABLE_UNIT_TESTS
123 PDNS_ENABLE_BACKEND_UNIT_TESTS
124 PDNS_ENABLE_REPRODUCIBLE
125 PDNS_ENABLE_FUZZ_TARGETS
126
127 PDNS_WITH_SQLITE3
128
129 PDNS_CHECK_VIRTUALENV
130 PDNS_FROM_GIT
131
132 dnl Checks for library functions.
133 AC_CHECK_FUNCS_ONCE([strcasestr localtime_r recvmmsg sched_setscheduler getrandom arc4random])
134
135 AM_CONDITIONAL([HAVE_RECVMMSG], [test "x$ac_cv_func_recvmmsg" = "xyes"])
136
137 AS_IF([test "x$lt_cv_dlopen" = "xno"],
138 [AC_MSG_ERROR([Your system does not support dlopen])]
139 )
140
141 AC_SUBST([LIBDL], [$lt_cv_dlopen_libs])
142
143 PDNS_ENABLE_VERBOSE_LOGGING
144 PDNS_ENABLE_PKCS11
145 PDNS_ENABLE_GSS_TSIG
146
147 AC_SUBST([socketdir])
148 socketdir="/var/run"
149 AC_ARG_WITH([socketdir],
150 [AS_HELP_STRING([--with-socketdir], [where the controlsocket lives @<:@default=/var/run@:>@])],
151 [socketdir="$withval"]
152 )
153
154 modules="bind gmysql random"
155 AC_ARG_WITH([modules],
156 [AS_HELP_STRING([--with-modules], [which backends to compile with @<:@default=bind gmysql random@:>@])],
157 [modules="$withval"]
158 )
159
160 dynmodules="pipe"
161 AC_ARG_WITH([dynmodules],
162 [AS_HELP_STRING([--with-dynmodules], [which backends to build for dynamic loading @<:@default=pipe@:>@])],
163 [dynmodules="$withval"]
164 )
165
166 AC_SUBST([moduledirs])
167 AC_SUBST([moduleobjects])
168 AC_SUBST([modulelibs])
169 AC_DEFINE_UNQUOTED([PDNS_MODULES], "$modules", [Built-in modules])
170
171 AS_IF([test x"$modules" = "xno"], [modules=""])
172 AS_IF([test x"$dynmodules" = "xno"], [dynmodules=""])
173
174 for a in $modules $dynmodules; do
175 case "$a" in
176 oracle|goracle)
177 PDNS_WITH_ORACLE
178 needoracle=yes
179 ;;
180 godbc)
181 PDNS_WITH_UNIXODBC
182 ;;
183 mydns|gmysql)
184 PDNS_WITH_MYSQL
185 ;;
186 gpgsql)
187 PDNS_WITH_POSTGRESQL
188 ;;
189 gsqlite3)
190 needsqlite3=yes
191 ;;
192 ldap)
193 PDNS_CHECK_LDAP
194 needldap=yes
195 ;;
196 opendbx)
197 PDNS_CHECK_OPENDBX
198 ;;
199 remote)
200 AS_IF([test "x$enable_unit_tests" = "xyes"],
201 [PDNS_CHECK_CURL_PROGRAM]
202 )
203 have_remotebackend=yes
204 ;;
205 tinydns)
206 PDNS_CHECK_CDB
207 ;;
208 geoip)
209 PDNS_CHECK_GEOIP
210 ;;
211 lua*)
212 AS_IF([test "x$with_lua" = "xno"],
213 [AC_MSG_ERROR([${a} backend needs lua, run ./configure --with-lua])]
214 )
215 AS_IF([test "x$LUAPC" = "x"],
216 [AC_MSG_ERROR([${a} backend needs lua but we cannot find it])]
217 )
218 ;;
219 lmdb)
220 PDNS_CHECK_LMDB
221 BOOST_SERIALIZATION
222 ;;
223 esac
224 done
225
226 PDNS_ENABLE_REMOTEBACKEND_ZEROMQ
227
228 PDNS_ENABLE_TOOLS
229 PDNS_ENABLE_IXFRDIST
230
231 PDNS_WITH_PROTOBUF
232
233 PDNS_WITH_LUA_RECORDS
234
235 AM_CONDITIONAL([ORACLE], [test "x$needoracle" = "xyes"])
236
237 AM_CONDITIONAL([LDAP], [test "x$needldap" = "xyes"])
238
239 PDNS_CHECK_SQLITE3
240 AM_CONDITIONAL([SQLITE3], [test "x$needsqlite3" = "xyes"])
241
242 for a in $modules; do
243 AC_MSG_CHECKING([whether we can build module "${a}"])
244 if [[ -d "$srcdir/modules/${a}backend" ]]; then
245 AC_MSG_RESULT([yes])
246 moduledirs="$moduledirs ${a}backend"
247
248 for b in `cat $srcdir/modules/${a}backend/OBJECTFILES`; do
249 moduleobjects="$moduleobjects ../modules/${a}backend/$b"
250 done
251 modulelibs="$modulelibs `cat $srcdir/modules/${a}backend/OBJECTLIBS`"
252 else
253 AC_MSG_RESULT([no])
254 AC_MSG_ERROR([Do not know how to build module "$a", "$srcdir/modules/${a}backend" does not exist! Please review --with-modules parameter for supported values.])
255 fi
256 done
257
258 for a in $dynmodules; do
259 AC_MSG_CHECKING([whether we can build dynamic module "${a}"])
260 if [[ -d "$srcdir/modules/${a}backend" ]]; then
261 AC_MSG_RESULT([yes])
262 moduledirs="$moduledirs ${a}backend"
263 else
264 AC_MSG_RESULT([no])
265 AC_MSG_ERROR([Do not know how to build module "$a", "$srcdir/modules/${a}backend" does not exist! Please review --with-dynmodules parameter for supported values.])
266 fi
267 done
268
269 AX_AVAILABLE_SYSTEMD
270 AX_CHECK_SYSTEMD_FEATURES
271 AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ])
272
273 LDFLAGS="$RELRO_LDFLAGS $LDFLAGS"
274
275 CFLAGS="$PIE_CFLAGS $CFLAGS"
276 CXXFLAGS="$PIE_CFLAGS $CXXFLAGS"
277 PROGRAM_LDFLAGS="$PIE_LDFLAGS $PROGRAM_LDFLAGS"
278 AC_SUBST([PROGRAM_LDFLAGS])
279
280 PDNS_ENABLE_COVERAGE
281 PDNS_ENABLE_SANITIZERS
282 PDNS_ENABLE_MALLOC_TRACE
283
284 AC_SUBST(LIBS)
285
286 AC_SUBST([AM_CPPFLAGS],
287 ["AS_ESCAPE([-I$(top_builddir) -I$(top_srcdir)]) $THREADFLAGS $BOOST_CPPFLAGS"]
288 )
289
290 AC_SUBST([YAHTTP_CFLAGS], ['-I$(top_srcdir)/ext/yahttp'])
291 AC_SUBST([YAHTTP_LIBS], ['$(top_builddir)/ext/yahttp/yahttp/libyahttp.la'])
292 AC_SUBST([IPCRYPT_CFLAGS], ['-I$(top_srcdir)/ext/ipcrypt'])
293 AC_SUBST([IPCRYPT_LIBS], ['$(top_builddir)/ext/ipcrypt/libipcrypt.la'])
294
295 CXXFLAGS="$SANITIZER_FLAGS $CXXFLAGS"
296
297 AC_ARG_VAR(PACKAGEVERSION, [The version used in secpoll queries])
298 AS_IF([test "x$PACKAGEVERSION" != "x"],
299 [AC_DEFINE_UNQUOTED([PACKAGEVERSION], "$PACKAGEVERSION", [Set to the package version used for secpoll])]
300 )
301
302 export moduledirs moduleobjects modulelibs
303
304 AC_CONFIG_FILES([
305 Makefile
306 modules/Makefile
307 pdns/Makefile
308 codedocs/Makefile
309 docs/Makefile
310 pdns/pdns.init
311 ext/Makefile
312 ext/ipcrypt/Makefile
313 ext/yahttp/Makefile
314 ext/yahttp/yahttp/Makefile
315 ext/json11/Makefile
316 modules/bindbackend/Makefile
317 modules/geoipbackend/Makefile
318 modules/gmysqlbackend/Makefile
319 modules/godbcbackend/Makefile
320 modules/goraclebackend/Makefile
321 modules/gpgsqlbackend/Makefile
322 modules/gsqlite3backend/Makefile
323 modules/ldapbackend/Makefile
324 modules/lmdbbackend/Makefile
325 modules/luabackend/Makefile
326 modules/lua2backend/Makefile
327 modules/mydnsbackend/Makefile
328 modules/opendbxbackend/Makefile
329 modules/oraclebackend/Makefile
330 modules/pipebackend/Makefile
331 modules/randombackend/Makefile
332 modules/remotebackend/Makefile
333 modules/tinydnsbackend/Makefile
334 ])
335 AC_OUTPUT
336
337 AC_MSG_NOTICE([])
338 AC_MSG_NOTICE([Configuration summary])
339 AC_MSG_NOTICE([=====================])
340 AC_MSG_NOTICE([])
341 AC_MSG_NOTICE([Configured with: $pdns_configure_args])
342 AC_MSG_NOTICE([])
343 AC_MSG_NOTICE([CC: $CC])
344 AC_MSG_NOTICE([CXX: $CXX])
345 AC_MSG_NOTICE([LD: $LD])
346 AC_MSG_NOTICE([CFLAGS: $CFLAGS])
347 AC_MSG_NOTICE([CPPFLAGS: $CPPFLAGS])
348 AC_MSG_NOTICE([CXXFLAGS: $CXXFLAGS])
349 AC_MSG_NOTICE([LDFLAGS: $LDFLAGS])
350 AC_MSG_NOTICE([LIBS: $LIBS])
351 AC_MSG_NOTICE([BOOST_CPPFLAGS: $BOOST_CPPFLAGS])
352 AC_MSG_NOTICE([])
353 AC_MSG_NOTICE([Features enabled])
354 AC_MSG_NOTICE([----------------])
355 AC_MSG_NOTICE([Built-in modules: $modules])
356 AC_MSG_NOTICE([Dynamic modules: $dynmodules])
357 AC_MSG_NOTICE([])
358 AS_IF([test "x$libcrypto_ecdsa" = "xyes"],
359 [AC_MSG_NOTICE([OpenSSL ecdsa: yes])],
360 [AC_MSG_NOTICE([OpenSSL ecdsa: no])]
361 )
362 AS_IF([test "x$LIBSODIUM_LIBS" != "x" || test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed25519" = "xyes"],
363 [AC_MSG_NOTICE([ed25519: yes])],
364 [AC_MSG_NOTICE([ed25519: no])]
365 )
366 AS_IF([test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed448" = "xyes"],
367 [AC_MSG_NOTICE([ed448: yes])],
368 [AC_MSG_NOTICE([ed448: no])]
369 )
370 AS_IF([test "x$needsqlite3" != "x"],
371 [AC_MSG_NOTICE([SQLite3: yes])],
372 [AC_MSG_NOTICE([SQLite3: no])]
373 )
374 AS_IF([test "x$LUAPC" != "x"],
375 [AC_MSG_NOTICE([Lua: $LUAPC])],
376 [AS_IF([test "x$LUAJITPC" != "x"],
377 [AC_MSG_NOTICE([LuaJit: $LUAJITPC])],
378 [AC_MSG_NOTICE([Lua/LuaJit: no])])
379 ])
380 AS_IF([test "x$enable_experimental_pkcs11" = "xyes"],
381 [AC_MSG_NOTICE([PKCS-11: yes])]
382 )
383 AS_IF([test "x$enable_experimental_gss_tsig" = "xyes"],
384 [AC_MSG_NOTICE([GSS-TSIG: yes])]
385 )
386 AS_IF([test "x$systemd" != "xn"],
387 [AC_MSG_NOTICE([systemd: yes])],
388 [AC_MSG_NOTICE([systemd: no])]
389 )
390 AS_IF([test "x$enable_remotebackend_zeromq" != "xno"],
391 [AC_MSG_NOTICE([ZeroMQ connector for remotebackend: yes])]
392 )
393 AC_MSG_NOTICE([])