]> git.ipfire.org Git - thirdparty/pdns.git/blob - configure.ac
Merge pull request #7227 from Annih/auth-geoip-non-zero-weight
[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 : ${CFLAGS="-Wall -g -O2"}
21 : ${CXXFLAGS="-Wall -g -O2"}
22
23 AC_PROG_CC
24 AM_PROG_CC_C_O
25 PDNS_CHECK_BISON
26 PDNS_CHECK_FLEX
27 AC_PROG_INSTALL
28 AC_PROG_MAKE_SET
29
30 AC_PROG_CXX
31 AS_IF([test "x$CXX" = "xno" || test "x$CXX:x$GXX" = "xg++:x"],
32 [AC_MSG_ERROR([no C++ compiler found])]
33 )
34
35 AC_LANG([C++])
36
37 AC_DEFINE([_GNU_SOURCE], [1],
38 [Define _GNU_SOURCE so that we get all necessary prototypes]
39 )
40
41 # Warn when pkg.m4 is missing
42 m4_pattern_forbid([^_?PKG_[A-Z_]+$], [*** pkg.m4 missing, please install pkg-config])
43
44 PDNS_CHECK_OS
45 PTHREAD_SET_NAME
46
47 PDNS_WITH_LUA
48 PDNS_CHECK_LUA_HPP
49
50 AX_CXX_COMPILE_STDCXX_11
51
52 AC_MSG_CHECKING([whether we will enable compiler security checks])
53 AC_ARG_ENABLE([hardening],
54 [AS_HELP_STRING([--disable-hardening], [disable compiler security checks @<:@default=no@:>@])],
55 [enable_hardening=$enableval],
56 [enable_hardening=yes]
57 )
58 AC_MSG_RESULT([$enable_hardening])
59
60 AS_IF([test "x$enable_hardening" != "xno"], [
61 AC_CC_PIE
62 AC_CC_STACK_PROTECTOR
63 AC_CC_PARAM_SSP_BUFFER_SIZE([4])
64 AC_CC_D_FORTIFY_SOURCE
65 AC_LD_RELRO
66 ])
67
68 PDNS_ENABLE_KISS
69
70 PDNS_CHECK_NETWORK_LIBS
71
72 LT_PREREQ([2.2.2])
73 LT_INIT([disable-static dlopen])
74
75
76 MC_TM_GMTOFF
77
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.
81 eval full_libdir="\"$libdir\""
82
83 # detect pkg-config explicitly
84 PKG_PROG_PKG_CONFIG
85
86 AC_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
96 PDNS_WITH_LIBSODIUM
97 PDNS_WITH_LIBDECAF
98 PDNS_CHECK_LIBCRYPTO([
99 ],[
100 AC_MSG_ERROR([OpenSSL/libcrypto not found])
101 ]
102 )
103 PDNS_CHECK_LIBCRYPTO_ECDSA
104 PDNS_CHECK_LIBCRYPTO_EDDSA
105
106 PDNS_CHECK_RAGEL([pdns/dnslabeltext.cc], [www.powerdns.com])
107 PDNS_CHECK_CLOCK_GETTIME
108
109 BOOST_REQUIRE([1.35])
110 # Boost accumulators, as used by dnsbulktest and dnstcpbench, need 1.48+
111 # to be compatible with C++11
112 AM_CONDITIONAL([HAVE_BOOST_GE_148], [test "$boost_major_version" -ge 148])
113
114 BOOST_PROGRAM_OPTIONS([mt])
115 AS_IF([test "$boost_cv_lib_program_options" = "no"], [
116 AC_MSG_ERROR([Boost Program Options library not found])
117 ])
118 PDNS_ENABLE_UNIT_TESTS
119 PDNS_ENABLE_BACKEND_UNIT_TESTS
120 PDNS_ENABLE_REPRODUCIBLE
121 PDNS_ENABLE_FUZZ_TARGETS
122
123 PDNS_WITH_SQLITE3
124
125 PDNS_CHECK_VIRTUALENV
126 PDNS_FROM_GIT
127
128 dnl Checks for library functions.
129 AC_CHECK_FUNCS_ONCE([strcasestr localtime_r recvmmsg getrandom arc4random])
130
131 AM_CONDITIONAL([HAVE_RECVMMSG], [test "x$ac_cv_func_recvmmsg" = "xyes"])
132
133 AS_IF([test "x$lt_cv_dlopen" = "xno"],
134 [AC_MSG_ERROR([Your system does not support dlopen])]
135 )
136
137 AC_SUBST([LIBDL], [$lt_cv_dlopen_libs])
138
139 PDNS_ENABLE_VERBOSE_LOGGING
140 PDNS_ENABLE_PKCS11
141 PDNS_ENABLE_GSS_TSIG
142
143 AC_SUBST([socketdir])
144 socketdir="/var/run"
145 AC_ARG_WITH([socketdir],
146 [AS_HELP_STRING([--with-socketdir], [where the controlsocket lives @<:@default=/var/run@:>@])],
147 [socketdir="$withval"]
148 )
149
150 modules="bind gmysql random"
151 AC_ARG_WITH([modules],
152 [AS_HELP_STRING([--with-modules], [which backends to compile with @<:@default=bind gmysql random@:>@])],
153 [modules="$withval"]
154 )
155
156 dynmodules="pipe"
157 AC_ARG_WITH([dynmodules],
158 [AS_HELP_STRING([--with-dynmodules], [which backends to build for dynamic loading @<:@default=pipe@:>@])],
159 [dynmodules="$withval"]
160 )
161
162 AC_SUBST([moduledirs])
163 AC_SUBST([moduleobjects])
164 AC_SUBST([modulelibs])
165 AC_DEFINE_UNQUOTED([PDNS_MODULES], "$modules", [Built-in modules])
166
167 AS_IF([test x"$modules" = "xno"], [modules=""])
168 AS_IF([test x"$dynmodules" = "xno"], [dynmodules=""])
169
170 for a in $modules $dynmodules; do
171 case "$a" in
172 oracle|goracle)
173 PDNS_WITH_ORACLE
174 needoracle=yes
175 ;;
176 godbc)
177 PDNS_WITH_UNIXODBC
178 ;;
179 mydns|gmysql|pdns)
180 PDNS_WITH_MYSQL
181 ;;
182 gpgsql)
183 PDNS_WITH_POSTGRESQL
184 ;;
185 gsqlite3)
186 needsqlite3=yes
187 ;;
188 ldap)
189 PDNS_CHECK_LDAP
190 needldap=yes
191 ;;
192 opendbx)
193 PDNS_CHECK_OPENDBX
194 ;;
195 remote)
196 AS_IF([test "x$enable_unit_tests" = "xyes"],
197 [PDNS_CHECK_CURL_PROGRAM]
198 )
199 have_remotebackend=yes
200 ;;
201 tinydns)
202 PDNS_CHECK_CDB
203 ;;
204 geoip)
205 PDNS_CHECK_GEOIP
206 ;;
207 lua*)
208 AS_IF([test "x$with_lua" = "xno"],
209 [AC_MSG_ERROR([${a} backend needs lua, run ./configure --with-lua])]
210 )
211 AS_IF([test "x$LUAPC" = "x"],
212 [AC_MSG_ERROR([${a} backend needs lua but we cannot find it])]
213 )
214 ;;
215 esac
216 done
217
218 PDNS_ENABLE_REMOTEBACKEND_ZEROMQ
219
220 AC_MSG_CHECKING([whether we will be building and installing the extra tools])
221 AC_ARG_ENABLE([tools],
222 [AS_HELP_STRING([--enable-tools], [if we should build and install the tools @<:@default=no@:>@])],
223 [enable_tools=$enableval],
224 [enable_tools=no]
225 )
226
227 AC_MSG_RESULT([$enable_tools])
228 AM_CONDITIONAL([TOOLS], [test "x$enable_tools" != "xno"])
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 AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ])
271
272 LDFLAGS="$RELRO_LDFLAGS $LDFLAGS"
273
274 CFLAGS="$PIE_CFLAGS $CFLAGS"
275 CXXFLAGS="$PIE_CFLAGS $CXXFLAGS"
276 PROGRAM_LDFLAGS="$PIE_LDFLAGS $PROGRAM_LDFLAGS"
277 AC_SUBST([PROGRAM_LDFLAGS])
278
279 PDNS_ENABLE_COVERAGE
280 PDNS_ENABLE_SANITIZERS
281 PDNS_ENABLE_MALLOC_TRACE
282
283 AC_SUBST(LIBS)
284
285 AC_SUBST([AM_CPPFLAGS],
286 ["AS_ESCAPE([-I$(top_builddir) -I$(top_srcdir)]) $THREADFLAGS $BOOST_CPPFLAGS"]
287 )
288
289 AC_SUBST([YAHTTP_CFLAGS], ['-I$(top_srcdir)/ext/yahttp'])
290 AC_SUBST([YAHTTP_LIBS], ['$(top_builddir)/ext/yahttp/yahttp/libyahttp.la'])
291
292 CXXFLAGS="$SANITIZER_FLAGS $CXXFLAGS"
293
294 AC_ARG_VAR(PACKAGEVERSION, [The version used in secpoll queries])
295 AS_IF([test "x$PACKAGEVERSION" != "x"],
296 [AC_DEFINE_UNQUOTED([PACKAGEVERSION], "$PACKAGEVERSION", [Set to the package version used for secpoll])]
297 )
298
299 export moduledirs moduleobjects modulelibs
300
301 AC_CONFIG_FILES([
302 Makefile
303 modules/Makefile
304 pdns/Makefile
305 codedocs/Makefile
306 docs/Makefile
307 pdns/pdns.init
308 ext/Makefile
309 ext/yahttp/Makefile
310 ext/yahttp/yahttp/Makefile
311 ext/json11/Makefile
312 modules/bindbackend/Makefile
313 modules/geoipbackend/Makefile
314 modules/gmysqlbackend/Makefile
315 modules/godbcbackend/Makefile
316 modules/goraclebackend/Makefile
317 modules/gpgsqlbackend/Makefile
318 modules/gsqlite3backend/Makefile
319 modules/ldapbackend/Makefile
320 modules/luabackend/Makefile
321 modules/lua2backend/Makefile
322 modules/mydnsbackend/Makefile
323 modules/opendbxbackend/Makefile
324 modules/oraclebackend/Makefile
325 modules/pipebackend/Makefile
326 modules/randombackend/Makefile
327 modules/remotebackend/Makefile
328 modules/tinydnsbackend/Makefile
329 ])
330 AC_OUTPUT
331
332 AC_MSG_NOTICE([])
333 AC_MSG_NOTICE([Configuration summary])
334 AC_MSG_NOTICE([=====================])
335 AC_MSG_NOTICE([])
336 AC_MSG_NOTICE([Configured with: $pdns_configure_args])
337 AC_MSG_NOTICE([])
338 AC_MSG_NOTICE([CC: $CC])
339 AC_MSG_NOTICE([CXX: $CXX])
340 AC_MSG_NOTICE([LD: $LD])
341 AC_MSG_NOTICE([CFLAGS: $CFLAGS])
342 AC_MSG_NOTICE([CPPFLAGS: $CPPFLAGS])
343 AC_MSG_NOTICE([CXXFLAGS: $CXXFLAGS])
344 AC_MSG_NOTICE([LDFLAGS: $LDFLAGS])
345 AC_MSG_NOTICE([LIBS: $LIBS])
346 AC_MSG_NOTICE([BOOST_CPPFLAGS: $BOOST_CPPFLAGS])
347 AC_MSG_NOTICE([])
348 AC_MSG_NOTICE([Features enabled])
349 AC_MSG_NOTICE([----------------])
350 AC_MSG_NOTICE([Built-in modules: $modules])
351 AC_MSG_NOTICE([Dynamic modules: $dynmodules])
352 AC_MSG_NOTICE([])
353 AS_IF([test "x$libcrypto_ecdsa" = "xyes"],
354 [AC_MSG_NOTICE([OpenSSL ecdsa: yes])],
355 [AC_MSG_NOTICE([OpenSSL ecdsa: no])]
356 )
357 AS_IF([test "x$LIBSODIUM_LIBS" != "x" || test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed25519" = "xyes"],
358 [AC_MSG_NOTICE([ed25519: yes])],
359 [AC_MSG_NOTICE([ed25519: no])]
360 )
361 AS_IF([test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed448" = "xyes"],
362 [AC_MSG_NOTICE([ed448: yes])],
363 [AC_MSG_NOTICE([ed448: no])]
364 )
365 AS_IF([test "x$needsqlite3" != "x"],
366 [AC_MSG_NOTICE([SQLite3: yes])],
367 [AC_MSG_NOTICE([SQLite3: no])]
368 )
369 AS_IF([test "x$LUAPC" != "x"],
370 [AC_MSG_NOTICE([Lua: $LUAPC])],
371 [AS_IF([test "x$LUAJITPC" != "x"],
372 [AC_MSG_NOTICE([LuaJit: $LUAJITPC])],
373 [AC_MSG_NOTICE([Lua/LuaJit: no])])
374 ])
375 AS_IF([test "x$enable_experimental_pkcs11" = "xyes"],
376 [AC_MSG_NOTICE([PKCS-11: yes])]
377 )
378 AS_IF([test "x$enable_experimental_gss_tsig" = "xyes"],
379 [AC_MSG_NOTICE([GSS-TSIG: yes])]
380 )
381 AS_IF([test "x$systemd" != "xn"],
382 [AC_MSG_NOTICE([systemd: yes])],
383 [AC_MSG_NOTICE([systemd: no])]
384 )
385 AS_IF([test "x$enable_remotebackend_zeromq" != "xno"],
386 [AC_MSG_NOTICE([ZeroMQ connector for remotebackend: yes])]
387 )
388 AC_MSG_NOTICE([])