configure.ac 20.1 KB
Newer Older
Ondřej Surý's avatar
Ondřej Surý committed
1 2
#                                               -*- Autoconf -*-

3
AC_PREREQ([2.60])
4

5
m4_define([knot_VERSION_MAJOR],2)dnl
Jan Včelák's avatar
Jan Včelák committed
6
m4_define([knot_VERSION_MINOR],2)dnl
7
m4_define([knot_VERSION_PATCH],0)dnl
Jan Včelák's avatar
Jan Včelák committed
8
m4_define([knot_VERSION_EXTRA],-dev)dnl
9
m4_define([knot_PKG_VERSION],[knot_VERSION_MAJOR.knot_VERSION_MINOR.knot_VERSION_PATCH]knot_VERSION_EXTRA)dnl
10 11

AC_INIT([knot], knot_PKG_VERSION, [knot-dns@labs.nic.cz])
12
AM_INIT_AUTOMAKE([gnits subdir-objects no-dist-gzip dist-xz -Wall -Werror])
13
AM_SILENT_RULES([yes])
14
AC_CONFIG_SRCDIR([src/knot])
Ondřej Surý's avatar
Ondřej Surý committed
15 16
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_MACRO_DIR([m4])
17
AC_USE_SYSTEM_EXTENSIONS([_GNU_SOURCE])
18
AC_CANONICAL_HOST
19

20 21 22 23 24
AC_SUBST([KNOT_VERSION_MAJOR], knot_VERSION_MAJOR)
AC_SUBST([KNOT_VERSION_MINOR], knot_VERSION_MINOR)
AC_SUBST([KNOT_VERSION_PATCH], knot_VERSION_PATCH)
AC_SUBST([KNOT_VERSION_EXTRA], knot_VERSION_EXTRA)

25
AC_CONFIG_FILES([src/libknot/version.h
26 27
                 src/zscanner/version.h
                 src/dnssec/lib/dnssec/version.h])
28

29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
# Here are a set of rules to help you update your library version
# information:
#
# 1. Start with version information of ‘0:0:0’ for each libtool library.
#
# 2. Update the version information only immediately before a public
#    release of your software. More frequent updates are unnecessary,
#    and only guarantee that the current interface number gets larger
#    faster.
#
# 3. If the library source code has changed at all since the last
#    update, then increment revision (‘c:r:a’ becomes ‘c:r+1:a’).
#
# 4. If any interfaces have been added, removed, or changed since the
#    last update, increment current, and set revision to 0.
#
# 5. If any interfaces have been added since the last public release,
#    then increment age.
#
# 6. If any interfaces have been removed or changed since the last
#    public release, then set age to 0.

51 52 53
AC_SUBST([libknot_VERSION_INFO],["-version-info 2:0:0"])
AC_SUBST([libdnssec_VERSION_INFO],["-version-info 1:0:0"])
AC_SUBST([libzscanner_VERSION_INFO],["-version-info 1:0:0"])
54

55
# Automatically update release date based on configure.ac date
56 57
AC_PROG_SED
release_date=$($SED -n 's/^Knot DNS .* (\(.*\))/\1/p;q;' ${srcdir}/NEWS)
58 59
AC_SUBST([RELEASE_DATE], $release_date)

60 61 62 63
# Set compiler compatibility flags
AC_PROG_CC_C99
AM_PROG_CC_C_O
AC_PROG_CPP_WERROR
Ondřej Surý's avatar
Ondřej Surý committed
64

65
# Default compiler flags
66
CFLAGS="$CFLAGS -Wall -Werror=format-security -Werror=implicit"
67

68
# Checks for programs.
69
m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) # call AM_PROG_AR only if available
70

Ondřej Surý's avatar
Ondřej Surý committed
71
# Initialize libtool
72
AC_PROG_LIBTOOL
Ondřej Surý's avatar
Ondřej Surý committed
73 74
LT_INIT

