]> git.ipfire.org Git - thirdparty/pdns.git/blame - configure.ac
Merge pull request #8639 from captainark/rec-postinst
[thirdparty/pdns.git] / configure.ac
CommitLineData
39653d75
RK
1AC_PREREQ([2.61])
2
f19fe465 3AC_INIT([pdns], m4_esyscmd([builder-support/gen-version]))
39653d75 4
6707cb12 5AC_CONFIG_SRCDIR([pdns/receiver.cc])
39653d75
RK
6AC_CONFIG_MACRO_DIR([m4])
7AC_CONFIG_HEADERS([config.h])
8AC_CONFIG_AUX_DIR([build-aux])
9
8c8b9197 10AC_SUBST([pdns_configure_args], ["$ac_configure_args"])
0060b613
RK
11AC_DEFINE_UNQUOTED([PDNS_CONFIG_ARGS],
12 ["$pdns_configure_args"],
13 [pdns configure arguments]
14)
15
afbdd9f0 16AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip tar-ustar -Wno-portability subdir-objects parallel-tests 1.11])
dcf224eb 17AM_SILENT_RULES([yes])
39653d75 18
92a4978f 19AC_CANONICAL_HOST
d44335b4 20# Add some default CFLAGS and CXXFLAGS, can be appended to using the environment variables
690b86b7
OM
21CFLAGS="-g -O2 -Wall -Wextra -Wshadow -Wno-unused-parameter $CFLAGS"
22CXXFLAGS="-g -O2 -Wall -Wextra -Wshadow -Wno-unused-parameter $CXXFLAGS"
39653d75 23
92a4978f 24AC_PROG_CC
dd50be34 25AM_PROG_CC_C_O
44362487 26PDNS_CHECK_BISON
33086d97 27PDNS_CHECK_FLEX
92a4978f
BH
28AC_PROG_INSTALL
29AC_PROG_MAKE_SET
26870de7 30
27a4e655
RK
31AC_PROG_CXX
32AS_IF([test "x$CXX" = "xno" || test "x$CXX:x$GXX" = "xg++:x"],
49983d9a 33 [AC_MSG_ERROR([no C++ compiler found])]
27a4e655
RK
34)
35
66da2833 36AC_LANG([C++])
92a4978f 37
f33c1fff
RK
38AC_DEFINE([_GNU_SOURCE], [1],
39 [Define _GNU_SOURCE so that we get all necessary prototypes]
40)
41
ad313e37 42# Warn when pkg.m4 is missing
8c8b9197 43m4_pattern_forbid([^_?PKG_[A-Z_]+$], [*** pkg.m4 missing, please install pkg-config])
ad313e37 44
03571f7a 45PDNS_CHECK_OS
519f5484 46PTHREAD_SET_NAME
03571f7a 47
026090e8 48PDNS_WITH_LUA
9a927586 49PDNS_CHECK_LUA_HPP
4f6c5ee6 50
8c8b9197 51AX_CXX_COMPILE_STDCXX_11
0b61c633
T
52
53AC_MSG_CHECKING([whether we will enable compiler security checks])
54AC_ARG_ENABLE([hardening],
8c8b9197 55 [AS_HELP_STRING([--disable-hardening], [disable compiler security checks @<:@default=no@:>@])],
0b61c633
T
56 [enable_hardening=$enableval],
57 [enable_hardening=yes]
58)
59AC_MSG_RESULT([$enable_hardening])
60
c77252b6
RK
61AS_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])
d6e5e940 68
e97cb679
AT
69PDNS_ENABLE_KISS
70
020b39f3 71PDNS_CHECK_NETWORK_LIBS
9d44a523 72
28bb0d13 73LT_PREREQ([2.2.2])
a596b8e9 74LT_INIT([disable-static dlopen])
59414d0e 75
d6e5e940 76
96ae9a2e
KM
77MC_TM_GMTOFF
78
0949b8ae
CH
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.
82eval full_libdir="\"$libdir\""
39653d75 83
27fe16bd
RK
84# detect pkg-config explicitly
85PKG_PROG_PKG_CONFIG
86
709ca59f
AT
87AC_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
cb264691 97PDNS_WITH_LIBSODIUM
ee89ca58 98PDNS_WITH_LIBDECAF
74d83458 99PDNS_CHECK_LIBCRYPTO([
df85a9a0 100],[
74d83458 101 AC_MSG_ERROR([OpenSSL/libcrypto not found])
df85a9a0 102 ]
7581a35b 103)
74d83458 104PDNS_CHECK_LIBCRYPTO_ECDSA
439974d7 105PDNS_CHECK_LIBCRYPTO_EDDSA
1d026a23 106
29e13421 107PDNS_CHECK_RAGEL([pdns/dnslabeltext.cc], [www.powerdns.com])
bcd17c71 108PDNS_CHECK_CLOCK_GETTIME
d81a3e14 109
3f9a8002 110BOOST_REQUIRE([1.42])
6cedc26d
RG
111# Boost accumulators, as used by dnsbulktest and dnstcpbench, need 1.48+
112# to be compatible with C++11
113AM_CONDITIONAL([HAVE_BOOST_GE_148], [test "$boost_major_version" -ge 148])
2b962740
RG
114AS_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])
6cedc26d 117
94ac5f34 118BOOST_PROGRAM_OPTIONS([mt])
b2ab38c3
PL
119AS_IF([test "$boost_cv_lib_program_options" = "no"], [
120 AC_MSG_ERROR([Boost Program Options library not found])
121])
fedea66a 122PDNS_ENABLE_UNIT_TESTS
662d9972 123PDNS_ENABLE_BACKEND_UNIT_TESTS
5e6a3d93 124PDNS_ENABLE_REPRODUCIBLE
af6f3d53 125PDNS_ENABLE_FUZZ_TARGETS
051f0aaa 126
13305eb1 127PDNS_WITH_SQLITE3
32869e14 128
0e2063c3 129PDNS_CHECK_VIRTUALENV
154fd082 130PDNS_FROM_GIT
e9046dbc 131
92a4978f 132dnl Checks for library functions.
290995c1
OM
133dnl the *_r functions are in posix so we can use them unconditionally, but the ext/yahttp code is
134dnl using the defines.
135AC_CHECK_FUNCS_ONCE([strcasestr localtime_r gmtime_r recvmmsg sched_setscheduler getrandom arc4random])
4ab95bea
RK
136
137AM_CONDITIONAL([HAVE_RECVMMSG], [test "x$ac_cv_func_recvmmsg" = "xyes"])
92a4978f 138
b6be1d3b
RK
139AS_IF([test "x$lt_cv_dlopen" = "xno"],
140 [AC_MSG_ERROR([Your system does not support dlopen])]
141)
142
a596b8e9 143AC_SUBST([LIBDL], [$lt_cv_dlopen_libs])
92a4978f 144
8ffe1c55 145PDNS_ENABLE_VERBOSE_LOGGING
8daea594 146PDNS_ENABLE_PKCS11
fcc4170a 147PDNS_ENABLE_GSS_TSIG
a7db8aa6 148
87ddd1b1
PL
149AC_SUBST([socketdir])
150socketdir="/var/run"
151AC_ARG_WITH([socketdir],
152 [AS_HELP_STRING([--with-socketdir], [where the controlsocket lives @<:@default=/var/run@:>@])],
153 [socketdir="$withval"]
154)
155
a7285d5a 156modules="bind gmysql random"
39653d75 157AC_ARG_WITH([modules],
8c8b9197 158 [AS_HELP_STRING([--with-modules], [which backends to compile with @<:@default=bind gmysql random@:>@])],
39653d75
RK
159 [modules="$withval"]
160)
92a4978f
BH
161
162dynmodules="pipe"
39653d75 163AC_ARG_WITH([dynmodules],
8c8b9197 164 [AS_HELP_STRING([--with-dynmodules], [which backends to build for dynamic loading @<:@default=pipe@:>@])],
39653d75
RK
165 [dynmodules="$withval"]
166)
92a4978f 167
8c8b9197
RK
168AC_SUBST([moduledirs])
169AC_SUBST([moduleobjects])
170AC_SUBST([modulelibs])
171AC_DEFINE_UNQUOTED([PDNS_MODULES], "$modules", [Built-in modules])
92a4978f 172
87ddd1b1
PL
173AS_IF([test x"$modules" = "xno"], [modules=""])
174AS_IF([test x"$dynmodules" = "xno"], [dynmodules=""])
26870de7 175
39653d75
RK
176for a in $modules $dynmodules; do
177 case "$a" in
4f983d1b
PD
178 godbc)
179 PDNS_WITH_UNIXODBC
180 ;;
6273e401 181 gmysql)
39653d75
RK
182 PDNS_WITH_MYSQL
183 ;;
184 gpgsql)
185 PDNS_WITH_POSTGRESQL
186 ;;
187 gsqlite3)
188 needsqlite3=yes
189 ;;
190 ldap)
191 PDNS_CHECK_LDAP
b63843d9 192 needldap=yes
39653d75 193 ;;
e29ece13 194 remote)
98540f9f
T
195 AS_IF([test "x$enable_unit_tests" = "xyes"],
196 [PDNS_CHECK_CURL_PROGRAM]
197 )
e29ece13
T
198 have_remotebackend=yes
199 ;;
39653d75 200 tinydns)
90fe8ae6 201 needcdb=yes
39653d75
RK
202 PDNS_CHECK_CDB
203 ;;
709ca59f
AT
204 geoip)
205 PDNS_CHECK_GEOIP
206 ;;
5cd429ec 207 lua*)
a20adc10 208 AS_IF([test "x$with_lua" = "xno"],
5cd429ec 209 [AC_MSG_ERROR([${a} backend needs lua, run ./configure --with-lua])]
a20adc10 210 )
026090e8 211 AS_IF([test "x$LUAPC" = "x"],
5cd429ec 212 [AC_MSG_ERROR([${a} backend needs lua but we cannot find it])]
a20adc10
RK
213 )
214 ;;
42f1f726 215 lmdb)
f441962a 216 needlmdb=yes
42f1f726 217 PDNS_CHECK_LMDB
218 BOOST_SERIALIZATION
219 ;;
39653d75 220 esac
92a4978f
BH
221done
222
e29ece13
T
223PDNS_ENABLE_REMOTEBACKEND_ZEROMQ
224
b488c73c 225PDNS_ENABLE_TOOLS
ca28add0 226PDNS_ENABLE_IXFRDIST
87ddd1b1
PL
227
228PDNS_WITH_PROTOBUF
229
8900e2e3 230PDNS_WITH_LUA_RECORDS
87ddd1b1 231
8c8b9197 232AM_CONDITIONAL([LDAP], [test "x$needldap" = "xyes"])
b63843d9 233
13305eb1 234PDNS_CHECK_SQLITE3
39653d75 235AM_CONDITIONAL([SQLITE3], [test "x$needsqlite3" = "xyes"])
64e3aade 236
f441962a
RG
237AM_CONDITIONAL([LMDB], [test "x$needlmdb" != "x"])
238AM_CONDITIONAL([HAVE_LMDB], [test "x$LMDB_LIBS" != "x"])
239
240AS_IF([test "x$needlmdb" = "xyes"], [
241 AS_IF([test "$with_lmdb" = "no"], [
242 AC_MSG_ERROR([--with-lmdb is set to 'no', but lmdb support is required])
243 ])
244 AS_IF([test "x$HAVE_LMDB" != "x1"], [
245 AC_MSG_ERROR([lmdb not found via pkg-config, please install lmdb or set --with-lmdb to your lmdb installation directory])
246 ])
247])
248
90fe8ae6
RG
249AM_CONDITIONAL([CDB], [test "x$needcdb" != "x"])
250AM_CONDITIONAL([HAVE_CDB], [test "x$CDB_LIBS" != "x"])
251
252AS_IF([test "x$needcdb" = "xyes"], [
253 AS_IF([test "x$HAVE_CDB" != "x1"], [
254 AC_MSG_ERROR([cdb not found via pkg-config, please install cdb])
255 ])
256])
257
39653d75 258for a in $modules; do
8a32d90d
T
259 AC_MSG_CHECKING([whether we can build module "${a}"])
260 if [[ -d "$srcdir/modules/${a}backend" ]]; then
261 AC_MSG_RESULT([yes])
262 moduledirs="$moduledirs ${a}backend"
263
264 for b in `cat $srcdir/modules/${a}backend/OBJECTFILES`; do
265 moduleobjects="$moduleobjects ../modules/${a}backend/$b"
266 done
267 modulelibs="$modulelibs `cat $srcdir/modules/${a}backend/OBJECTLIBS`"
268 else
269 AC_MSG_RESULT([no])
a59ccf7a 270 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.])
8a32d90d 271 fi
92a4978f
BH
272done
273
39653d75 274for a in $dynmodules; do
09acf546
T
275 AC_MSG_CHECKING([whether we can build dynamic module "${a}"])
276 if [[ -d "$srcdir/modules/${a}backend" ]]; then
277 AC_MSG_RESULT([yes])
278 moduledirs="$moduledirs ${a}backend"
279 else
280 AC_MSG_RESULT([no])
a59ccf7a 281 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.])
09acf546 282 fi
92a4978f
BH
283done
284
6988eae9 285AX_AVAILABLE_SYSTEMD
a3dfb540 286AX_CHECK_SYSTEMD_FEATURES
6988eae9 287AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ])
f3d65532 288 PDNS_WITH_SERVICE_USER([pdns])
6988eae9 289
3cc618c5 290LDFLAGS="$RELRO_LDFLAGS $LDFLAGS"
d6e5e940 291
b0e68161
RK
292CFLAGS="$PIE_CFLAGS $CFLAGS"
293CXXFLAGS="$PIE_CFLAGS $CXXFLAGS"
294PROGRAM_LDFLAGS="$PIE_LDFLAGS $PROGRAM_LDFLAGS"
b2053c28 295AC_SUBST([PROGRAM_LDFLAGS])
62e6530a 296
366c610a 297PDNS_ENABLE_COVERAGE
4c69af87 298PDNS_ENABLE_SANITIZERS
8f7473d7 299PDNS_ENABLE_MALLOC_TRACE
62e6530a 300
92a4978f
BH
301AC_SUBST(LIBS)
302
aa357125
RK
303AC_SUBST([AM_CPPFLAGS],
304 ["AS_ESCAPE([-I$(top_builddir) -I$(top_srcdir)]) $THREADFLAGS $BOOST_CPPFLAGS"]
305)
bf491b87 306
d4cc4c4a 307AC_SUBST([YAHTTP_CFLAGS], ['-I$(top_srcdir)/ext/yahttp'])
23448838 308AC_SUBST([YAHTTP_LIBS], ['$(top_builddir)/ext/yahttp/yahttp/libyahttp.la'])
496151cf
RG
309AC_SUBST([IPCRYPT_CFLAGS], ['-I$(top_srcdir)/ext/ipcrypt'])
310AC_SUBST([IPCRYPT_LIBS], ['$(top_builddir)/ext/ipcrypt/libipcrypt.la'])
1f974019 311
4c69af87
RK
312CXXFLAGS="$SANITIZER_FLAGS $CXXFLAGS"
313
8c8b9197 314AC_ARG_VAR(PACKAGEVERSION, [The version used in secpoll queries])
722ac035
RK
315AS_IF([test "x$PACKAGEVERSION" != "x"],
316 [AC_DEFINE_UNQUOTED([PACKAGEVERSION], "$PACKAGEVERSION", [Set to the package version used for secpoll])]
317)
318
d9a44db5 319export moduledirs moduleobjects modulelibs
e9046dbc 320
39653d75
RK
321AC_CONFIG_FILES([
322 Makefile
323 modules/Makefile
324 pdns/Makefile
325 codedocs/Makefile
21557318 326 docs/Makefile
cd42e98f 327 pdns/pdns.init
d4cc4c4a 328 ext/Makefile
496151cf 329 ext/ipcrypt/Makefile
d4cc4c4a
RK
330 ext/yahttp/Makefile
331 ext/yahttp/yahttp/Makefile
76c758c4 332 ext/json11/Makefile
39653d75 333 modules/bindbackend/Makefile
709ca59f 334 modules/geoipbackend/Makefile
39653d75 335 modules/gmysqlbackend/Makefile
4f983d1b 336 modules/godbcbackend/Makefile
39653d75
RK
337 modules/gpgsqlbackend/Makefile
338 modules/gsqlite3backend/Makefile
339 modules/ldapbackend/Makefile
42f1f726 340 modules/lmdbbackend/Makefile
63c1a37c 341 modules/lua2backend/Makefile
39653d75
RK
342 modules/pipebackend/Makefile
343 modules/randombackend/Makefile
344 modules/remotebackend/Makefile
345 modules/tinydnsbackend/Makefile
346])
6867a5ad 347AC_OUTPUT
39653d75 348
06d0f550
RK
349AC_MSG_NOTICE([])
350AC_MSG_NOTICE([Configuration summary])
351AC_MSG_NOTICE([=====================])
352AC_MSG_NOTICE([])
b43b4a67 353AC_MSG_NOTICE([Configured with: $pdns_configure_args])
80b2fad2 354AC_MSG_NOTICE([])
06d0f550
RK
355AC_MSG_NOTICE([CC: $CC])
356AC_MSG_NOTICE([CXX: $CXX])
357AC_MSG_NOTICE([LD: $LD])
358AC_MSG_NOTICE([CFLAGS: $CFLAGS])
359AC_MSG_NOTICE([CPPFLAGS: $CPPFLAGS])
360AC_MSG_NOTICE([CXXFLAGS: $CXXFLAGS])
361AC_MSG_NOTICE([LDFLAGS: $LDFLAGS])
ea80a933 362AC_MSG_NOTICE([LIBS: $LIBS])
19cedc4b 363AC_MSG_NOTICE([BOOST_CPPFLAGS: $BOOST_CPPFLAGS])
19cedc4b 364AC_MSG_NOTICE([])
b8fa2bf2
PL
365AC_MSG_NOTICE([Extras enabled])
366AC_MSG_NOTICE([--------------])
367AS_IF([test "x$enable_tools" = "xyes"],
368 [AC_MSG_NOTICE([Tools: yes])],
369 [AC_MSG_NOTICE([Tools: no])]
370)
371AS_IF([test "x$enable_ixfrdist" = "xyes"],
372 [AC_MSG_NOTICE([ixfrdist: yes])],
373 [AC_MSG_NOTICE([ixfrdist: no])]
374)
375AC_MSG_NOTICE([])
376AC_MSG_NOTICE([Server Features enabled])
377AC_MSG_NOTICE([-----------------------])
b43b4a67
PL
378AC_MSG_NOTICE([Built-in modules: $modules])
379AC_MSG_NOTICE([Dynamic modules: $dynmodules])
380AC_MSG_NOTICE([])
8189c881 381AS_IF([test "x$libcrypto_ecdsa" = "xyes"],
b43b4a67
PL
382 [AC_MSG_NOTICE([OpenSSL ecdsa: yes])],
383 [AC_MSG_NOTICE([OpenSSL ecdsa: no])]
de4e1d0d 384)
439974d7 385AS_IF([test "x$LIBSODIUM_LIBS" != "x" || test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed25519" = "xyes"],
21a8834a
KM
386 [AC_MSG_NOTICE([ed25519: yes])],
387 [AC_MSG_NOTICE([ed25519: no])]
388)
439974d7 389AS_IF([test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed448" = "xyes"],
21a8834a
KM
390 [AC_MSG_NOTICE([ed448: yes])],
391 [AC_MSG_NOTICE([ed448: no])]
a613e8b6 392)
786d771e 393AS_IF([test "x$needsqlite3" != "x"],
b43b4a67
PL
394 [AC_MSG_NOTICE([SQLite3: yes])],
395 [AC_MSG_NOTICE([SQLite3: no])]
786d771e 396)
c92ada53 397AS_IF([test "x$LUAPC" != "x"],
b43b4a67
PL
398 [AC_MSG_NOTICE([Lua: $LUAPC])],
399 [AS_IF([test "x$LUAJITPC" != "x"],
400 [AC_MSG_NOTICE([LuaJit: $LUAJITPC])],
401 [AC_MSG_NOTICE([Lua/LuaJit: no])])
402])
91bc549f
PL
403AS_IF([test "x$enable_experimental_pkcs11" = "xyes"],
404 [AC_MSG_NOTICE([PKCS-11: yes])]
405)
df27c113 406AS_IF([test "x$enable_experimental_gss_tsig" = "xyes"],
b43b4a67
PL
407 [AC_MSG_NOTICE([GSS-TSIG: yes])]
408)
b8fa2bf2
PL
409AS_IF([test "x$enable_lua_records" = "xyes"],
410 [AC_MSG_NOTICE([LUA records: yes])]
411)
b43b4a67
PL
412AS_IF([test "x$systemd" != "xn"],
413 [AC_MSG_NOTICE([systemd: yes])],
414 [AC_MSG_NOTICE([systemd: no])]
415)
416AS_IF([test "x$enable_remotebackend_zeromq" != "xno"],
417 [AC_MSG_NOTICE([ZeroMQ connector for remotebackend: yes])]
fcc4170a 418)
b8fa2bf2
PL
419AS_IF([test -n "$GEOIP_LIBS"],
420 [AC_MSG_NOTICE([libgeoip for geoipbackend: yes])]
421)
422AS_IF([test -n "$MMDB_LIBS"],
423 [AC_MSG_NOTICE([libmaxminddb for geoipbackend: yes])]
424)
06d0f550 425AC_MSG_NOTICE([])