]> git.ipfire.org Git - thirdparty/pdns.git/blob - configure.ac
Merge pull request #5252 from rgacogne/rec-soa-root-nx-trust
[thirdparty/pdns.git] / configure.ac
1 AC_PREREQ([2.61])
2
3 AC_INIT([pdns], m4_esyscmd([build-aux/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
46 PDNS_WITH_LUAJIT
47 AS_IF([test "x$with_luajit" = "xno"], [
48 PDNS_WITH_LUA
49 ])
50 PDNS_CHECK_LUA_HPP
51
52 AX_CXX_COMPILE_STDCXX_11
53
54 AC_MSG_CHECKING([whether we will enable compiler security checks])
55 AC_ARG_ENABLE([hardening],
56 [AS_HELP_STRING([--disable-hardening], [disable compiler security checks @<:@default=no@:>@])],
57 [enable_hardening=$enableval],
58 [enable_hardening=yes]
59 )
60 AC_MSG_RESULT([$enable_hardening])
61
62 AS_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 ])
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_ENABLE_BOTAN
97 PDNS_CHECK_LIBSODIUM
98 PDNS_CHECK_LIBCRYPTO([
99 ],[
100 AC_MSG_ERROR([OpenSSL/libcrypto not found])
101 ]
102 )
103 PDNS_CHECK_LIBCRYPTO_ECDSA
104
105 PDNS_CHECK_RAGEL
106 PDNS_CHECK_CLOCK_GETTIME
107
108 BOOST_REQUIRE([1.35])
109 # Boost accumulators, as used by dnsbulktest and dnstcpbench, need 1.48+
110 # to be compatible with C++11
111 AM_CONDITIONAL([HAVE_BOOST_GE_148], [test "$boost_major_version" -ge 148])
112
113 BOOST_PROGRAM_OPTIONS([mt])
114 AS_IF([test "$boost_cv_lib_program_options" = "no"], [
115 AC_MSG_ERROR([Boost Program Options library not found])
116 ])
117 PDNS_ENABLE_UNIT_TESTS
118 PDNS_ENABLE_REPRODUCIBLE
119
120 PDNS_WITH_SQLITE3
121
122 PDNS_CHECK_PANDOC
123 PDNS_FROM_GIT
124
125 dnl Checks for library functions.
126 AC_CHECK_FUNCS_ONCE([strcasestr localtime_r recvmmsg])
127
128 AM_CONDITIONAL([HAVE_RECVMMSG], [test "x$ac_cv_func_recvmmsg" = "xyes"])
129
130 AS_IF([test "x$lt_cv_dlopen" = "xno"],
131 [AC_MSG_ERROR([Your system does not support dlopen])]
132 )
133
134 AC_SUBST([LIBDL], [$lt_cv_dlopen_libs])
135
136 PDNS_ENABLE_VERBOSE_LOGGING
137 PDNS_ENABLE_PKCS11
138 PDNS_ENABLE_GSS_TSIG
139
140 AC_SUBST([socketdir])
141 socketdir="/var/run"
142 AC_ARG_WITH([socketdir],
143 [AS_HELP_STRING([--with-socketdir], [where the controlsocket lives @<:@default=/var/run@:>@])],
144 [socketdir="$withval"]
145 )
146
147 modules="bind gmysql random"
148 AC_ARG_WITH([modules],
149 [AS_HELP_STRING([--with-modules], [which backends to compile with @<:@default=bind gmysql random@:>@])],
150 [modules="$withval"]
151 )
152
153 dynmodules="pipe"
154 AC_ARG_WITH([dynmodules],
155 [AS_HELP_STRING([--with-dynmodules], [which backends to build for dynamic loading @<:@default=pipe@:>@])],
156 [dynmodules="$withval"]
157 )
158
159 AC_SUBST([moduledirs])
160 AC_SUBST([moduleobjects])
161 AC_SUBST([modulelibs])
162 AC_DEFINE_UNQUOTED([PDNS_MODULES], "$modules", [Built-in modules])
163
164 AS_IF([test x"$modules" = "xno"], [modules=""])
165 AS_IF([test x"$dynmodules" = "xno"], [dynmodules=""])
166
167 for a in $modules $dynmodules; do
168 case "$a" in
169 oracle|goracle)
170 PDNS_WITH_ORACLE
171 needoracle=yes
172 ;;
173 godbc)
174 PDNS_WITH_UNIXODBC
175 ;;
176 mydns|gmysql|pdns)
177 PDNS_WITH_MYSQL
178 ;;
179 gpgsql)
180 PDNS_WITH_POSTGRESQL
181 ;;
182 gsqlite3)
183 needsqlite3=yes
184 ;;
185 ldap)
186 PDNS_CHECK_LDAP
187 needldap=yes
188 ;;
189 opendbx)
190 PDNS_CHECK_OPENDBX
191 ;;
192 remote)
193 AS_IF([test "x$enable_unit_tests" = "xyes"],
194 [PDNS_CHECK_CURL_PROGRAM]
195 )
196 have_remotebackend=yes
197 ;;
198 tinydns)
199 PDNS_CHECK_CDB
200 ;;
201 geoip)
202 PDNS_CHECK_GEOIP
203 ;;
204 lua)
205 AS_IF([test "x$with_lua" = "xno"],
206 AC_MSG_ERROR([Lua backend needs lua, run ./configure --with-lua])
207 )
208 AS_IF([test "x$LUAPC" = "x" -a "x$LUAJITPC" = "x"],
209 AC_MSG_ERROR([Lua backend needs lua but we cannot find it])
210 )
211 ;;
212 esac
213 done
214
215 PDNS_ENABLE_REMOTEBACKEND_ZEROMQ
216
217 AC_MSG_CHECKING([whether we will be building and installing the extra tools])
218 AC_ARG_ENABLE([tools],
219 [AS_HELP_STRING([--enable-tools], [if we should build and install the tools @<:@default=no@:>@])],
220 [enable_tools=$enableval],
221 [enable_tools=no]
222 )
223
224 AC_MSG_RESULT([$enable_tools])
225 AM_CONDITIONAL([TOOLS], [test "x$enable_tools" != "xno"])
226
227 PDNS_WITH_PROTOBUF
228
229
230 AM_CONDITIONAL([ORACLE], [test "x$needoracle" = "xyes"])
231
232 AM_CONDITIONAL([LDAP], [test "x$needldap" = "xyes"])
233
234 PDNS_CHECK_SQLITE3
235 AM_CONDITIONAL([SQLITE3], [test "x$needsqlite3" = "xyes"])
236
237 for a in $modules; do
238 AC_MSG_CHECKING([whether we can build module "${a}"])
239 if [[ -d "$srcdir/modules/${a}backend" ]]; then
240 AC_MSG_RESULT([yes])
241 moduledirs="$moduledirs ${a}backend"
242
243 for b in `cat $srcdir/modules/${a}backend/OBJECTFILES`; do
244 moduleobjects="$moduleobjects ../modules/${a}backend/$b"
245 done
246 modulelibs="$modulelibs `cat $srcdir/modules/${a}backend/OBJECTLIBS`"
247 else
248 AC_MSG_RESULT([no])
249 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.])
250 fi
251 done
252
253 for a in $dynmodules; do
254 AC_MSG_CHECKING([whether we can build dynamic module "${a}"])
255 if [[ -d "$srcdir/modules/${a}backend" ]]; then
256 AC_MSG_RESULT([yes])
257 moduledirs="$moduledirs ${a}backend"
258 else
259 AC_MSG_RESULT([no])
260 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.])
261 fi
262 done
263
264 AX_AVAILABLE_SYSTEMD
265 AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ])
266
267 LDFLAGS="$RELRO_LDFLAGS $LDFLAGS"
268
269 CFLAGS="$PIE_CFLAGS $CFLAGS"
270 CXXFLAGS="$PIE_CFLAGS $CXXFLAGS"
271 PROGRAM_LDFLAGS="$PIE_LDFLAGS $PROGRAM_LDFLAGS"
272 AC_SUBST([PROGRAM_LDFLAGS])
273
274 PDNS_ENABLE_COVERAGE
275 PDNS_ENABLE_SANITIZERS
276 PDNS_ENABLE_MALLOC_TRACE
277
278 AC_SUBST(LIBS)
279
280 AC_SUBST([AM_CPPFLAGS],
281 ["AS_ESCAPE([-I$(top_builddir) -I$(top_srcdir)]) $THREADFLAGS $BOOST_CPPFLAGS"]
282 )
283
284 AC_SUBST([YAHTTP_CFLAGS], ['-I$(top_srcdir)/ext/yahttp'])
285 AC_SUBST([YAHTTP_LIBS], ['$(top_builddir)/ext/yahttp/yahttp/libyahttp.la'])
286
287 CXXFLAGS="$SANITIZER_FLAGS $CXXFLAGS"
288
289 AC_ARG_VAR(PACKAGEVERSION, [The version used in secpoll queries])
290 AS_IF([test "x$PACKAGEVERSION" != "x"],
291 [AC_DEFINE_UNQUOTED([PACKAGEVERSION], "$PACKAGEVERSION", [Set to the package version used for secpoll])]
292 )
293
294 export moduledirs moduleobjects modulelibs
295
296 AC_CONFIG_FILES([
297 Makefile
298 modules/Makefile
299 pdns/Makefile
300 codedocs/Makefile
301 docs/Makefile
302 pdns/pdns.init
303 ext/Makefile
304 ext/yahttp/Makefile
305 ext/yahttp/yahttp/Makefile
306 ext/json11/Makefile
307 modules/bindbackend/Makefile
308 modules/geoipbackend/Makefile
309 modules/gmysqlbackend/Makefile
310 modules/godbcbackend/Makefile
311 modules/goraclebackend/Makefile
312 modules/gpgsqlbackend/Makefile
313 modules/gsqlite3backend/Makefile
314 modules/ldapbackend/Makefile
315 modules/luabackend/Makefile
316 modules/mydnsbackend/Makefile
317 modules/opendbxbackend/Makefile
318 modules/oraclebackend/Makefile
319 modules/pipebackend/Makefile
320 modules/randombackend/Makefile
321 modules/remotebackend/Makefile
322 modules/tinydnsbackend/Makefile
323 ])
324 AC_OUTPUT
325
326 AC_MSG_NOTICE([])
327 AC_MSG_NOTICE([Configuration summary])
328 AC_MSG_NOTICE([=====================])
329 AC_MSG_NOTICE([])
330 AC_MSG_NOTICE([Configured with: $pdns_configure_args])
331 AC_MSG_NOTICE([])
332 AC_MSG_NOTICE([CC: $CC])
333 AC_MSG_NOTICE([CXX: $CXX])
334 AC_MSG_NOTICE([LD: $LD])
335 AC_MSG_NOTICE([CFLAGS: $CFLAGS])
336 AC_MSG_NOTICE([CPPFLAGS: $CPPFLAGS])
337 AC_MSG_NOTICE([CXXFLAGS: $CXXFLAGS])
338 AC_MSG_NOTICE([LDFLAGS: $LDFLAGS])
339 AC_MSG_NOTICE([LIBS: $LIBS])
340 AC_MSG_NOTICE([BOOST_CPPFLAGS: $BOOST_CPPFLAGS])
341 AC_MSG_NOTICE([])
342 AC_MSG_NOTICE([Features enabled])
343 AC_MSG_NOTICE([----------------])
344 AC_MSG_NOTICE([Built-in modules: $modules])
345 AC_MSG_NOTICE([Dynamic modules: $dynmodules])
346 AC_MSG_NOTICE([])
347 AS_IF([test "x$libcrypto_ecdsa" == "xyes"],
348 [AC_MSG_NOTICE([OpenSSL ecdsa: yes])],
349 [AC_MSG_NOTICE([OpenSSL ecdsa: no])]
350 )
351 AS_IF([test "x$LIBSODIUM_LIBS" != "x"],
352 [AC_MSG_NOTICE([libsodium ed25519: yes])],
353 [AC_MSG_NOTICE([libsodium ed25519: no])]
354 )
355 AS_IF([test "x$needsqlite3" != "x"],
356 [AC_MSG_NOTICE([SQLite3: yes])],
357 [AC_MSG_NOTICE([SQLite3: no])]
358 )
359 AS_IF([test "x$LUAPC" != "x"],
360 [AC_MSG_NOTICE([Lua: $LUAPC])],
361 [AS_IF([test "x$LUAJITPC" != "x"],
362 [AC_MSG_NOTICE([LuaJit: $LUAJITPC])],
363 [AC_MSG_NOTICE([Lua/LuaJit: no])])
364 ])
365 AS_IF([test "x$enable_experimental_gss_tsig" = "xyes"],
366 [AC_MSG_NOTICE([GSS-TSIG: yes])]
367 )
368 AS_IF([test "x$systemd" != "xn"],
369 [AC_MSG_NOTICE([systemd: yes])],
370 [AC_MSG_NOTICE([systemd: no])]
371 )
372 AS_IF([test "x$enable_remotebackend_zeromq" != "xno"],
373 [AC_MSG_NOTICE([ZeroMQ connector for remotebackend: yes])]
374 )
375 AC_MSG_NOTICE([])