75
# Use pkg-config
76
PKG_PROG_PKG_CONFIG
77
m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], [AC_SUBST([pkgconfigdir], ['${libdir}/pkgconfig'])])
78
AC_CONFIG_FILES([src/libknot.pc
79 80 81
                 src/dnssec/libdnssec.pc
                 src/zscanner/libzscanner.pc
                 ])
82

83 84 85 86
# Build Knot DNS daemon
AC_ARG_ENABLE([daemon],
    AS_HELP_STRING([--disable-daemon], [Don't build Knot DNS main daemon]), [], [enable_daemon=yes])
AM_CONDITIONAL([HAVE_DAEMON], [test "$enable_daemon" = "yes"])
87

88 89 90 91
# Build Knot DNS utilities
AC_ARG_ENABLE([utilities],
    AS_HELP_STRING([--disable-utilities], [Don't build Knot DNS utilities]), [], [enable_utilities=yes])
AM_CONDITIONAL([HAVE_UTILS], [test "$enable_utilities" = "yes"])
92

93 94 95 96
# Build Knot DNS documentation
AC_ARG_ENABLE([documentation],
    AS_HELP_STRING([--disable-documentation], [Don't build Knot DNS documentation]), [], [enable_documentation=yes])
AM_CONDITIONAL([HAVE_DOCS], [test "$enable_documentation" = "yes"])
97

98 99 100
######################
# Generic dependencies
######################
101

Ondřej Surý's avatar
Ondřej Surý committed
102 103
AC_PROG_INSTALL

104 105
AX_CC_LLVM

106
AC_ARG_ENABLE([fastparser],
107 108 109 110
    AS_HELP_STRING([--disable-fastparser], [Disable use of fastest zone parser]),[],[
    # Set zone parser type - fastest on release build, slowest on dev build
    AS_IF([test -d ".git" -o "$PATCH_VERSION" = "dev"],[
        enable_fastparser=no
111 112 113
        ],[
        enable_fastparser=yes
        ])
114
    ])
115 116 117 118 119 120 121 122

AS_IF([test "$enable_fastparser" = "yes"],[
    AS_IF([test "${CC_LLVM}" = "yes"],[
        AC_MSG_WARN([LLVM based compiler detected; disabling fastest zone parser, see https://gitlab.labs.nic.cz/labs/knot/issues/351])
        enable_fastparser=no
        ])
    ])

123
AM_CONDITIONAL([FAST_PARSER], [test "$enable_fastparser" = "yes"])
124 125

# GnuTLS crypto backend
126 127 128 129 130
PKG_CHECK_MODULES([gnutls], [gnutls >= 3.0 nettle], [
    CFLAGS_save=$CFLAGS
    CFLAGS="$CFLAGS $gnutls_CFLAGS"
    AC_CHECK_HEADERS([nettle/version.h])
    CFLAGS=$CFLAGS_save
131 132 133

    LDFLAGS_save=$LDFLAGS
    LDFLAGS="$LDFLAGS $gnutls_LIBS"
134 135 136 137
    AC_CHECK_FUNC([gnutls_pkcs11_privkey_generate3], [enable_pkcs11=yes], [enable_pkcs11=no])
    AS_IF([test "$enable_pkcs11" = yes],
        [AC_DEFINE([ENABLE_PKCS11], [1], [PKCS 11 support available])])

138
    LDFLAGS=$LDFLAGS_save
139
])
140 141 142 143

# JSON for DNSSEC status storage
PKG_CHECK_MODULES([jansson], [jansson >= 2.3])

144
# recvmmsg() (valgrind doesn't support it, so disable for debugging)
145
# The check for struct mmsghdr is required when libc doesn't have an API but the function links
146
AC_ARG_ENABLE([recvmmsg],
147
    AS_HELP_STRING([--enable-recvmmsg=yes|no], [enable recvmmsg() network API under Linux (kernel support required) (set to 'no' if you have trouble running server under valgrind) [default=yes]]),
148 149
    [case "${enableval}" in
      yes)
150
          AC_CHECK_FUNCS([sendmmsg])
151 152
          AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]], [[struct mmsghdr v; recvmmsg(0,0,0,0,0);]])],
          [AC_DEFINE(HAVE_RECVMMSG, 1, [Define if struct mmsghdr and recvmmsg() exists.])])
153
          ;;
154
      no)
155
          ;;
156
      *)
157 158
          AC_MSG_ERROR([bad value ${enableval} for --enable-recvmmsg])
          ;;
159 160 161 162 163 164
    esac],
    [
      AC_CHECK_FUNCS([sendmmsg])
      AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]], [[struct mmsghdr v; recvmmsg(0,0,0,0,0);]])],
      [AC_DEFINE(HAVE_RECVMMSG, 1, [Define if struct mmsghdr and recvmmsg() exists.])])
    ])
