]> git.ipfire.org Git - thirdparty/pdns.git/blame - configure.ac
Merge pull request #6642 from rgacogne/rec41-fix-error-string
[thirdparty/pdns.git] / configure.ac
CommitLineData
39653d75
RK
1AC_PREREQ([2.61])
2
8c8b9197 3AC_INIT([pdns], m4_esyscmd([build-aux/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
46a09ebd 20: ${CFLAGS="-Wall -g -O2"}
5801cd92 21: ${CXXFLAGS="-Wall -g -O2"}
39653d75 22
92a4978f 23AC_PROG_CC
dd50be34 24AM_PROG_CC_C_O
44362487 25PDNS_CHECK_BISON
33086d97 26PDNS_CHECK_FLEX
92a4978f
BH
27AC_PROG_INSTALL
28AC_PROG_MAKE_SET
26870de7 29
27a4e655
RK
30AC_PROG_CXX
31AS_IF([test "x$CXX" = "xno" || test "x$CXX:x$GXX" = "xg++:x"],
32 AC_MSG_ERROR([no C++ compiler found])
33)
34
66da2833 35AC_LANG([C++])
92a4978f 36
f33c1fff
RK
37AC_DEFINE([_GNU_SOURCE], [1],
38 [Define _GNU_SOURCE so that we get all necessary prototypes]
39)
40
ad313e37 41# Warn when pkg.m4 is missing
8c8b9197 42m4_pattern_forbid([^_?PKG_[A-Z_]+$], [*** pkg.m4 missing, please install pkg-config])
ad313e37 43
03571f7a
PL
44PDNS_CHECK_OS
45
4f6c5ee6
RK
46PDNS_WITH_LUAJIT
47AS_IF([test "x$with_luajit" = "xno"], [
48 PDNS_WITH_LUA
49])
9a927586 50PDNS_CHECK_LUA_HPP
4f6c5ee6 51
8c8b9197 52AX_CXX_COMPILE_STDCXX_11
0b61c633
T
53
54AC_MSG_CHECKING([whether we will enable compiler security checks])
55AC_ARG_ENABLE([hardening],
8c8b9197 56 [AS_HELP_STRING([--disable-hardening], [disable compiler security checks @<:@default=no@:>@])],
0b61c633
T
57 [enable_hardening=$enableval],
58 [enable_hardening=yes]
59)
60AC_MSG_RESULT([$enable_hardening])
61
c77252b6
RK
62AS_IF([test "x$enable_hardening" != "xno"], [
63 AC_CC_PIE
64 AC_CC_STACK_PROTECTOR
65 AC_CC_PARAM_SSP_BUFFER_SIZE([4])
66 AC_CC_D_FORTIFY_SOURCE
67 AC_LD_RELRO
68])
d6e5e940 69
020b39f3 70PDNS_CHECK_NETWORK_LIBS
9d44a523 71
28bb0d13 72LT_PREREQ([2.2.2])
a596b8e9 73LT_INIT([disable-static dlopen])
59414d0e 74
d6e5e940 75
96ae9a2e
KM
76MC_TM_GMTOFF
77
0949b8ae
CH
78# Define full_libdir to be the fully expanded (${exec_prefix}, etc.)
79# "system" library path.
80# We use this to search for other libraries.
81eval full_libdir="\"$libdir\""
39653d75 82
27fe16bd
RK
83# detect pkg-config explicitly
84PKG_PROG_PKG_CONFIG
85
709ca59f
AT
86AC_CHECK_HEADERS(
87 [sys/mman.h],
88 [AC_CHECK_FUNC(
89 [mmap],
90 [AC_DEFINE(HAVE_MMAP, [1], [Define to 1 if you have mmap])],
91 [have_mmap=no]
92 )],
93 [have_mmap=no]
94)
95
df85a9a0 96PDNS_ENABLE_BOTAN
df85a9a0 97PDNS_CHECK_LIBSODIUM
21a8834a 98PDNS_CHECK_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
1d026a23 105
29e13421 106PDNS_CHECK_RAGEL([pdns/dnslabeltext.cc], [www.powerdns.com])
bcd17c71 107PDNS_CHECK_CLOCK_GETTIME
d81a3e14 108
94ac5f34 109BOOST_REQUIRE([1.35])
6cedc26d
RG
110# Boost accumulators, as used by dnsbulktest and dnstcpbench, need 1.48+
111# to be compatible with C++11
112AM_CONDITIONAL([HAVE_BOOST_GE_148], [test "$boost_major_version" -ge 148])
113
94ac5f34 114BOOST_PROGRAM_OPTIONS([mt])
b2ab38c3
PL
115AS_IF([test "$boost_cv_lib_program_options" = "no"], [
116 AC_MSG_ERROR([Boost Program Options library not found])
117])
fedea66a 118PDNS_ENABLE_UNIT_TESTS
5e6a3d93 119PDNS_ENABLE_REPRODUCIBLE
051f0aaa 120
13305eb1 121PDNS_WITH_SQLITE3
32869e14 122
0e2063c3 123PDNS_CHECK_VIRTUALENV
154fd082 124PDNS_FROM_GIT
e9046dbc 125
92a4978f 126dnl Checks for library functions.
4ab95bea
RK
127AC_CHECK_FUNCS_ONCE([strcasestr localtime_r recvmmsg])
128
129AM_CONDITIONAL([HAVE_RECVMMSG], [test "x$ac_cv_func_recvmmsg" = "xyes"])
92a4978f 130
b6be1d3b
RK
131AS_IF([test "x$lt_cv_dlopen" = "xno"],
132 [AC_MSG_ERROR([Your system does not support dlopen])]
133)
134
a596b8e9 135AC_SUBST([LIBDL], [$lt_cv_dlopen_libs])
92a4978f 136
8ffe1c55 137PDNS_ENABLE_VERBOSE_LOGGING
8daea594 138PDNS_ENABLE_PKCS11
fcc4170a 139PDNS_ENABLE_GSS_TSIG
a7db8aa6 140
87ddd1b1
PL
141AC_SUBST([socketdir])
142socketdir="/var/run"
143AC_ARG_WITH([socketdir],
144 [AS_HELP_STRING([--with-socketdir], [where the controlsocket lives @<:@default=/var/run@:>@])],
145 [socketdir="$withval"]
146)
147
a7285d5a 148modules="bind gmysql random"
39653d75 149AC_ARG_WITH([modules],
8c8b9197 150 [AS_HELP_STRING([--with-modules], [which backends to compile with @<:@default=bind gmysql random@:>@])],
39653d75
RK
151 [modules="$withval"]
152)
92a4978f
BH
153
154dynmodules="pipe"
39653d75 155AC_ARG_WITH([dynmodules],
8c8b9197 156 [AS_HELP_STRING([--with-dynmodules], [which backends to build for dynamic loading @<:@default=pipe@:>@])],
39653d75
RK
157 [dynmodules="$withval"]
158)
92a4978f 159
8c8b9197
RK
160AC_SUBST([moduledirs])
161AC_SUBST([moduleobjects])
162AC_SUBST([modulelibs])
163AC_DEFINE_UNQUOTED([PDNS_MODULES], "$modules", [Built-in modules])
92a4978f 164
87ddd1b1
PL
165AS_IF([test x"$modules" = "xno"], [modules=""])
166AS_IF([test x"$dynmodules" = "xno"], [dynmodules=""])
26870de7 167
39653d75
RK
168for a in $modules $dynmodules; do
169 case "$a" in
170 oracle|goracle)
171 PDNS_WITH_ORACLE
172 needoracle=yes
173 ;;
4f983d1b
PD
174 godbc)
175 PDNS_WITH_UNIXODBC
176 ;;
39653d75
RK
177 mydns|gmysql|pdns)
178 PDNS_WITH_MYSQL
179 ;;
180 gpgsql)
181 PDNS_WITH_POSTGRESQL
182 ;;
183 gsqlite3)
184 needsqlite3=yes
185 ;;
186 ldap)
187 PDNS_CHECK_LDAP
b63843d9 188 needldap=yes
39653d75
RK
189 ;;
190 opendbx)
191 PDNS_CHECK_OPENDBX
192 ;;
e29ece13 193 remote)
98540f9f
T
194 AS_IF([test "x$enable_unit_tests" = "xyes"],
195 [PDNS_CHECK_CURL_PROGRAM]
196 )
e29ece13
T
197 have_remotebackend=yes
198 ;;
39653d75
RK
199 tinydns)
200 PDNS_CHECK_CDB
201 ;;
709ca59f
AT
202 geoip)
203 PDNS_CHECK_GEOIP
204 ;;
a20adc10
RK
205 lua)
206 AS_IF([test "x$with_lua" = "xno"],
207 AC_MSG_ERROR([Lua backend needs lua, run ./configure --with-lua])
208 )
2734e143 209 AS_IF([test "x$LUAPC" = "x" -a "x$LUAJITPC" = "x"],
a20adc10
RK
210 AC_MSG_ERROR([Lua backend needs lua but we cannot find it])
211 )
212 ;;
39653d75 213 esac
92a4978f
BH
214done
215
e29ece13
T
216PDNS_ENABLE_REMOTEBACKEND_ZEROMQ
217
87ddd1b1
PL
218AC_MSG_CHECKING([whether we will be building and installing the extra tools])
219AC_ARG_ENABLE([tools],
220 [AS_HELP_STRING([--enable-tools], [if we should build and install the tools @<:@default=no@:>@])],
221 [enable_tools=$enableval],
222 [enable_tools=no]
223)
224
225AC_MSG_RESULT([$enable_tools])
226AM_CONDITIONAL([TOOLS], [test "x$enable_tools" != "xno"])
227
228PDNS_WITH_PROTOBUF
229
230
8c8b9197 231AM_CONDITIONAL([ORACLE], [test "x$needoracle" = "xyes"])
39653d75 232
8c8b9197 233AM_CONDITIONAL([LDAP], [test "x$needldap" = "xyes"])
b63843d9 234
13305eb1 235PDNS_CHECK_SQLITE3
39653d75 236AM_CONDITIONAL([SQLITE3], [test "x$needsqlite3" = "xyes"])
64e3aade 237
39653d75 238for a in $modules; do
8a32d90d
T
239 AC_MSG_CHECKING([whether we can build module "${a}"])
240 if [[ -d "$srcdir/modules/${a}backend" ]]; then
241 AC_MSG_RESULT([yes])
242 moduledirs="$moduledirs ${a}backend"
243
244 for b in `cat $srcdir/modules/${a}backend/OBJECTFILES`; do
245 moduleobjects="$moduleobjects ../modules/${a}backend/$b"
246 done
247 modulelibs="$modulelibs `cat $srcdir/modules/${a}backend/OBJECTLIBS`"
248 else
249 AC_MSG_RESULT([no])
a59ccf7a 250 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 251 fi
92a4978f
BH
252done
253
39653d75 254for a in $dynmodules; do
09acf546
T
255 AC_MSG_CHECKING([whether we can build dynamic module "${a}"])
256 if [[ -d "$srcdir/modules/${a}backend" ]]; then
257 AC_MSG_RESULT([yes])
258 moduledirs="$moduledirs ${a}backend"
259 else
260 AC_MSG_RESULT([no])
a59ccf7a 261 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 262 fi
92a4978f
BH
263done
264
6988eae9
PL
265AX_AVAILABLE_SYSTEMD
266AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ])
267
3cc618c5 268LDFLAGS="$RELRO_LDFLAGS $LDFLAGS"
d6e5e940 269
b0e68161
RK
270CFLAGS="$PIE_CFLAGS $CFLAGS"
271CXXFLAGS="$PIE_CFLAGS $CXXFLAGS"
272PROGRAM_LDFLAGS="$PIE_LDFLAGS $PROGRAM_LDFLAGS"
b2053c28 273AC_SUBST([PROGRAM_LDFLAGS])
62e6530a 274
366c610a 275PDNS_ENABLE_COVERAGE
4c69af87 276PDNS_ENABLE_SANITIZERS
8f7473d7 277PDNS_ENABLE_MALLOC_TRACE
62e6530a 278
92a4978f
BH
279AC_SUBST(LIBS)
280
aa357125
RK
281AC_SUBST([AM_CPPFLAGS],
282 ["AS_ESCAPE([-I$(top_builddir) -I$(top_srcdir)]) $THREADFLAGS $BOOST_CPPFLAGS"]
283)
bf491b87 284
d4cc4c4a 285AC_SUBST([YAHTTP_CFLAGS], ['-I$(top_srcdir)/ext/yahttp'])
23448838 286AC_SUBST([YAHTTP_LIBS], ['$(top_builddir)/ext/yahttp/yahttp/libyahttp.la'])
1f974019 287
4c69af87
RK
288CXXFLAGS="$SANITIZER_FLAGS $CXXFLAGS"
289
8c8b9197 290AC_ARG_VAR(PACKAGEVERSION, [The version used in secpoll queries])
722ac035
RK
291AS_IF([test "x$PACKAGEVERSION" != "x"],
292 [AC_DEFINE_UNQUOTED([PACKAGEVERSION], "$PACKAGEVERSION", [Set to the package version used for secpoll])]
293)
294
d9a44db5 295export moduledirs moduleobjects modulelibs
e9046dbc 296
39653d75
RK
297AC_CONFIG_FILES([
298 Makefile
299 modules/Makefile
300 pdns/Makefile
301 codedocs/Makefile
21557318 302 docs/Makefile
cd42e98f 303 pdns/pdns.init
d4cc4c4a 304 ext/Makefile
d4cc4c4a
RK
305 ext/yahttp/Makefile
306 ext/yahttp/yahttp/Makefile
76c758c4 307 ext/json11/Makefile
39653d75 308 modules/bindbackend/Makefile
709ca59f 309 modules/geoipbackend/Makefile
39653d75 310 modules/gmysqlbackend/Makefile
4f983d1b 311 modules/godbcbackend/Makefile
39653d75
RK
312 modules/goraclebackend/Makefile
313 modules/gpgsqlbackend/Makefile
314 modules/gsqlite3backend/Makefile
315 modules/ldapbackend/Makefile
316 modules/luabackend/Makefile
317 modules/mydnsbackend/Makefile
318 modules/opendbxbackend/Makefile
319 modules/oraclebackend/Makefile
320 modules/pipebackend/Makefile
321 modules/randombackend/Makefile
322 modules/remotebackend/Makefile
323 modules/tinydnsbackend/Makefile
324])
6867a5ad 325AC_OUTPUT
39653d75 326
06d0f550
RK
327AC_MSG_NOTICE([])
328AC_MSG_NOTICE([Configuration summary])
329AC_MSG_NOTICE([=====================])
330AC_MSG_NOTICE([])
b43b4a67 331AC_MSG_NOTICE([Configured with: $pdns_configure_args])
80b2fad2 332AC_MSG_NOTICE([])
06d0f550
RK
333AC_MSG_NOTICE([CC: $CC])
334AC_MSG_NOTICE([CXX: $CXX])
335AC_MSG_NOTICE([LD: $LD])
336AC_MSG_NOTICE([CFLAGS: $CFLAGS])
337AC_MSG_NOTICE([CPPFLAGS: $CPPFLAGS])
338AC_MSG_NOTICE([CXXFLAGS: $CXXFLAGS])
339AC_MSG_NOTICE([LDFLAGS: $LDFLAGS])
ea80a933 340AC_MSG_NOTICE([LIBS: $LIBS])
19cedc4b 341AC_MSG_NOTICE([BOOST_CPPFLAGS: $BOOST_CPPFLAGS])
19cedc4b 342AC_MSG_NOTICE([])
b43b4a67
PL
343AC_MSG_NOTICE([Features enabled])
344AC_MSG_NOTICE([----------------])
345AC_MSG_NOTICE([Built-in modules: $modules])
346AC_MSG_NOTICE([Dynamic modules: $dynmodules])
347AC_MSG_NOTICE([])
8189c881 348AS_IF([test "x$libcrypto_ecdsa" = "xyes"],
b43b4a67
PL
349 [AC_MSG_NOTICE([OpenSSL ecdsa: yes])],
350 [AC_MSG_NOTICE([OpenSSL ecdsa: no])]
de4e1d0d 351)
21a8834a
KM
352AS_IF([test "x$LIBSODIUM_LIBS" != "x" || test "x$LIBDECAF_LIBS" != "x"],
353 [AC_MSG_NOTICE([ed25519: yes])],
354 [AC_MSG_NOTICE([ed25519: no])]
355)
356AS_IF([test "x$LIBDECAF_LIBS" != "x"],
357 [AC_MSG_NOTICE([ed448: yes])],
358 [AC_MSG_NOTICE([ed448: no])]
a613e8b6 359)
13f34f2e
RG
360AS_IF([test "x$BOTAN_LIBS" != "x"],
361 [AC_MSG_NOTICE([gost: yes])],
362 [AC_MSG_NOTICE([gost: no])]
363)
786d771e 364AS_IF([test "x$needsqlite3" != "x"],
b43b4a67
PL
365 [AC_MSG_NOTICE([SQLite3: yes])],
366 [AC_MSG_NOTICE([SQLite3: no])]
786d771e 367)
c92ada53 368AS_IF([test "x$LUAPC" != "x"],
b43b4a67
PL
369 [AC_MSG_NOTICE([Lua: $LUAPC])],
370 [AS_IF([test "x$LUAJITPC" != "x"],
371 [AC_MSG_NOTICE([LuaJit: $LUAJITPC])],
372 [AC_MSG_NOTICE([Lua/LuaJit: no])])
373])
91bc549f
PL
374AS_IF([test "x$enable_experimental_pkcs11" = "xyes"],
375 [AC_MSG_NOTICE([PKCS-11: yes])]
376)
df27c113 377AS_IF([test "x$enable_experimental_gss_tsig" = "xyes"],
b43b4a67
PL
378 [AC_MSG_NOTICE([GSS-TSIG: yes])]
379)
380AS_IF([test "x$systemd" != "xn"],
381 [AC_MSG_NOTICE([systemd: yes])],
382 [AC_MSG_NOTICE([systemd: no])]
383)
384AS_IF([test "x$enable_remotebackend_zeromq" != "xno"],
385 [AC_MSG_NOTICE([ZeroMQ connector for remotebackend: yes])]
fcc4170a 386)
06d0f550 387AC_MSG_NOTICE([])