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