165

166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
AC_ARG_ENABLE([reuseport],
    AS_HELP_STRING([--enable-reuseport=auto|yes|no], [enable Linux SO_REUSEPORT support [default=auto]]),
    [enable_reuseport="$enableval"], [enable_reuseport=auto])

AC_DEFUN([CHECK_REUSEPORT], [
  AC_CHECK_DECL(
    [SO_REUSEPORT],
    [$1],
    [$2],
    [
    #include <sys/socket.h>
    ]
  )])

AS_IF([test "$enable_reuseport" != no], [
  AS_CASE([$enable_reuseport],
    [auto],[
      AS_CASE([$host_os],
        [linux*], [CHECK_REUSEPORT([enable_reuseport=yes], [enable_reuseport=no])],
        [*], [enable_reuseport=no]
      )],
    [yes],[
      AS_CASE([$host_os],
        [linux*], [CHECK_REUSEPORT([enable_reuseport=yes], [AC_MSG_ERROR([SO_REUSEPORT support not detected.])])],
        [*], [AC_MSG_ERROR(["SO_REUSEPORT not supported on $host_os."])]
      )],
    [*], [AC_MSG_ERROR([Invalid value of --enable-reuseport.])]
  )])

AS_IF([test "$enable_reuseport" = yes],[
   AC_DEFINE([ENABLE_REUSEPORT], [1], [Use SO_REUSEPORT.])])

198
# Check for link time optimizations support and predictive commoning
199
AC_ARG_ENABLE([lto],
200
    AS_HELP_STRING([--enable-lto=yes|no], [enable link-time optimizations, enable if not broken for some extra speed [default=no]]),
201
    [case "${enableval}" in
202
      yes) AX_CHECK_COMPILE_FLAG("-flto", [CFLAGS="$CFLAGS -flto"], []) ;;
203
      no) ;;
204
      *)  AC_MSG_ERROR([bad value ${enableval} for --enable-lto]) ;;
205
    esac])
206

207
AX_CHECK_COMPILE_FLAG("-fpredictive-commoning", [CFLAGS="$CFLAGS -fpredictive-commoning"], [], "-Werror")
208

209 210 211
# Default directories
run_dir="${localstatedir}/run/knot"
AC_ARG_WITH([rundir],
212
        AC_HELP_STRING([--with-rundir=path], [Path to run-time variable data (pid, sockets...). [default=LOCALSTATEDIR/run/knot]]),
213 214 215
        [run_dir=$withval])
AC_SUBST(run_dir)

Ondřej Surý's avatar
Ondřej Surý committed
216
storage_dir="${localstatedir}/lib/knot"
217
AC_ARG_WITH([storage],
218
        AC_HELP_STRING([--with-storage=path], [Default storage directory (slave zones, persistent data). [default=LOCALSTATEDIR/lib/knot]]),
219 220 221
        [storage_dir=$withval])
AC_SUBST(storage_dir)

