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