]> git.ipfire.org Git - thirdparty/pdns.git/blob - configure.ac
Merge pull request #7241 from Habbie/rec-build-docs
[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
122 PDNS_WITH_SQLITE3
123
124 PDNS_CHECK_VIRTUALENV
125 PDNS_FROM_GIT
126
127 dnl Checks for library functions.
128 AC_CHECK_FUNCS_ONCE([strcasestr localtime_r recvmmsg getrandom arc4random])
129
130 AM_CONDITIONAL([HAVE_RECVMMSG], [test "x$ac_cv_func_recvmmsg" = "xyes"])
131
132 AS_IF([test "x$lt_cv_dlopen" = "xno"],
133 [AC_MSG_ERROR([Your system does not support dlopen])]
134 )
135
136 AC_SUBST([LIBDL], [$lt_cv_dlopen_libs])
137
138 PDNS_ENABLE_VERBOSE_LOGGING
139 PDNS_ENABLE_PKCS11
140 PDNS_ENABLE_GSS_TSIG
141
142 AC_SUBST([socketdir])
143 socketdir="/var/run"
144 AC_ARG_WITH([socketdir],
145 [AS_HELP_STRING([--with-socketdir], [where the controlsocket lives @<:@default=/var/run@:>@])],
146 [socketdir="$withval"]
147 )
148
149 modules="bind gmysql random"
150 AC_ARG_WITH([modules],
151 [AS_HELP_STRING([--with-modules], [which backends to compile with @<:@default=bind gmysql random@:>@])],
152 [modules="$withval"]
153 )
154
155 dynmodules="pipe"
156 AC_ARG_WITH([dynmodules],
157 [AS_HELP_STRING([--with-dynmodules], [which backends to build for dynamic loading @<:@default=pipe@:>@])],
158 [dynmodules="$withval"]
159 )
160
161 AC_SUBST([moduledirs])
162 AC_SUBST([moduleobjects])
163 AC_SUBST([modulelibs])
164 AC_DEFINE_UNQUOTED([PDNS_MODULES], "$modules", [Built-in modules])
165
166 AS_IF([test x"$modules" = "xno"], [modules=""])
167 AS_IF([test x"$dynmodules" = "xno"], [dynmodules=""])
168
169 for a in $modules $dynmodules; do
170 case "$a" in
171 oracle|goracle)
172 PDNS_WITH_ORACLE
173 needoracle=yes
174 ;;
175 godbc)
176 PDNS_WITH_UNIXODBC
177 ;;
178 mydns|gmysql|pdns)
179 PDNS_WITH_MYSQL
180 ;;
181 gpgsql)
182 PDNS_WITH_POSTGRESQL
183 ;;
184 gsqlite3)
185 needsqlite3=yes
186 ;;
187 ldap)
188 PDNS_CHECK_LDAP
189 needldap=yes
190 ;;
191 opendbx)
192 PDNS_CHECK_OPENDBX
193 ;;
194 remote)
195 AS_IF([test "x$enable_unit_tests" = "xyes"],
196 [PDNS_CHECK_CURL_PROGRAM]
197 )
198 have_remotebackend=yes
199 ;;
200 tinydns)
201 PDNS_CHECK_CDB
202 ;;
203 geoip)
204 PDNS_CHECK_GEOIP
205 ;;
206 lua*)
207 AS_IF([test "x$with_lua" = "xno"],
208 [AC_MSG_ERROR([${a} backend needs lua, run ./configure --with-lua])]
209 )
210 AS_IF([test "x$LUAPC" = "x"],
211 [AC_MSG_ERROR([${a} backend needs lua but we cannot find it])]
212 )
213 ;;
214 esac
215 done
216
217 PDNS_ENABLE_REMOTEBACKEND_ZEROMQ
218
219 AC_MSG_CHECKING([whether we will be building and installing the extra tools])
220 AC_ARG_ENABLE([tools],
221 [AS_HELP_STRING([--enable-tools], [if we should build and install the tools @<:@default=no@:>@])],
222 [enable_tools=$enableval],
223 [enable_tools=no]
224 )
225
226 AC_MSG_RESULT([$enable_tools])
227 AM_CONDITIONAL([TOOLS], [test "x$enable_tools" != "xno"])
228 PDNS_ENABLE_IXFRDIST
229
230 PDNS_WITH_PROTOBUF
231
232 PDNS_WITH_LUA_RECORDS
233
234 AM_CONDITIONAL([ORACLE], [test "x$needoracle" = "xyes"])
235
236 AM_CONDITIONAL([LDAP], [test "x$needldap" = "xyes"])
237
238 PDNS_CHECK_SQLITE3
239 AM_CONDITIONAL([SQLITE3], [test "x$needsqlite3" = "xyes"])
240
241 for a in $modules; do
242 AC_MSG_CHECKING([whether we can build module "${a}"])
243 if [[ -d "$srcdir/modules/${a}backend" ]]; then
244 AC_MSG_RESULT([yes])
245 moduledirs="$moduledirs ${a}backend"
246
247 for b in `cat $srcdir/modules/${a}backend/OBJECTFILES`; do
248 moduleobjects="$moduleobjects ../modules/${a}backend/$b"
249 done
250 modulelibs="$modulelibs `cat $srcdir/modules/${a}backend/OBJECTLIBS`"
251 else
252 AC_MSG_RESULT([no])
253 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.])
254 fi
255 done
256
257 for a in $dynmodules; do
258 AC_MSG_CHECKING([whether we can build dynamic module "${a}"])
259 if [[ -d "$srcdir/modules/${a}backend" ]]; then
260 AC_MSG_RESULT([yes])
261 moduledirs="$moduledirs ${a}backend"
262 else
263 AC_MSG_RESULT([no])
264 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.])
265 fi
266 done
267
268 AX_AVAILABLE_SYSTEMD
269 AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ])
270
271 LDFLAGS="$RELRO_LDFLAGS $LDFLAGS"
272
273 CFLAGS="$PIE_CFLAGS $CFLAGS"
274 CXXFLAGS="$PIE_CFLAGS $CXXFLAGS"
275 PROGRAM_LDFLAGS="$PIE_LDFLAGS $PROGRAM_LDFLAGS"
276 AC_SUBST([PROGRAM_LDFLAGS])
277
278 PDNS_ENABLE_COVERAGE
279 PDNS_ENABLE_SANITIZERS
280 PDNS_ENABLE_MALLOC_TRACE
281
282 AC_SUBST(LIBS)
283
284 AC_SUBST([AM_CPPFLAGS],
285 ["AS_ESCAPE([-I$(top_builddir) -I$(top_srcdir)]) $THREADFLAGS $BOOST_CPPFLAGS"]
286 )
287
288 AC_SUBST([YAHTTP_CFLAGS], ['-I$(top_srcdir)/ext/yahttp'])
289 AC_SUBST([YAHTTP_LIBS], ['$(top_builddir)/ext/yahttp/yahttp/libyahttp.la'])
290
291 CXXFLAGS="$SANITIZER_FLAGS $CXXFLAGS"
292
293 AC_ARG_VAR(PACKAGEVERSION, [The version used in secpoll queries])
294 AS_IF([test "x$PACKAGEVERSION" != "x"],
295 [AC_DEFINE_UNQUOTED([PACKAGEVERSION], "$PACKAGEVERSION", [Set to the package version used for secpoll])]
296 )
297
298 export moduledirs moduleobjects modulelibs
299
300 AC_CONFIG_FILES([
301 Makefile
302 modules/Makefile
303 pdns/Makefile
304 codedocs/Makefile
305 docs/Makefile
306 pdns/pdns.init
307 ext/Makefile
308 ext/yahttp/Makefile
309 ext/yahttp/yahttp/Makefile
310 ext/json11/Makefile
311 modules/bindbackend/Makefile
312 modules/geoipbackend/Makefile
313 modules/gmysqlbackend/Makefile
314 modules/godbcbackend/Makefile
315 modules/goraclebackend/Makefile
316 modules/gpgsqlbackend/Makefile
317 modules/gsqlite3backend/Makefile
318 modules/ldapbackend/Makefile
319 modules/luabackend/Makefile
320 modules/lua2backend/Makefile
321 modules/mydnsbackend/Makefile
322 modules/opendbxbackend/Makefile
323 modules/oraclebackend/Makefile
324 modules/pipebackend/Makefile
325 modules/randombackend/Makefile
326 modules/remotebackend/Makefile
327 modules/tinydnsbackend/Makefile
328 ])
329 AC_OUTPUT
330
331 AC_MSG_NOTICE([])
332 AC_MSG_NOTICE([Configuration summary])
333 AC_MSG_NOTICE([=====================])
334 AC_MSG_NOTICE([])
335 AC_MSG_NOTICE([Configured with: $pdns_configure_args])
336 AC_MSG_NOTICE([])
337 AC_MSG_NOTICE([CC: $CC])
338 AC_MSG_NOTICE([CXX: $CXX])
339 AC_MSG_NOTICE([LD: $LD])
340 AC_MSG_NOTICE([CFLAGS: $CFLAGS])
341 AC_MSG_NOTICE([CPPFLAGS: $CPPFLAGS])
342 AC_MSG_NOTICE([CXXFLAGS: $CXXFLAGS])
343 AC_MSG_NOTICE([LDFLAGS: $LDFLAGS])
344 AC_MSG_NOTICE([LIBS: $LIBS])
345 AC_MSG_NOTICE([BOOST_CPPFLAGS: $BOOST_CPPFLAGS])
346 AC_MSG_NOTICE([])
347 AC_MSG_NOTICE([Features enabled])
348 AC_MSG_NOTICE([----------------])
349 AC_MSG_NOTICE([Built-in modules: $modules])
350 AC_MSG_NOTICE([Dynamic modules: $dynmodules])
351 AC_MSG_NOTICE([])
352 AS_IF([test "x$libcrypto_ecdsa" = "xyes"],
353 [AC_MSG_NOTICE([OpenSSL ecdsa: yes])],
354 [AC_MSG_NOTICE([OpenSSL ecdsa: no])]
355 )
356 AS_IF([test "x$LIBSODIUM_LIBS" != "x" || test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed25519" = "xyes"],
357 [AC_MSG_NOTICE([ed25519: yes])],
358 [AC_MSG_NOTICE([ed25519: no])]
359 )
360 AS_IF([test "x$LIBDECAF_LIBS" != "x" || test "x$libcrypto_ed448" = "xyes"],
361 [AC_MSG_NOTICE([ed448: yes])],
362 [AC_MSG_NOTICE([ed448: no])]
363 )
364 AS_IF([test "x$needsqlite3" != "x"],
365 [AC_MSG_NOTICE([SQLite3: yes])],
366 [AC_MSG_NOTICE([SQLite3: no])]
367 )
368 AS_IF([test "x$LUAPC" != "x"],
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 ])
374 AS_IF([test "x$enable_experimental_pkcs11" = "xyes"],
375 [AC_MSG_NOTICE([PKCS-11: yes])]
376 )
377 AS_IF([test "x$enable_experimental_gss_tsig" = "xyes"],
378 [AC_MSG_NOTICE([GSS-TSIG: yes])]
379 )
380 AS_IF([test "x$systemd" != "xn"],
381 [AC_MSG_NOTICE([systemd: yes])],
382 [AC_MSG_NOTICE([systemd: no])]
383 )
384 AS_IF([test "x$enable_remotebackend_zeromq" != "xno"],
385 [AC_MSG_NOTICE([ZeroMQ connector for remotebackend: yes])]
386 )
387 AC_MSG_NOTICE([])