222 223
config_dir="${sysconfdir}/knot"
AC_ARG_WITH([configdir],
224
        AC_HELP_STRING([--with-configdir=path], [Default directory for configuration. [default=SYSCONFDIR/knot]]),
225 226 227
        [config_dir=$withval])
AC_SUBST(config_dir)

228 229 230 231 232 233 234 235 236 237 238
#########################################
# Dependencies needed for Knot DNS daemon
#########################################

# Systemd integration
AC_ARG_ENABLE([systemd],
    AS_HELP_STRING([--enable-systemd=auto|yes|no], [enable systemd integration [default=auto]]),
    [enable_systemd="$enableval"], [enable_systemd=auto])

AS_IF([test "$enable_daemon" = "yes"],[

239
AS_IF([test "$enable_systemd" != "no"],[
240
  AS_CASE([$enable_systemd],
241 242 243
    [auto],[PKG_CHECK_MODULES([systemd], [libsystemd], [enable_systemd=yes], [
            PKG_CHECK_MODULES([systemd], [libsystemd-daemon libsystemd-journal], [enable_systemd=yes], [enable_systemd=no])])],
    [yes],[PKG_CHECK_MODULES([systemd], [libsystemd], [], [
244
            PKG_CHECK_MODULES([systemd], [libsystemd-daemon libsystemd-journal])])],
245 246 247 248 249
    [*],[AC_MSG_ERROR([Invalid value of --enable-systemd.])])
    ])

AS_IF([test "$enable_systemd" = "yes"],[
  AC_DEFINE([ENABLE_SYSTEMD], [1], [Use systemd integration.])])
250

251 252
]) dnl enable_daemon

253 254 255 256 257

dnl Check for userspace-rcu library
AC_ARG_WITH(urcu,
[  --with-urcu=DIR        where to find userspace-rcu library])

258 259
AS_IF([test "$enable_daemon" = "yes"],[

260 261
AS_IF([test "$with_urcu" != "no"], [
  PKG_CHECK_MODULES([liburcu], liburcu, [
262
    liburcu_PKGCONFIG="liburcu >= 0.4.0"
263
    AC_SUBST([liburcu_PKGCONFIG])
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
    with_urcu=yes
  ],[
    for try_urcu in "$with_urcu" "" "/usr/local"; do
      save_LIBS="$LIBS"
      save_CPPFLAGS="$CPPFLAGS"

      AS_IF([test -d "$try_urcu"], [
        liburcu_CFLAGS="-I$try_urcu/include"
        liburcu_LIBS="-L$try_urcu/lib"
      ],[
        liburcu_CFLAGS=""
        liburcu_LIBS=""
      ])

      CPPFLAGS="$CPPFLAGS $liburcu_CFLAGS"
      LIBS="$LIBS $liburcu_LIBS"

      AC_SEARCH_LIBS([rcu_set_pointer_sym], [urcu], [
        with_urcu=yes
283 284 285 286
        liburcu_LIBS="$liburcu_LIBS -lurcu"
        AC_SUBST([liburcu_CFLAGS])
        AC_SUBST([liburcu_LIBS])
        break
287
      ],[
288 289
        CPPFLAGS="$save_CPPFLAGS"
        LIBS="$save_LIBS"
290
        with_urcu=no
291 292
        # do not cache result of AC_SEARCH_LIBS test
        unset ac_cv_search_rcu_set_pointer_sym
293 294
      ])
    done
295 296
    CPPFLAGS="$save_CPPFLAGS"
    LIBS="$save_LIBS"
297 298 299

    AS_IF([test "$with_urcu" = "no"],[
      AC_MSG_ERROR([liburcu is required])
300
      ])
301 302 303
  ])
])

304
AC_SEARCH_LIBS([urcu_init], [urcu], [AC_MSG_ERROR([liburcu is too old (< 0.4.0), urcu_init symbol found])])
305
])
306

307 308
opt_dnstap=no
AS_IF([test "$enable_daemon" = "yes"],[
309 310 311
dnl Check for dnstap.
dt_DNSTAP([
    AC_DEFINE([USE_DNSTAP], [1], [Define to 1 to enable dnstap support])
312 313
    AC_SUBST(DNSTAP_CFLAGS)
    AC_SUBST(DNSTAP_LIBS)
314
    ])
315
])
316

317 318
AM_CONDITIONAL([HAVE_DNSTAP], test "$opt_dnstap" != "no")

Jan Včelák's avatar
Jan Včelák committed
319
dnl Check for LMDB
320 321 322 323 324
lmdb_MIN_VERSION_MAJOR=0
lmdb_MIN_VERSION_MINOR=9
lmdb_MIN_VERSION_PATCH=15
lmdb_MIN_VERSION_STRING="$lmdb_MIN_VERSION_MAJOR.$lmdb_MIN_VERSION_MINOR.$lmdb_MIN_VERSION_PATCH"
lmdb_MIN_VERSION_FULL="$((($lmdb_MIN_VERSION_MAJOR << 24) | ($lmdb_MIN_VERSION_MINOR << 16) | $lmdb_MIN_VERSION_PATCH))"
325
AC_ARG_WITH([lmdb],
326
    AC_HELP_STRING([--with-lmdb=[DIR]], [Link with external LMDB (>= $lmdb_MIN_VERSION_STRING)]),[
327 328
    with_lmdb=$withval
    ],[
329
    with_lmdb=auto
330 331 332
    ])

have_lmdb=no
333

334 335 336
AS_IF([test "$with_lmdb" != "no"],[
    save_CPPFLAGS=$CPPFLAGS
    save_LIBS=$LIBS
337 338

    # Look for lmdb in given path and common locations
339 340
    for try_lmdb in "$with_lmdb" "" "/usr/local"; do

341 342 343
      AS_IF([test -d "$try_lmdb"], [
        lmdb_CFLAGS="-I$try_lmdb/include"
        lmdb_LIBS="-L$try_lmdb/lib"
344 345 346
        ],[
        lmdb_CFLAGS=""
        lmdb_LIBS=""
347
        ])
348

349 350
      CPPFLAGS="$save_CPPFLAGS $lmdb_CFLAGS"
      LIBS="$save_LIBS $lmdb_LIBS"
351 352 353

      AC_SEARCH_LIBS([mdb_env_open], [lmdb], [
          AC_CHECK_HEADERS([lmdb.h], [], [
354 355
              AC_MSG_ERROR([lmdb headers not found in `$try_lmdb', is your installation complete?])])
          AC_COMPUTE_INT(lmdb_VERSION_FULL, MDB_VERSION_FULL, [#include <lmdb.h>],
356 357
              AC_MSG_ERROR([Unable to determine lmdb version from MDB_VERSION_FULL]))
          AS_IF([test "$lmdb_VERSION_FULL" -ge "$lmdb_MIN_VERSION_FULL"],[
358 359
              lmdb_LIBS="$lmdb_LIBS -llmdb"
              have_lmdb=yes],[
360 361 362 363 364
              unset lmdb_CFLAGS
              unset lmdb_LIBS
              AC_MSG_WARN([lmdb version 0.9.15 and higher not found, using embedded version])
              ])
          break
365
          ])
366

367 368 369 370
      unset lmdb_CFLAGS
      unset lmdb_LIBS
      # do not cache result of AC_SEARCH_LIBS test
      unset ac_cv_search_mdb_env_open
371
    done
372

373 374
    CPPFLAGS="$save_CPPFLAGS"
    LIBS="$save_LIBS"
375 376

    # fail the configure if we haven't found lmdb library in the system
377
    AS_IF([test "$with_lmdb" != "auto" -a "$have_lmdb" = "no"],[
378
        AC_MSG_ERROR([shared lmdb library not found])
379
        ])
380 381 382
    ])

AS_IF([test "$have_lmdb" != "no"],[
383 384 385
    AC_SUBST([lmdb_CFLAGS])
    AC_SUBST([lmdb_LIBS])
    enable_lmdb=shared
386 387 388
    ],[
    enable_lmdb=embedded
    ])
389
AM_CONDITIONAL([HAVE_LMDB], test "$have_lmdb" != "no")
390

391
# LMDB mapping sizes
392
conf_mapsize_default=500
393
AC_ARG_WITH([conf_mapsize],
394 395 396 397 398 399 400 401
    AC_HELP_STRING([--with-conf-mapsize=NUM], [Configuration DB mapsize in MiB [default=$conf_mapsize_default]]),
    [conf_mapsize=$withval],[conf_mapsize=$conf_mapsize_default])

AS_CASE([$conf_mapsize],
    [yes],[conf_mapsize=$conf_mapsize_default],
    [no], [AC_MSG_ERROR([conf_mapsize must be a number])],
    [*],  [AS_IF([test $conf_mapsize != $(( $conf_mapsize + 0 ))],
                 [AC_ERROR([conf_mapsize must be an integer number])])])
402 403
AC_DEFINE_UNQUOTED([CONF_MAPSIZE], [$conf_mapsize], [Configuration DB mapsize.])

404
timer_mapsize_default=100
405
AC_ARG_WITH([timer_mapsize],
406 407 408 409 410 411 412 413
        AC_HELP_STRING([--with-timer-mapsize=NUM], [Timer DB mapsize in MiB [default=$timer_mapsize_default]]),
        [timer_mapsize=$withval],[timer_mapsize=$timer_mapsize_default])

AS_CASE([$timer_mapsize],
    [yes],[timer_mapsize=$timer_mapsize_default],
    [no], [AC_MSG_ERROR([timer_mapsize must be a number])],
    [*],  [AS_IF([test $timer_mapsize != $(( $timer_mapsize + 0 ))],
                 [AC_ERROR([timer_mapsize must be an integer number])])])
414 415
AC_DEFINE_UNQUOTED([TIMER_MAPSIZE], [$timer_mapsize], [Timer DB mapsize.])

416 417
AS_IF([test "$enable_daemon" = "yes"],[

418
dnl Check for rosedb module
419
AC_ARG_ENABLE([rosedb],
420
    AS_HELP_STRING([--enable-rosedb], [Enable static RR query module.]),
421
    [], [enable_rosedb=no])
422 423
]) # Knot DNS daemon dependencies

424
AS_IF([test "$enable_rosedb" = yes], [AC_DEFINE([HAVE_ROSEDB], [1], [Define to 1 to enable static RR query module.])])
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445
AM_CONDITIONAL([HAVE_ROSEDB], [test "$enable_rosedb" = yes])

############################################
# Dependencies needed for Knot DNS utilities
############################################

dnl Check for libidn.
AC_ARG_WITH(libidn,
    AC_HELP_STRING([--with-libidn=[DIR]], [Support IDN (needs GNU Libidn)]),
    with_libidn=$withval,
    with_libidn=yes
    )

AS_IF([test "$enable_utilities" = "yes"],[
AS_IF([test "$with_libidn" != "no"],[
    PKG_CHECK_MODULES([libidn], [libidn >= 0.0.0], [
        with_libidn=yes
        AC_DEFINE([LIBIDN], [1], [Define to 1 to enable IDN support])
        ],[
        with_libidn=no
        AC_MSG_WARN([libidn not found])
446
        ])])
447 448

]) # Knot DNS utilities dependencies
449

450 451
# Bash completions
AC_ARG_WITH([bash-completions],
452
  AC_HELP_STRING([--with-bash-completions=[DIR]], [Bash completions directory [default=no]]),
453
  [with_bash_completions="$withval"],
454
  [with_bash_completions=no]
455 456 457 458 459 460 461 462 463 464 465 466
)
AS_CASE([$with_bash_completions],
  [yes], [PKG_CHECK_VAR([bash_completions_dir], [bash-completion], [completionsdir], [], [AC_MSG_ERROR([bash completions not found])])],
  [no], [bash_completions_dir=],
  [bash_completions_dir="$with_bash_completions"]
)
AM_CONDITIONAL([HAVE_BASH_COMPLETIONS], [test -n "$bash_completions_dir"])
AS_IF([test -n "$bash_completions_dir"],
  [bash_completions_output="${bash_completions_dir}"],
  [bash_completions_output=no]
)

467 468
AC_SEARCH_LIBS([pow], [m])
AC_SEARCH_LIBS([pthread_create], [pthread], [], [AC_MSG_ERROR([pthreads not found])])
469
AC_SEARCH_LIBS([dlopen], [dl])
Marek Vavrusa's avatar
Marek Vavrusa committed
470
AC_SEARCH_LIBS([clock_gettime], [rt])
471
AC_SEARCH_LIBS([capng_apply], [cap-ng])
Ondřej Surý's avatar
Ondřej Surý committed
472 473 474

# Checks for header files.
AC_HEADER_RESOLV
475
AC_CHECK_HEADERS_ONCE([cap-ng.h netinet/in_systm.h pthread_np.h signal.h sys/time.h sys/wait.h sys/uio.h])
Ondřej Surý's avatar
Ondřej Surý committed
476 477

# Checks for library functions.
478
AC_CHECK_FUNCS([clock_gettime gettimeofday fgetln getline madvise malloc_trim poll posix_memalign pthread_setaffinity_np regcomp setgroups strlcat strlcpy initgroups accept4])
Ondřej Surý's avatar
Ondřej Surý committed
479

480 481
# Check for be64toh function
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <endian.h>]], [[return be64toh(0);]])],
482
[AC_DEFINE(HAVE_BE64TOH, 1, [Define to 1 if you have the 'be64toh' function.])])
483

484 485 486 487 488 489 490 491
# Check for cpu_set_t/cpuset_t compatibility
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]], [[cpu_set_t set; CPU_ZERO(&set);]])],
[AC_DEFINE(HAVE_CPUSET_LINUX, 1, [Define if Linux-like cpu_set_t exists.])])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread_np.h>]], [[cpuset_t set; CPU_ZERO(&set);]])],
[AC_DEFINE(HAVE_CPUSET_BSD, 1, [Define if FreeBSD-like cpuset_t exists.])])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sched.h>]], [[cpuset_t* set = cpuset_create(); cpuset_destroy(set);]])],
[AC_DEFINE(HAVE_CPUSET_NETBSD, 1, [Define if cpuset_t and cpuset(3) exists.])])

492
# Prepare CFLAG_VISIBILITY to be used where needed
493
gl_VISIBILITY()
494

495 496 497
# Add code coverage macro
AX_CODE_COVERAGE

498 499 500
AX_SANITIZER
AS_IF([test -n "$sanitize_CFLAGS"], [CFLAGS="$CFLAGS $sanitize_CFLAGS"])

501 502 503 504 505 506 507 508 509 510 511
# LibFuzzer
AC_ARG_WITH([libfuzzer],
  AC_HELP_STRING([--with-libfuzzer=path], [Path to LibFuzzer static library]),
  [libfuzzer_LIBS="$withval"], [libfuzzer_LIBS=no]
)
AS_IF([test "$libfuzzer_LIBS" != no -a "$sanitize_coverage_enabled" != yes], [
  AC_MSG_ERROR([Sanitizer coverage required for LibFuzzer.])
])
AM_CONDITIONAL([HAVE_LIBFUZZER], [test "$libfuzzer_LIBS" != "no"])
AC_SUBST([libfuzzer_LIBS])

512 513
AS_IF([test "$enable_documentation" = "yes"],[

514
AC_PATH_PROGS([SPHINXBUILD], [sphinx-build sphinx-build-3], [false])
515 516 517 518 519 520 521 522 523 524
AS_IF([test "$SPHINXBUILD" = "false"],
  [AC_MSG_WARN([Could not find the 'sphinx-build' executable, you will be unable to regenerate documentation.])],
  [AC_PATH_PROG([PDFLATEX], [pdflatex], [false])
   AS_IF([test "$PDFLATEX" = ""],
     [AC_MSG_WARN([Could not find the 'pdflatex' executable, you will be unable to generate PDF documentation.])])
   AC_PATH_PROG([MAKEINFO], [makeinfo], [false])
   AS_IF([test "$MAKEINFO" = "false"],
     [AC_MSG_WARN([Could not find the 'makeinfo' executable, you will be unable to generate info documentation.])])
  ])

525 526
])

527 528 529 530
AM_CONDITIONAL([HAVE_SPHINXBUILD], test "$SPHINXBUILD" != "false")
AM_CONDITIONAL([HAVE_PDFLATEX], test "$PDFLATEX" != "false")
AM_CONDITIONAL([HAVE_MAKEINFO], test "$MAKEINFO" != "false")

Ondřej Surý's avatar
Ondřej Surý committed
531
AC_CONFIG_FILES([Makefile
532 533 534 535 536 537 538 539 540 541 542 543
                 doc/Makefile
                 libtap/Makefile
                 tests/Makefile
                 tests-fuzz/Makefile
                 samples/Makefile
                 src/Makefile
                 src/contrib/dnstap/Makefile
                 src/dnssec/Makefile
                 src/dnssec/tests/Makefile
                 src/dnssec/utils/Makefile
                 src/zscanner/Makefile
                 ])
544

Ondřej Surý's avatar
Ondřej Surý committed
545
AC_OUTPUT
546

547 548 549 550 551
AC_MSG_RESULT([
  $PACKAGE $VERSION

    Target:   $host_os $host_cpu
    Compiler: ${CC}
552
    CFLAGS:   ${CFLAGS} ${CPPFLAGS}
553 554 555 556 557
    LIBS:     ${LIBS} ${LDFLAGS}
    LibURCU:  ${liburcu_LIBS} ${liburcu_CFLAGS}
    GnuTLS:   ${gnutls_LIBS} ${gnutls_CFLAGS}
    Jansson:  ${jansson_LIBS} ${jansson_CFLAGS}
    LMDB:     ${enable_lmdb} ${lmdb_LIBS} ${lmdb_CFLAGS}
558

559
    Sanitizer: ${sanitize_CFLAGS}
560
    LibFuzzer: ${libfuzzer_LIBS}
561

562 563 564 565
    Prefix:      ${prefix}
    Run dir:     ${run_dir}
    Storage dir: ${storage_dir}
    Config dir:  ${config_dir}
566

567 568 569
    Configuration DB mapsize: ${conf_mapsize} MiB
    Timers DB mapsize:        ${timer_mapsize} MiB

570 571 572 573 574
    Knot DNS libraries:     yes
    Knot DNS daemon:        ${enable_daemon}
    Knot DNS utils:         ${enable_utilities}
    Knot DNS documentation: ${enable_documentation}

575
    Use SO_REUSEPORT:    ${enable_reuseport}
576 577 578 579 580
    Fast zone parser:    ${enable_fastparser}
    Utilities with IDN:  ${with_libidn}
    Systemd integration: ${enable_systemd}
    Dnstap support:      ${opt_dnstap}
    Code coverage:       ${enable_code_coverage}
581
    Bash completions:    ${bash_completions_output}
582
    PKCS 11 support:     ${enable_pkcs11}
583 584 585

  Continue with 'make' command
])