configure.ac revision 1.1.1.3 1 # Copyright (C) Internet Systems Consortium, Inc. ("ISC")
2 #
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 #
7 # See the COPYRIGHT file distributed with this work for additional
8 # information regarding copyright ownership.
9
10 AC_INIT(BIND, [9.14], [info (a] isc.org], [], [https://www.isc.org/downloads/BIND/])
11 AC_PREREQ([2.60])
12
13 AC_CONFIG_HEADER(config.h)
14 AC_CONFIG_MACRO_DIR([m4])
15
16 AC_CANONICAL_HOST
17 AC_USE_SYSTEM_EXTENSIONS
18
19 # Enable RFC 3542 APIs on macOS
20 AC_DEFINE([__APPLE_USE_RFC_3542], [1], [Select RFC3542 IPv6 API on macOS])
21
22 AC_PROG_MAKE_SET
23
24 AC_PROG_LIBTOOL
25 AC_PROG_INSTALL
26 AC_PROG_LN_S
27 AX_POSIX_SHELL
28
29 AC_SUBST(STD_CINCLUDES)
30 AC_SUBST(STD_CDEFINES)
31 AC_SUBST(STD_CWARNINGS)
32 AC_SUBST(CCOPT)
33 AC_SUBST(CCNOOPT)
34 AC_SUBST(BACKTRACECFLAGS)
35
36 #
37 # Use pkg-config
38 #
39
40 PKG_PROG_PKG_CONFIG
41
42 # Warn if the user specified libbind, which is now deprecated
43 AC_ARG_ENABLE(libbind, AS_HELP_STRING([--enable-libbind], [deprecated]))
44
45 case "$enable_libbind" in
46 yes)
47 AC_MSG_ERROR(['libbind' is no longer part of the BIND 9 distribution.
48 It is available from http://www.isc.org as a separate download.])
49 ;;
50 no|'')
51 ;;
52 esac
53
54 AC_ARG_ENABLE(buffer_useinline,
55 AS_HELP_STRING([--enable-buffer-useinline],
56 [define ISC_BUFFER_USEINLINE when compiling
57 [default=yes]]),
58 if test yes = "${enable}"
59 then
60 AC_DEFINE([ISC_BUFFER_USEINLINE], [1],
61 [Define if you want to use inline buffers])
62 fi,
63 AC_DEFINE([ISC_BUFFER_USEINLINE], [1]))
64
65 AC_ARG_ENABLE(warn_shadow,
66 AS_HELP_STRING([--enable-warn-shadow],
67 [turn on -Wshadow when compiling]))
68
69 AC_ARG_ENABLE(warn_error,
70 AS_HELP_STRING([--enable-warn-error],
71 [turn on -Werror when compiling]))
72
73 AC_ARG_ENABLE(developer,
74 AS_HELP_STRING([--enable-developer],
75 [enable developer build settings]))
76 XTARGETS=
77 case "$enable_developer" in
78 yes)
79 STD_CDEFINES="$STD_CDEFINES -DISC_MEM_DEFAULTFILL=1 -DISC_LIST_CHECKINIT=1"
80 test "${enable_fixed_rrset+set}" = set || enable_fixed_rrset=yes
81 test "${enable_querytrace+set}" = set || enable_querytrace=yes
82 test "${with_cmocka+set}" = set || with_cmocka=yes
83 test "${with_dlz_filesystem+set}" = set || with_dlz_filesystem=yes
84 test "${enable_symtable+set}" = set || enable_symtable=all
85 test "${enable_warn_error+set}" = set || enable_warn_error=yes
86 test "${enable_warn_shadow+set}" = set || enable_warn_shadow=yes
87 test "${with_zlib+set}" = set || with_zlib=yes
88 XTARGETS='${XTARGETS}'
89 ;;
90 esac
91 AC_SUBST(XTARGETS)
92
93 AC_ARG_ENABLE([fuzzing],
94 [AS_HELP_STRING([--enable-fuzzing=<afl|libfuzzer>],
95 [Enable fuzzing using American Fuzzy Lop or libFuzzer (default=no)])],
96 [],
97 [enable_fuzzing=no])
98
99 AC_MSG_CHECKING([whether to enable fuzzing mode])
100 AS_CASE([$enable_fuzzing],
101 [no],[AC_MSG_RESULT([no])],
102 [afl],[
103 AC_MSG_RESULT([using AFL])
104 AC_DEFINE([ENABLE_AFL], [1],
105 [Define to enable American Fuzzy Lop test harness])
106 CFLAGS="$CFLAGS -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION=1"
107 LIBS="$LIBS -lpthread"],
108 [libfuzzer],[
109 AC_MSG_RESULT([using libFuzzer])
110 CFLAGS="$CFLAGS -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION=1 -fsanitize=fuzzer,address,undefined"
111 LDFLAGS="$LDFLAGS -fsanitize=fuzzer,address,undefined"],
112 [*],[AC_MSG_ERROR([You need to explicitly select the fuzzer])])
113
114 AS_IF([test "$enable_fuzzing" = "afl"],
115 [AC_MSG_CHECKING("for AFL enabled compiler")
116 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
117 [#ifndef __AFL_COMPILER
118 #error AFL compiler required
119 #endif
120 ])],
121 [AC_MSG_RESULT([yes])],
122 [AC_MSG_ERROR([set CC=afl-<gcc|clang> when --enable-fuzzing=afl is used])])
123 ])
124
125 #
126 # Make very sure that these are the first files processed by
127 # config.status, since we use the processed output as the input for
128 # AC_SUBST_FILE() substitutions in other files.
129 #
130 AC_CONFIG_FILES([make/rules make/includes])
131
132 AC_PATH_PROG(AR, ar)
133 ARFLAGS="cruv"
134 AC_SUBST(AR)
135 AC_SUBST(ARFLAGS)
136
137 # The POSIX ln(1) program. Non-POSIX systems may substitute
138 # "copy" or something.
139 LN=ln
140 AC_SUBST(LN)
141
142 case "$AR" in
143 "")
144 AC_MSG_ERROR([
145 ar program not found. Please fix your PATH to include the directory in
146 which ar resides, or set AR in the environment with the full path to ar.
147 ])
148
149 ;;
150 esac
151
152 #
153 # Etags.
154 #
155 AC_PATH_PROGS(ETAGS, etags emacs-etags)
156
157 #
158 # Some systems, e.g. RH7, have the Exuberant Ctags etags instead of
159 # GNU emacs etags, and it requires the -L flag.
160 #
161 if test "X$ETAGS" != "X"; then
162 AC_MSG_CHECKING(for Exuberant Ctags etags)
163 if $ETAGS --version 2>&1 | grep 'Exuberant Ctags' >/dev/null 2>&1; then
164 AC_MSG_RESULT(yes)
165 ETAGS="$ETAGS -L"
166 else
167 AC_MSG_RESULT(no)
168 fi
169 fi
170 AC_SUBST(ETAGS)
171
172 #
173 # Perl is optional; it is used only by some of the system test scripts.
174 # Note: the backtrace feature (see below) uses perl to build the symbol table,
175 # but it still compiles without perl, in which case an empty table will be used.
176 #
177 AC_PATH_PROGS(PERL, perl5 perl)
178 AC_SUBST(PERL)
179
180 #
181 # Python is also optional but required by default so that dnssec-keymgr gets
182 # installed unless explicitly prevented by the user using --without-python.
183 #
184 testminvers='import sys
185 if (sys.version_info < (2,7)) or (sys.version_info < (3,2) and sys.version_info >= (3,0)):
186 exit(1)'
187
188 testargparse='try: import argparse
189 except: exit(1)'
190
191 testply='try: import ply
192 except: exit(1)'
193
194 default_with_python="python python3 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python2 python2.7"
195
196 AC_ARG_WITH([python],
197 AS_HELP_STRING([--with-python=PATH],
198 [specify path to Python interpreter]),
199 [], [with_python=$default_with_python])
200 AC_ARG_WITH([python-install-dir],
201 AS_HELP_STRING([--with-python-install-dir=PATH],
202 [installation directory for Python modules]),
203 [], with_python_install_dir="")
204
205 AS_IF([test "$with_python" = "yes"],
206 [with_python=$default_with_python])
207
208 AS_IF([test "$with_python" = "no"],
209 [AC_MSG_CHECKING([for Python support])
210 AC_MSG_RESULT([disabled])],
211 [for p in $with_python
212 do
213 AS_CASE([$p],
214 [/*],[PYTHON="$p"])
215
216 AC_PATH_PROG([PYTHON], [$p])
217 # Do not cache the result of the check from the previous line. If the
218 # first found Python interpreter has missing module dependencies and
219 # the result of the above check is cached, subsequent module checks
220 # will erroneously keep on using the cached path to the first found
221 # Python interpreter instead of different ones.
222 unset ac_cv_path_PYTHON
223
224 AS_IF([test -z "$PYTHON"], [continue])
225
226 AC_MSG_CHECKING([if $PYTHON is python2 version >= 2.7 or python3 version >= 3.2])
227 AS_IF(["$PYTHON" -c "$testminvers" 2>/dev/null],
228 [AC_MSG_RESULT([yes])],
229 [AC_MSG_RESULT([no])
230 unset PYTHON
231 continue])
232
233 AC_MSG_CHECKING([Python module 'argparse'])
234 AS_IF(["$PYTHON" -c "$testargparse" 2>/dev/null],
235 [AC_MSG_RESULT([yes])],
236 [AC_MSG_RESULT([no])
237 unset PYTHON
238 continue])
239
240 AC_MSG_CHECKING([Python module 'ply'])
241 AS_IF(["$PYTHON" -c "$testply" 2>/dev/null],
242 [AC_MSG_RESULT([yes])],
243 [AC_MSG_RESULT([no])
244 unset PYTHON
245 continue])
246
247 # Stop looking any further once we find a Python interpreter
248 # satisfying all requirements.
249 break
250 done
251
252 AS_IF([test "X$PYTHON" = "X"],
253 [AC_MSG_CHECKING([for Python support])
254 AC_MSG_RESULT([no])
255 AC_MSG_ERROR([Python required for dnssec-keymgr])])])
256
257 PYTHON_TOOLS=''
258 CHECKDS=''
259 COVERAGE=''
260 KEYMGR=''
261 AS_IF([test "X$PYTHON" != "X"],
262 [PYTHON_TOOLS=python
263 CHECKDS=checkds
264 COVERAGE=coverage
265 KEYMGR=keymgr
266 PYTHON_INSTALL_DIR="$with_python_install_dir"
267 AS_IF([test -n "$with_python_install_dir"],
268 [PYTHON_INSTALL_LIB="--install-lib=$with_python_install_dir"])])
269 AC_SUBST(CHECKDS)
270 AC_SUBST(COVERAGE)
271 AC_SUBST(KEYMGR)
272 AC_SUBST(PYTHON_TOOLS)
273 AC_SUBST(PYTHON_INSTALL_DIR)
274 AC_SUBST(PYTHON_INSTALL_LIB)
275
276 #
277 # Special processing of paths depending on whether --prefix,
278 # --sysconfdir or --localstatedir arguments were given. What's
279 # desired is some compatibility with the way previous versions
280 # of BIND built; they defaulted to /usr/local for most parts of
281 # the installation, but named.boot/named.conf was in /etc
282 # and named.pid was in /var/run.
283 #
284 # So ... if none of --prefix, --sysconfdir or --localstatedir are
285 # specified, set things up that way. If --prefix is given, use
286 # it for sysconfdir and localstatedir the way configure normally
287 # would. To change the prefix for everything but leave named.conf
288 # in /etc or named.pid in /var/run, then do this the usual configure way:
289 # ./configure --prefix=/somewhere --sysconfdir=/etc
290 # ./configure --prefix=/somewhere --localstatedir=/var
291 #
292 # To put named.conf and named.pid in /usr/local with everything else,
293 # set the prefix explicitly to /usr/local even though that's the default:
294 # ./configure --prefix=/usr/local
295 #
296 case "$prefix" in
297 NONE)
298 case "$sysconfdir" in
299 '${prefix}/etc')
300 sysconfdir=/etc
301 ;;
302 esac
303 case "$localstatedir" in
304 '${prefix}/var')
305 localstatedir=/var
306 ;;
307 esac
308 ;;
309 esac
310 expanded_sysconfdir=`eval echo $sysconfdir`
311 AC_SUBST(expanded_sysconfdir)
312
313 #
314 # Make sure INSTALL uses an absolute path, else it will be wrong in all
315 # Makefiles, since they use make/rules.in and INSTALL will be adjusted by
316 # configure based on the location of the file where it is substituted.
317 # Since in BIND9 INSTALL is only substituted into make/rules.in, an immediate
318 # subdirectory of install-sh, This relative path will be wrong for all
319 # directories more than one level down from install-sh.
320 #
321 case "$INSTALL" in
322 /*)
323 ;;
324 *)
325 #
326 # Not all systems have dirname.
327 #
328 changequote({, })
329 ac_dir="`echo $INSTALL | sed 's%/[^/]*$%%'`"
330 changequote([, ])
331
332 ac_prog="`echo $INSTALL | sed 's%.*/%%'`"
333 test "X$ac_dir" = "X$ac_prog" && ac_dir=.
334 test -d "$ac_dir" && ac_dir="`(cd \"$ac_dir\" && pwd)`"
335 INSTALL="$ac_dir/$ac_prog"
336 ;;
337 esac
338
339 AC_PROG_CC
340 AC_PROG_CC_C99
341
342 #
343 # CCNOOPT defaults to -O0 on gcc and disables optimization when is last
344 #
345 if test "X$CCNOOPT" = "X" -a "X$GCC" = "Xyes"; then
346 CCNOOPT="-O0"
347 fi
348
349 AC_HEADER_STDC
350
351 AC_CHECK_HEADERS(fcntl.h regex.h sys/time.h unistd.h sys/mman.h sys/sockio.h sys/select.h sys/param.h sys/sysctl.h net/if6.h sys/socket.h net/route.h linux/netlink.h linux/rtnetlink.h,,,
352 [$ac_includes_default
353 #ifdef HAVE_SYS_PARAM_H
354 # include <sys/param.h>
355 #endif
356 #ifdef HAVE_SYS_SOCKET_H
357 # include <sys/socket.h>
358 #endif
359 ])
360
361 #
362 # Check for thread local storage
363 #
364 AC_CHECK_HEADERS([threads.h],
365 [
366 AC_MSG_CHECKING([for C11 Thread-Local Storage using thread_local])
367 AC_COMPILE_IFELSE(
368 [AC_LANG_PROGRAM(
369 [
370 #include <threads.h>
371 ],[
372 static thread_local int tls = 0;
373 return (tls);
374 ])
375 ],[
376 AC_MSG_RESULT([yes])
377 AC_DEFINE([HAVE_THREAD_LOCAL],[1],[Define if thread_local keyword is available])
378 AC_DEFINE([HAVE_TLS],[1],[Define if Thread-Local Storage is available])
379 ],[
380 AC_MSG_RESULT([no])
381 ])
382 ],[
383 AC_MSG_CHECKING([for Thread-Local Storage using __thread])
384 AC_COMPILE_IFELSE(
385 [AC_LANG_PROGRAM(
386 [
387 ],[
388 static __thread int tls = 0;
389 return (tls);
390 ])
391 ],[
392 AC_MSG_RESULT([yes])
393 AC_DEFINE([HAVE___THREAD],[1],[Define if __thread keyword is available])
394 AC_DEFINE([HAVE_TLS],[1],[Define if Thread-Local Storage is available])
395 ],[
396 AC_MSG_RESULT([no])
397 ])
398 ])
399
400 AC_C_CONST
401 AC_C_INLINE
402 AC_C_VOLATILE
403 AC_C_FLEXIBLE_ARRAY_MEMBER
404
405 #
406 # Check for yield support on ARM processors
407 #
408 AS_CASE([$host],
409 [arm*],[
410 AC_MSG_CHECKING([for yield instruction support])
411 AC_COMPILE_IFELSE(
412 [AC_LANG_PROGRAM(
413 [[]],
414 [[__asm__ __volatile__ ("yield")]]
415 )],
416 [AC_MSG_RESULT([yes])],
417 [AC_MSG_ERROR([no, try adding -march=native or -march=armv7-a to CFLAGS (see PLATFORMS.md for more information)])])])
418
419 AC_CHECK_FUNCS([sysctlbyname])
420
421 #
422 # Check for the existence of mmap to enable the fast format zones
423 #
424 AC_CHECK_FUNCS(mmap)
425
426 #
427 # Older versions of HP/UX don't define seteuid() and setegid()
428 #
429 AC_CHECK_FUNCS(seteuid setresuid)
430 AC_CHECK_FUNCS(setegid setresgid)
431
432 AC_TYPE_SIZE_T
433 AC_TYPE_SSIZE_T
434 AC_TYPE_UINTPTR_T
435
436 AC_HEADER_TIME
437
438 #
439 # check for uname library routine
440 #
441 AC_MSG_CHECKING([for uname])
442 AC_COMPILE_IFELSE(
443 [AC_LANG_PROGRAM(
444 [[#include <sys/utsname.h>
445 #include <stdio.h>
446 ]],
447 [[
448 struct utsname uts;
449 uname(&uts);
450 printf("running on %s %s %s for %s\n",
451 uts.sysname, uts.release, uts.version, uts.machine);
452 ]])],
453 [AC_MSG_RESULT(yes)
454 AC_DEFINE([HAVE_UNAME], [1], [define if uname is available])
455 ],
456 [AC_MSG_RESULT(no)
457 AC_MSG_WARN([uname is not correctly supported])
458 ])
459
460 #
461 # check for GCC noreturn attribute
462 #
463 AC_MSG_CHECKING(for GCC noreturn attribute)
464 AC_TRY_COMPILE([],[void foo() __attribute__((noreturn));],
465 [AC_MSG_RESULT(yes)
466 ISC_PLATFORM_NORETURN_PRE="#define ISC_PLATFORM_NORETURN_PRE"
467 ISC_PLATFORM_NORETURN_POST="#define ISC_PLATFORM_NORETURN_POST __attribute__((noreturn))"],
468 [AC_MSG_RESULT(no)
469 ISC_PLATFORM_NORETURN_PRE="#define ISC_PLATFORM_NORETURN_PRE"
470 ISC_PLATFORM_NORETURN_POST="#define ISC_PLATFORM_NORETURN_POST"])
471 AC_SUBST(ISC_PLATFORM_NORETURN_PRE)
472 AC_SUBST(ISC_PLATFORM_NORETURN_POST)
473
474 #
475 # check if we have kqueue
476 #
477 AC_ARG_ENABLE([kqueue],
478 [AS_HELP_STRING([--enable-kqueue],
479 [use BSD kqueue when available [default=yes]])],
480 [], enable_kqueue="yes")
481
482 AS_IF([test "$enable_kqueue" = "yes"],
483 [AC_CHECK_FUNCS([kqueue])])
484
485 #
486 # check if we have epoll. Linux kernel 2.4 has epoll_create() which fails,
487 # so we need to try running the code, not just test its existence.
488 #
489 AC_ARG_ENABLE([epoll],
490 [AS_HELP_STRING([--enable-epoll],
491 [use Linux epoll when available [default=auto]])],
492 [], [enable_epoll="yes"])
493
494 AS_IF([test "$enable_epoll" = "yes"],
495 [AC_CHECK_FUNCS([epoll_create1])])
496
497 #
498 # check if we support /dev/poll
499 #
500 AC_ARG_ENABLE([devpoll],
501 [AS_HELP_STRING([--enable-devpoll],
502 [use /dev/poll when available [default=yes]])],
503 [], [enable_devpoll="yes"])
504 AS_IF([test "$enable_devpoll" = "yes"],
505 [AC_CHECK_HEADERS([sys/devpoll.h devpoll.h])])
506
507 #
508 # Find the machine's endian flavor.
509 #
510 AC_C_BIGENDIAN
511
512 #
513 # GeoIP support?
514 #
515 GEOIPLINKSRCS=
516 GEOIPLINKOBJS=
517 AC_ARG_WITH(geoip,
518 AS_HELP_STRING([--with-geoip=PATH],
519 [Build with GeoIP support (yes|no|path)]),
520 use_geoip="$withval", use_geoip="no")
521
522 if test "yes" = "$use_geoip"
523 then
524 for d in /usr /usr/local /opt/local
525 do
526 if test -f $d/include/GeoIP.h
527 then
528 use_geoip=$d
529 break
530 fi
531 done
532 fi
533
534 case "$use_geoip" in
535 no|'')
536 AC_MSG_CHECKING([for GeoIP support])
537 AC_MSG_RESULT([disabled])
538 ;;
539 *)
540 if test -d "$use_geoip" -o -L "$use_geoip"
541 then
542 CFLAGS="$CFLAGS -I$use_geoip/include"
543 CPPFLAGS="$CPPFLAGS -I$use_geoip/include"
544 LIBS="$LIBS -L$use_geoip/lib"
545 case "$host_os" in
546 netbsd*|openbsd*|solaris*)
547 LIBS="$LIBS -Wl,-rpath=$use_geoip/lib"
548 ;;
549 esac
550 elif test "yes" = "$use_geoip"
551 then
552 AC_MSG_ERROR([GeoIP path not found])
553 else
554 AC_MSG_ERROR([GeoIP path $use_geoip does not exist])
555 fi
556 AC_CHECK_HEADER(GeoIP.h, [],
557 [AC_MSG_ERROR([GeoIP header file not found])]
558 )
559 AC_SEARCH_LIBS(GeoIP_id_by_addr_gl, GeoIP, [],
560 [AC_MSG_ERROR([suitable GeoIP library not found])]
561 )
562 AC_SEARCH_LIBS(fabsf, m, [],
563 [AC_MSG_ERROR([Math library not found])]
564 )
565 AC_DEFINE(HAVE_GEOIP, 1, Build with GeoIP support)
566 GEOIPLINKSRCS='${GEOIPLINKSRCS}'
567 GEOIPLINKOBJS='${GEOIPLINKOBJS}'
568 AC_MSG_CHECKING([for GeoIP support])
569 AC_MSG_RESULT([yes])
570
571 AC_MSG_CHECKING([for GeoIP Country IPv6 support])
572 AC_COMPILE_IFELSE(
573 [AC_LANG_PROGRAM([
574 #include <GeoIP.h>
575 #include <netinet/in.h>
576 ], [
577 struct in6_addr in6;
578 GeoIP_country_name_by_ipnum_v6(NULL, in6);
579 ])],
580 [
581 AC_MSG_RESULT([yes])
582 AC_DEFINE(HAVE_GEOIP_V6, 1, Build with GeoIP Country IPv6 support)
583 ],
584 [AC_MSG_RESULT([no])]
585 )
586
587 AC_MSG_CHECKING([for GeoIP City IPv6 support])
588 AC_COMPILE_IFELSE(
589 [AC_LANG_PROGRAM([
590 #include <GeoIP.h>
591 #include <GeoIPCity.h>
592 #include <netinet/in.h>
593 ], [
594 struct in6_addr in6;
595 int i = GEOIP_CITY_EDITION_REV0_V6;
596 GeoIP_record_by_ipnum_v6(NULL, in6);
597 ])],
598 [
599 AC_MSG_RESULT([yes])
600 AC_DEFINE(HAVE_GEOIP_CITY_V6, 1, Build with GeoIP City IPv6 support)
601 ],
602 [AC_MSG_RESULT([no])]
603 )
604 ;;
605 esac
606 AC_SUBST(GEOIPLINKSRCS)
607 AC_SUBST(GEOIPLINKOBJS)
608
609 #
610 # Do we have arc4random(), etc ?
611 #
612 AC_CHECK_FUNCS(arc4random arc4random_buf arc4random_uniform getrandom)
613
614 AX_PTHREAD
615
616 LIBS="$PTHREAD_LIBS $LIBS"
617 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
618 CC="$PTHREAD_CC"
619
620 #
621 # We'd like to use sigwait() too
622 #
623 AC_CHECK_FUNCS([sigwait pthread_attr_getstacksize pthread_attr_setstacksize])
624
625 AC_ARG_WITH([locktype],
626 AS_HELP_STRING([--with-locktype=ARG],
627 [Specify mutex lock type
628 (adaptive or standard)]),
629 [], [with_locktype="adaptive"])
630
631 AS_CASE([$with_locktype],
632 [adaptive],[
633 AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
634 AC_COMPILE_IFELSE(
635 [AC_LANG_PROGRAM(
636 [[
637 #ifndef _GNU_SOURCE
638 #define _GNU_SOURCE
639 #endif
640 #include <pthread.h>
641 ]],
642 [[
643 return (PTHREAD_MUTEX_ADAPTIVE_NP);
644 ]]
645 )],
646 [AC_MSG_RESULT([using adaptive lock type])
647 AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
648 [Support for PTHREAD_MUTEX_ADAPTIVE_NP]) ],
649 [AC_MSG_RESULT([using standard lock type])]
650 )],
651 [standard],[AC_MSG_RESULT([using standard lock type])],
652 [AC_MSG_ERROR([You must specify "adaptive" or "standard" for --with-locktype.])]
653 )
654
655 AC_CHECK_HEADERS([sched.h])
656
657 AC_SEARCH_LIBS([sched_yield],[rt])
658 AC_CHECK_FUNCS([sched_yield pthread_yield pthread_yield_np])
659
660 AC_CHECK_HEADERS([sys/cpuset.h])
661 AC_CHECK_HEADERS([sys/procset.h])
662 AC_CHECK_FUNCS([pthread_setaffinity_np cpuset_setaffinity processor_bind sched_setaffinity])
663
664 # Look for functions relating to thread naming
665 AC_CHECK_FUNCS([pthread_setname_np pthread_set_name_np])
666 AC_CHECK_HEADERS([pthread_np.h], [], [], [#include <pthread.h>])
667
668 #
669 # flockfile is usually provided by pthreads
670 #
671 AC_CHECK_FUNCS([flockfile getc_unlocked])
672
673 #
674 # Look for sysconf to allow detection of the number of processors.
675 #
676 AC_CHECK_FUNCS([sysconf])
677
678 AC_SUBST(ALWAYS_DEFINES)
679
680 AC_MSG_CHECKING(for libtool)
681 AC_ARG_WITH(libtool, AS_HELP_STRING([--with-libtool], [use GNU libtool]),
682 use_libtool="$withval", use_libtool="no")
683
684 case $use_libtool in
685 yes)
686 AC_MSG_RESULT(yes)
687 AM_PROG_LIBTOOL
688 O=lo
689 A=la
690 LIBTOOL_MKDEP_SED='s;\.o;\.lo;'
691 LIBTOOL_MODE_COMPILE='--mode=compile'
692 LIBTOOL_MODE_INSTALL='--mode=install'
693 LIBTOOL_MODE_LINK='--mode=link'
694 LIBTOOL_MODE_UNINSTALL='--mode=uninstall'
695 INSTALL_LIBRARY='${INSTALL_PROGRAM}'
696 ;;
697 *)
698 AC_MSG_RESULT(no)
699 O=o
700 A=a
701 LIBTOOL=
702 AC_SUBST(LIBTOOL)
703 LIBTOOL_MKDEP_SED=
704 LIBTOOL_MODE_COMPILE=
705 LIBTOOL_MODE_INSTALL=
706 LIBTOOL_MODE_LINK=
707 LIBTOOL_MODE_UNINSTALL=
708 INSTALL_LIBRARY='${INSTALL_DATA}'
709 ;;
710 esac
711 AC_SUBST(INSTALL_LIBRARY)
712
713 #
714 # If PIC is disabled, shared libraries must also be
715 #
716 AS_IF([test "$pic_mode" = "no"],
717 [enable_shared="no"])
718
719 CRYPTO=OpenSSL
720
721 #
722 # was --with-openssl specified?
723 #
724 AX_CHECK_OPENSSL([:],[AC_MSG_FAILURE([OpenSSL/LibreSSL not found])])
725
726 save_CFLAGS="$CFLAGS"
727 save_LIBS="$LIBS"
728 save_LDFLAGS="$LDFLAGS"
729 CFLAGS="$CFLAGS $OPENSSL_INCLUDES"
730 LIBS="$LIBS $OPENSSL_LIBS"
731 LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
732
733 AC_MSG_CHECKING([for OpenSSL >= 1.0.0 or LibreSSL])
734 AC_COMPILE_IFELSE(
735 [AC_LANG_PROGRAM([[#include <openssl/opensslv.h>]],
736 [[#if !defined(LIBRESSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER < 0x1000000fL)
737 #error OpenSSL >= 1.0.0 or LibreSSL required
738 #endif
739 ]])],
740 [AC_MSG_RESULT([yes])],
741 [AC_MSG_FAILURE([not found])])
742
743 #
744 # Check for functions added in OpenSSL or LibreSSL
745 #
746
747 AC_CHECK_FUNCS([CRYPTO_zalloc])
748 AC_CHECK_FUNCS([EVP_CIPHER_CTX_new EVP_CIPHER_CTX_free])
749 AC_CHECK_FUNCS([EVP_MD_CTX_new EVP_MD_CTX_free EVP_MD_CTX_reset])
750 AC_CHECK_FUNCS([HMAC_CTX_new HMAC_CTX_free HMAC_CTX_reset HMAC_CTX_get_md])
751
752 #
753 # Check for algorithm support in OpenSSL
754 #
755
756 AC_CHECK_FUNCS([ECDSA_sign ECDSA_verify], [:],
757 [AC_MSG_FAILURE([ECDSA support in OpenSSL is mandatory.])])
758
759 AC_MSG_CHECKING([for ECDSA P-256 support])
760 AC_COMPILE_IFELSE(
761 [AC_LANG_PROGRAM([[#include <openssl/evp.h>
762 #include <openssl/ec.h>]],
763 [[EC_KEY *key = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);]])],
764 [AC_MSG_RESULT([yes])],
765 [AC_MSG_FAILURE([not found. ECDSA P-256 support in OpenSSL is mandatory.])])
766
767 AC_MSG_CHECKING([for ECDSA P-384 support])
768 AC_COMPILE_IFELSE(
769 [AC_LANG_PROGRAM([[#include <openssl/evp.h>
770 #include <openssl/ec.h>]],
771 [[EC_KEY *key = EC_KEY_new_by_curve_name(NID_secp384r1);]])],
772 [AC_MSG_RESULT([yes])],
773 [AC_MSG_FAILURE([not found. ECDSA P-384 support in OpenSSL is mandatory.])])
774
775 AC_MSG_CHECKING([for Ed25519 support])
776 AC_COMPILE_IFELSE(
777 [AC_LANG_PROGRAM([[#include <openssl/evp.h>
778 #include <openssl/ec.h>]],
779 [[EC_KEY *key = EC_KEY_new_by_curve_name(NID_ED25519);]])],
780 [AC_DEFINE([HAVE_OPENSSL_ED25519], [1], [define if OpenSSL supports Ed25519])
781 AC_MSG_RESULT([yes])],
782 [AC_MSG_RESULT([no])])
783
784 AC_MSG_CHECKING([for Ed448 support])
785 AC_MSG_RESULT([broken])
786 #AC_COMPILE_IFELSE(
787 # [AC_LANG_PROGRAM([[#include <openssl/evp.h>
788 # #include <openssl/ec.h>]],
789 # [[EC_KEY *key = EC_KEY_new_by_curve_name(NID_ED448);]])],
790 # [AC_DEFINE([HAVE_OPENSSL_ED448], [1], [define if OpenSSL supports Ed448])
791 # AC_MSG_RESULT([yes])],
792 # [AC_MSG_RESULT([no])])
793
794 #
795 # Check for OpenSSL SHA-1 support
796 #
797 AC_CHECK_FUNCS([EVP_sha1], [:],
798 [AC_MSG_FAILURE([SHA-1 support in OpenSSL is mandatory.])])
799
800 #
801 # Check for OpenSSL SHA-2 support
802 #
803 AC_CHECK_FUNCS([EVP_sha224 EVP_sha256 EVP_sha384 EVP_sha512], [:],
804 [AC_MSG_FAILURE([SHA-2 support in OpenSSL is mandatory.])])
805
806 #
807 # Check for OpenSSL AES support
808 #
809 AC_CHECK_FUNCS([EVP_aes_128_ecb EVP_aes_192_ecb EVP_aes_256_ecb], [:],
810 [AC_MSG_FAILURE([AES support in OpenSSL is mandatory.])])
811
812 #
813 # Check for OpenSSL 1.1.x/LibreSSL functions
814 #
815 AC_CHECK_FUNCS([DH_get0_key ECDSA_SIG_get0 RSA_set0_key])
816
817 #
818 # Check whether FIPS mode is available and whether we should enable it
819 #
820 AC_ARG_ENABLE([fips-mode],
821 [AS_HELP_STRING([--enable-fips-mode],
822 [enable FIPS mode in OpenSSL library [default=no]])],
823 [], [enable_fips_mode="no"])
824
825 AC_MSG_CHECKING([whether to enable FIPS mode in OpenSSL library])
826 AS_CASE([$enable_fips_mode],
827 [yes], [AC_MSG_RESULT([yes])
828 AC_CHECK_FUNCS([FIPS_mode],
829 [], [AC_MSG_FAILURE([OpenSSL FIPS mode requested but not available.])])],
830 [no], [AC_MSG_RESULT([no])])
831
832 CFLAGS="$save_CFLAGS"
833 LIBS="$save_LIBS"
834 LDFLAGS="$save_LDFLAGS"
835
836 AC_SUBST([OPENSSL_INCLUDES])
837 AC_SUBST([OPENSSL_LIBS])
838 AC_SUBST([OPENSSL_LDFLAGS])
839
840 #
841 # Client Cookie algorithm choice
842 #
843 AC_ARG_WITH([cc-alg],
844 [AS_HELP_STRING([--with-cc-alg=ALG],
845 [choose the algorithm for Client Cookie
846 [aes|sha1|sha256] (default is aes)])],
847 [:], [with_cc_alg="aes"])
848
849 AC_MSG_CHECKING([for the algorithm for Client Cookie])
850 AS_CASE([$with_cc_alg],
851 [sha1|SHA1],[AC_MSG_RESULT([sha1])
852 AC_DEFINE([HMAC_SHA1_CC], [1], [Use HMAC-SHA1 for Client Cookie generation])],
853 [sha256|SHA256],[AC_MSG_RESULT([sha256])
854 AC_DEFINE([HMAC_SHA256_CC], [1], [Use HMAC-SHA256 for Client Cookie generation])],
855 [aes|AES|auto],[AC_MSG_RESULT([aes])
856 AC_DEFINE([AES_CC], [1], [Use AES for Client Cookie generation])],
857 [AC_MSG_ERROR([Invalid $with_cc_alg algorithm for Client Cookie])])
858
859
860 PKCS11_TOOLS=
861 PKCS11_TEST=
862 #
863 # was --enable-native-pkcs11 specified?
864 #
865 AC_ARG_ENABLE(native-pkcs11,
866 AS_HELP_STRING([--enable-native-pkcs11],
867 [use native PKCS11 for public-key crypto [default=no]]),
868 [:], [enable_native_pkcs11="no"])
869
870 AC_MSG_CHECKING([for PKCS11 for Public-Key Cryptography])
871 AS_CASE([$enable_native_pkcs11],
872 [no],[AC_MSG_RESULT([no])],
873 [yes],[PKCS11_TOOLS=pkcs11
874 PKCS11_TEST=pkcs11
875 CRYPTO=pkcs11
876 AS_IF([$use_threads],
877 [:],
878 [AC_MSG_ERROR([PKCS11 requires threading support])])
879 AC_MSG_RESULT([yes])
880 AC_CHECK_FUNCS([getpassphrase])
881 ])
882 AC_SUBST([PKCS11_TEST])
883 AC_SUBST([PKCS11_TOOLS])
884
885 AS_CASE([$CRYPTO],
886 [pkcs11],[AC_DEFINE([USE_PKCS11], [1], [define if PKCS11 is used for Public-Key Cryptography])],
887 [AC_DEFINE([USE_OPENSSL], [1], [define if OpenSSL is used for Public-Key Cryptography])])
888
889 # preparation for automake
890 # AM_CONDITIONAL([PKCS11_TOOLS], [test "$with_native_pkcs11" = "yes"])
891
892 #
893 # was --with-pkcs11 specified?
894 #
895 AC_ARG_WITH([pkcs11],
896 [AS_HELP_STRING([--with-pkcs11[=PATH]],
897 [Build with PKCS11 support [no|path] (PATH is for the PKCS11 provider)])],
898 [:], [with_pkcs11="undefined"])
899
900 AS_CASE([$with_pkcs11],
901 [yes|auto],[AC_MSG_ERROR([--with-pkcs11 needs explicit path to the PKCS11 library])],
902 [no|undefined],[with_pkcs11="undefined"])
903 AC_DEFINE_UNQUOTED([PK11_LIB_LOCATION], ["$with_pkcs11"], [define the default PKCS11 library path])
904
905 # for PKCS11 benchmarks
906
907 have_clock_gt=no
908 AC_CHECK_FUNC(clock_gettime,have_clock_gt=yes,)
909 if test "no" = "$have_clock_gt"; then
910 AC_CHECK_LIB(rt,clock_gettime,have_clock_gt=rt,)
911 fi
912
913 if test "no" != "$have_clock_gt"; then
914 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if clock_gettime is available.])
915 fi
916
917 if test "rt" = "$have_clock_gt"; then
918 LIBS="-lrt $LIBS"
919 fi
920
921 AC_MSG_CHECKING(for GSSAPI library)
922 AC_ARG_WITH(gssapi,
923 AS_HELP_STRING([--with-gssapi=[PATH|[/path/]krb5-config]],
924 [Specify path for system-supplied GSSAPI
925 [default=yes]]),
926 use_gssapi="$withval", use_gssapi="yes")
927
928 # first try using krb5-config, if that does not work then fall back to "yes" method.
929
930 case "$use_gssapi" in
931 */krb5-config|krb5-config)
932 AC_MSG_RESULT(trying $use_gssapi)
933 if test krb5-config = "$use_gssapi"
934 then
935 AC_PATH_PROG(KRB5_CONFIG, $use_gssapi)
936 else
937 KRB5_CONFIG="$use_gssapi"
938 fi
939 gssapi_cflags=`$KRB5_CONFIG --cflags gssapi`
940 gssapi_libs=`$KRB5_CONFIG --libs gssapi`
941 saved_cppflags="$CPPFLAGS"
942 CPPFLAGS="$gssapi_cflags $CPPFLAGS"
943 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h,
944 [ISC_PLATFORM_GSSAPIHEADER="#define ISC_PLATFORM_GSSAPIHEADER <$ac_header>"])
945 if test "" = "$ISC_PLATFORM_GSSAPIHEADER"; then
946 AC_MSG_RESULT([krb5-config: gssapi.h not found])
947 CPPFLAGS="$saved_cppflags"
948 use_gssapi="yes"
949 else
950 AC_CHECK_HEADERS(krb5/krb5.h krb5.h,
951 [ISC_PLATFORM_KRB5HEADER="#define ISC_PLATFORM_KRB5HEADER <$ac_header>"])
952 if test "" = "$ISC_PLATFORM_KRB5HEADER"; then
953 AC_MSG_RESULT([krb5-config: krb5.h not found])
954 CPPFLAGS="$saved_cppflags"
955 use_gssapi="yes"
956 else
957 CPPFLAGS="$saved_cppflags"
958 saved_libs="$LIBS"
959 LIBS=$gssapi_libs
960 AC_MSG_CHECKING([krb5-config linking as $LIBS])
961 AC_TRY_LINK( , [gss_acquire_cred();krb5_init_context()],
962 gssapi_linked=yes, gssapi_linked=no)
963 case $gssapi_linked in
964 yes) AC_MSG_RESULT([krb5-config: linked]);;
965 no) AC_MSG_RESULT([krb5-config: could not determine proper GSSAPI linkage])
966 use_gssapi="yes"
967 ;;
968 esac
969 LIBS=$saved_libs
970 fi
971 fi
972 if test "yes" = "$use_gssapi"; then
973 AC_MSG_CHECKING([for GSSAPI library, non krb5-config method])
974 fi
975 ;;
976 esac
977
978 case "$host" in
979 *darwin*)
980 if test "yes" = "$use_gssapi"
981 then
982 use_gssapi=framework
983 fi
984 ;;
985 esac
986
987 # gssapi is just the framework, we really require kerberos v5, so
988 # look for those headers (the gssapi headers must be there, too)
989 # The problem with this implementation is that it doesn't allow
990 # for the specification of gssapi and krb5 headers in different locations,
991 # which probably ought to be fixed although fixing might raise the issue of
992 # trying to build with incompatible versions of gssapi and krb5.
993 if test "yes" = "$use_gssapi"
994 then
995 # first, deal with the obvious
996 if test \( -f /usr/include/kerberosv5/krb5.h -o \
997 -f /usr/include/krb5/krb5.h -o \
998 -f /usr/include/krb5.h \) -a \
999 \( -f /usr/include/gssapi.h -o \
1000 -f /usr/include/gssapi/gssapi.h \)
1001 then
1002 use_gssapi=/usr
1003 else
1004 krb5dirs="/usr/local /usr/local/krb5 /usr/local/kerberosv5 /usr/local/kerberos /usr/pkg /usr/krb5 /usr/kerberosv5 /usr/kerberos /usr"
1005 for d in $krb5dirs
1006 do
1007 if test -f $d/include/gssapi/gssapi_krb5.h -o \
1008 -f $d/include/krb5.h
1009 then
1010 if test -f $d/include/gssapi/gssapi.h -o \
1011 -f $d/include/gssapi.h
1012 then
1013 use_gssapi=$d
1014 break
1015 fi
1016 fi
1017 use_gssapi="no"
1018 done
1019 fi
1020 fi
1021
1022 case "$use_gssapi" in
1023 no)
1024 AC_MSG_RESULT(disabled)
1025 USE_GSSAPI=''
1026 ;;
1027 yes)
1028 AC_MSG_ERROR([--with-gssapi must specify a path])
1029 ;;
1030 */krb5-config|krb5-config)
1031 USE_GSSAPI='-DGSSAPI'
1032 DST_GSSAPI_INC="$gssapi_cflags"
1033 DNS_GSSAPI_LIBS="$gssapi_libs"
1034 ;;
1035 framework)
1036 USE_GSSAPI='-DGSSAPI'
1037 ISC_PLATFORM_GSSAPIHEADER="#define ISC_PLATFORM_GSSAPIHEADER <Kerberos/Kerberos.h>"
1038 ISC_PLATFORM_KRB5HEADER="#define ISC_PLATFORM_KRB5HEADER <Kerberos/Kerberos.h>"
1039 DNS_GSSAPI_LIBS="-framework Kerberos"
1040 AC_MSG_RESULT(framework)
1041 ;;
1042
1043 *)
1044 AC_MSG_RESULT(looking in $use_gssapi/lib)
1045 USE_GSSAPI='-DGSSAPI'
1046 saved_cppflags="$CPPFLAGS"
1047 CPPFLAGS="-I$use_gssapi/include $CPPFLAGS"
1048 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h,
1049 [ISC_PLATFORM_GSSAPIHEADER="#define ISC_PLATFORM_GSSAPIHEADER <$ac_header>"
1050 gssapi_hack="#include <$ac_header>"])
1051
1052 if test "" = "$ISC_PLATFORM_GSSAPIHEADER"; then
1053 AC_MSG_ERROR([gssapi.h not found])
1054 fi
1055
1056 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h,
1057 [ISC_PLATFORM_GSSAPI_KRB5_HEADER="#define ISC_PLATFORM_GSSAPI_KRB5_HEADER <$ac_header>"
1058 gssapi_krb5_hack="#include <$ac_header>"])
1059
1060 AC_CHECK_HEADERS(krb5.h krb5/krb5.h kerberosv5/krb5.h,
1061 [ISC_PLATFORM_KRB5HEADER="#define ISC_PLATFORM_KRB5HEADER <$ac_header>"
1062 krb5_hack="#include <$ac_header>"])
1063
1064 if test "" = "$ISC_PLATFORM_KRB5HEADER"; then
1065 AC_MSG_ERROR([krb5.h not found])
1066 fi
1067
1068 #
1069 # XXXDCL This probably doesn't work right on all systems.
1070 # It will need to be worked on as problems become evident.
1071 #
1072 # Essentially the problems here relate to two different
1073 # areas. The first area is building with either KTH
1074 # or MIT Kerberos, particularly when both are present on
1075 # the machine. The other is static versus dynamic linking.
1076 #
1077 # On the KTH vs MIT issue, Both have libkrb5 that can mess
1078 # up the works if one implementation ends up trying to
1079 # use the other's krb. This is unfortunately a situation
1080 # that very easily arises.
1081 #
1082 # Dynamic linking when the dependency information is built
1083 # into MIT's libgssapi_krb5 or KTH's libgssapi magically makes
1084 # all such problems go away, but when that setup is not
1085 # present, because either the dynamic libraries lack
1086 # dependencies or static linking is being done, then the
1087 # problems start to show up.
1088 saved_libs="$LIBS"
1089 for TRY_LIBS in \
1090 "-lgssapi_krb5" \
1091 "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err" \
1092 "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lresolv" \
1093 "-lgssapi" \
1094 "-lgssapi -lkrb5 -ldes -lcrypt -lasn1 -lroken -lcom_err" \
1095 "-lgssapi -lkrb5 -lcrypt -lasn1 -lroken -lcom_err" \
1096 "-lgssapi -lkrb5 -lgssapi_krb5 -lcrypt -lasn1 -lroken -lcom_err" \
1097 "-lgssapi -lkrb5 -lhx509 -lcrypt -lasn1 -lroken -lcom_err" \
1098 "-lgss -lkrb5"
1099 do
1100 # Note that this does not include $saved_libs, because
1101 # on FreeBSD machines this configure script has added
1102 # -L/usr/local/lib to LIBS, which can make the
1103 # -lgssapi_krb5 test succeed with shared libraries even
1104 # when you are trying to build with KTH in /usr/lib.
1105 if test "/usr" = "$use_gssapi"
1106 then
1107 LIBS="$TRY_LIBS $ISC_OPENSSL_LIBS"
1108 else
1109 LIBS="-L$use_gssapi/lib $TRY_LIBS $ISC_OPENSSL_LIBS"
1110 fi
1111 AC_MSG_CHECKING(linking as $TRY_LIBS)
1112 AC_TRY_LINK([
1113 #include <sys/types.h>
1114 $gssapi_hack
1115 $gssapi_krb5_hack
1116 $krb5_hack
1117 ] , [gss_acquire_cred(NULL, NULL, 0, NULL, 0, NULL, NULL, NULL);krb5_init_context(NULL);
1118 #if defined(HAVE_GSSAPI_KRB5_H) || defined(HAVE_GSSAPI_GSSAPI_KRB5_H)
1119 gsskrb5_register_acceptor_identity(NULL);
1120 #endif],
1121 gssapi_linked=yes, gssapi_linked=no)
1122 case $gssapi_linked in
1123 yes) AC_MSG_RESULT(yes); break ;;
1124 no) AC_MSG_RESULT(no) ;;
1125 esac
1126 done
1127
1128 CPPFLAGS="$saved_cppflags"
1129
1130 case $gssapi_linked in
1131 no) AC_MSG_ERROR(could not determine proper GSSAPI linkage) ;;
1132 esac
1133
1134 #
1135 # XXXDCL Major kludge. Tries to cope with KTH in /usr/lib
1136 # but MIT in /usr/local/lib and trying to build with KTH.
1137 # /usr/local/lib can end up earlier on the link lines.
1138 # Like most kludges, this one is not only inelegant it
1139 # is also likely to be the wrong thing to do at least as
1140 # many times as it is the right thing. Something better
1141 # needs to be done.
1142 #
1143 if test "/usr" = "$use_gssapi" -a \
1144 -f /usr/local/lib/libkrb5.a; then
1145 FIX_KTH_VS_MIT=yes
1146 fi
1147
1148 case "$FIX_KTH_VS_MIT" in
1149 yes)
1150 case "$enable_static_linking" in
1151 yes) gssapi_lib_suffix=".a" ;;
1152 *) gssapi_lib_suffix=".so" ;;
1153 esac
1154
1155 for lib in $LIBS; do
1156 case $lib in
1157 -L*)
1158 ;;
1159 -l*)
1160 new_lib=`echo $lib |
1161 sed -e s%^-l%$use_gssapi/lib/lib% \
1162 -e s%$%$gssapi_lib_suffix%`
1163 NEW_LIBS="$NEW_LIBS $new_lib"
1164 ;;
1165 *)
1166 AC_MSG_ERROR([KTH vs MIT Kerberos confusion!])
1167 ;;
1168 esac
1169 done
1170 LIBS="$NEW_LIBS"
1171 ;;
1172 esac
1173
1174 DST_GSSAPI_INC="-I$use_gssapi/include"
1175 DNS_GSSAPI_LIBS="$LIBS"
1176
1177 AC_MSG_RESULT(using GSSAPI from $use_gssapi/lib and $use_gssapi/include)
1178 LIBS="$saved_libs"
1179 ;;
1180 esac
1181
1182 AC_SUBST(ISC_PLATFORM_HAVEGSSAPI)
1183 AC_SUBST(ISC_PLATFORM_GSSAPIHEADER)
1184 AC_SUBST(ISC_PLATFORM_GSSAPI_KRB5_HEADER)
1185 AC_SUBST(ISC_PLATFORM_KRB5HEADER)
1186
1187 AC_SUBST(USE_GSSAPI)
1188 AC_SUBST(DST_GSSAPI_INC)
1189 AC_SUBST(DNS_GSSAPI_LIBS)
1190 DNS_CRYPTO_LIBS="$DNS_GSSAPI_LIBS"
1191
1192 #
1193 # Applications linking with libdns also need to link with these libraries.
1194 #
1195
1196 AC_SUBST(DNS_CRYPTO_LIBS)
1197
1198 #
1199 # was --with-lmdb specified?
1200 #
1201 AC_MSG_CHECKING(for lmdb library)
1202 AC_ARG_WITH(lmdb,
1203 AS_HELP_STRING([--with-lmdb[=PATH]],
1204 [build with LMDB library [yes|no|path]]),
1205 use_lmdb="$withval", use_lmdb="auto")
1206
1207 have_lmdb=""
1208 case "$use_lmdb" in
1209 no)
1210 lmdb_libs=""
1211 ;;
1212 auto|yes)
1213 for d in /usr /usr/local /opt/local
1214 do
1215 if test -f "${d}/include/lmdb.h"
1216 then
1217 if test ${d} != /usr
1218 then
1219 lmdb_cflags="-I ${d}/include"
1220 LIBS="$LIBS -L${d}/lib"
1221 fi
1222 have_lmdb="yes"
1223 fi
1224 done
1225 ;;
1226 *)
1227 if test -f "${use_lmdb}/include/lmdb.h"
1228 then
1229 lmdb_cflags="-I${use_lmdb}/include"
1230 LIBS="$LIBS -L${use_lmdb}/lib"
1231 have_lmdb="yes"
1232 else
1233 AC_MSG_ERROR([$use_lmdb/include/lmdb.h not found.])
1234 fi
1235 ;;
1236 esac
1237
1238 if test "X${have_lmdb}" != "X"
1239 then
1240 AC_MSG_RESULT(yes)
1241 AC_SEARCH_LIBS([mdb_env_create], [lmdb], [],
1242 [AC_MSG_ERROR([found lmdb include but not library.])
1243 have_lmdb=""])
1244 elif test "X$use_lmdb" = Xyes
1245 then
1246 AC_MSG_ERROR([include/lmdb.h not found.])
1247 else
1248 AC_MSG_RESULT(no)
1249 fi
1250
1251 NZD_TOOLS=""
1252 NZDSRCS=
1253 NZDTARGETS=
1254 if test "X${have_lmdb}" != "X"
1255 then
1256 CFLAGS="$CFLAGS $lmdb_cflags"
1257 AC_DEFINE(HAVE_LMDB, 1, [Define if lmdb was found])
1258 NZD_TOOLS="nzd"
1259 NZDSRCS='${NZDSRCS}'
1260 NZDTARGETS='${NZDTARGETS}'
1261 fi
1262 AC_SUBST(NZD_TOOLS)
1263 AC_SUBST(NZDSRCS)
1264 AC_SUBST(NZDTARGETS)
1265
1266 #
1267 # was --with-libxml2 specified?
1268 #
1269 AC_MSG_CHECKING(for libxml2 library)
1270 AC_ARG_WITH(libxml2,
1271 AS_HELP_STRING([--with-libxml2[=PATH]],
1272 [build with libxml2 library [yes|no|path]]),
1273 use_libxml2="$withval", use_libxml2="auto")
1274
1275 case "$use_libxml2" in
1276 no)
1277 DST_LIBXML2_INC=""
1278 ;;
1279 auto|yes)
1280 case X`(xml2-config --version) 2>/dev/null` in
1281 X2.[[6789]].*)
1282 libxml2_libs=`xml2-config --libs`
1283 libxml2_cflags=`xml2-config --cflags`
1284 ;;
1285 *)
1286 if test "yes" = "$use_libxml2" ; then
1287 AC_MSG_RESULT(no)
1288 AC_MSG_ERROR(required libxml2 version not available)
1289 else
1290 libxml2_libs=
1291 libxml2_cflags=
1292 fi
1293 ;;
1294 esac
1295 ;;
1296 *)
1297 if test -f "$use_libxml2/bin/xml2-config" ; then
1298 libxml2_libs=`$use_libxml2/bin/xml2-config --libs`
1299 libxml2_cflags=`$use_libxml2/bin/xml2-config --cflags`
1300 fi
1301 ;;
1302 esac
1303
1304 if test "X$libxml2_libs" != "X"
1305 then
1306 CFLAGS="$CFLAGS $libxml2_cflags"
1307 LIBS="$LIBS $libxml2_libs"
1308 #
1309 # Sanity check xml2-config output.
1310 #
1311 AC_TRY_LINK([#include <libxml/xmlwriter.h>],
1312 [return(xmlTextWriterStartElement(NULL, NULL));],
1313 AC_MSG_RESULT(yes),
1314 AC_MSG_ERROR(xml2-config returns badness))
1315 AC_DEFINE(HAVE_LIBXML2, 1, [Define if libxml2 was found])
1316 XMLSTATS=1
1317 else
1318 AC_MSG_RESULT(no)
1319 fi
1320 AC_SUBST(XMLSTATS)
1321
1322 #
1323 # was --with-libjson specified?
1324 #
1325 AC_MSG_CHECKING(for json library)
1326 AC_ARG_WITH(libjson,
1327 AS_HELP_STRING([--with-libjson[=PATH]],
1328 [build with libjson0 library [yes|no|path]]),
1329 use_libjson="$withval", use_libjson="auto")
1330
1331 have_libjson=""
1332 have_libjson_c=""
1333 case "$use_libjson" in
1334 no)
1335 libjson_libs=""
1336 ;;
1337 auto|yes)
1338 for d in /usr /usr/local /opt/local
1339 do
1340 if test -f "${d}/include/json/json.h"
1341 then
1342 if test ${d} != /usr
1343 then
1344 libjson_cflags="-I ${d}/include"
1345 LIBS="$LIBS -L${d}/lib"
1346 fi
1347 have_libjson="yes"
1348 elif test -f "${d}/include/json-c/json.h"
1349 then
1350 if test ${d} != /usr
1351 then
1352 libjson_cflags="-I ${d}/include"
1353 LIBS="$LIBS -L${d}/lib"
1354 fi
1355 have_libjson="yes"
1356 have_libjson_c="yes"
1357 fi
1358 done
1359 ;;
1360 *)
1361 if test -f "${use_libjson}/include/json/json.h"
1362 then
1363 libjson_cflags="-I${use_libjson}/include"
1364 LIBS="$LIBS -L${use_libjson}/lib"
1365 have_libjson="yes"
1366 elif test -f "${use_libjson}/include/json-c/json.h"
1367 then
1368 libjson_cflags="-I${use_libjson}/include"
1369 LIBS="$LIBS -L${use_libjson}/lib"
1370 have_libjson="yes"
1371 have_libjson_c="yes"
1372 else
1373 AC_MSG_ERROR([$use_libjson/include/json{,-c}/json.h not found.])
1374 fi
1375 ;;
1376 esac
1377
1378 if test "X${have_libjson}" != "X"
1379 then
1380 AC_MSG_RESULT(yes)
1381 AC_SEARCH_LIBS([json_object_new_int64], [json json-c], [],
1382 [AC_MSG_ERROR([found libjson include but not library.])
1383 have_libjson=""])
1384 elif test "X$use_libjson" = Xyes
1385 then
1386 AC_MSG_ERROR([include/json{,-c}/json.h not found.])
1387 else
1388 AC_MSG_RESULT(no)
1389 fi
1390
1391 if test "X${have_libjson}" != "X"
1392 then
1393 CFLAGS="$CFLAGS $libjson_cflags"
1394 AC_DEFINE(HAVE_JSON, 1, [Define if libjson was found])
1395 if test "X${have_libjson_c}" = Xyes
1396 then
1397 AC_DEFINE(HAVE_JSON_C, 1, [Define if json-c was found])
1398 fi
1399 JSONSTATS=1
1400 fi
1401 AC_SUBST(JSONSTATS)
1402
1403 #
1404 # was --with-zlib specified?
1405 #
1406 AC_MSG_CHECKING(for zlib library)
1407 AC_ARG_WITH(zlib,
1408 AS_HELP_STRING([--with-zlib[=PATH]],
1409 [build with zlib for HTTP compression
1410 [default=yes]]),
1411 with_zlib="$withval", with_zlib="auto")
1412
1413 have_zlib=""
1414 case "$with_zlib" in
1415 no)
1416 zlib_libs=""
1417 ;;
1418 auto|yes)
1419 for d in /usr /usr/local /opt/local
1420 do
1421 if test -f "${d}/include/zlib.h"
1422 then
1423 if test ${d} != /usr
1424 then
1425 zlib_cflags="-I ${d}/include"
1426 LIBS="$LIBS -L${d}/lib"
1427 fi
1428 have_zlib="yes"
1429 fi
1430 done
1431 ;;
1432 *)
1433 if test -f "${with_zlib}/include/zlib.h"
1434 then
1435 zlib_cflags="-I${with_zlib}/include"
1436 LIBS="$LIBS -L${with_zlib}/lib"
1437 have_zlib="yes"
1438 else
1439 AC_MSG_ERROR([$with_zlib/include/zlib.h not found.])
1440 fi
1441 ;;
1442 esac
1443
1444 if test "X${have_zlib}" != "X"
1445 then
1446 AC_MSG_RESULT(yes)
1447 AC_SEARCH_LIBS([deflate], [z], [],
1448 [AC_MSG_ERROR([found zlib include but not library.])
1449 have_zlib=""])
1450 elif test "X$with_zlib" = Xyes
1451 then
1452 AC_MSG_ERROR([include/zlib.h not found.])
1453 else
1454 AC_MSG_RESULT(no)
1455 fi
1456
1457 ZLIB=
1458 if test "X${have_zlib}" != "X"
1459 then
1460 CFLAGS="$CFLAGS $zlib_cflags"
1461 AC_DEFINE(HAVE_ZLIB, 1, [Define if zlib was found])
1462 ZLIB=1
1463 fi
1464 AC_SUBST(ZLIB)
1465
1466
1467 #
1468 # In solaris 10, SMF can manage named service
1469 #
1470 AC_CHECK_LIB(scf, smf_enable_instance)
1471
1472 #
1473 # Large File
1474 #
1475 AC_ARG_ENABLE(largefile,
1476 AS_HELP_STRING([--enable-largefile], [64-bit file support]),
1477 want_largefile="yes", want_largefile="no")
1478 case $want_largefile in
1479 yes)
1480 ALWAYS_DEFINES="$ALWAYS_DEFINES -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
1481 ;;
1482 *)
1483 ;;
1484 esac
1485
1486 #
1487 # Additional compiler settings.
1488 #
1489 MKDEPCC="$CC"
1490 MKDEPCFLAGS="-M"
1491
1492 if test "X$GCC" = "Xyes"; then
1493 STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith"
1494 AC_MSG_CHECKING(if "$CC" supports -fno-strict-aliasing)
1495 SAVE_CFLAGS="$CFLAGS"
1496 CFLAGS="$CFLAGS -Werror -fno-strict-aliasing"
1497 AC_TRY_COMPILE(,, [FNOSTRICTALIASING=yes],[FNOSTRICTALIASING=no])
1498 CFLAGS="$SAVE_CFLAGS"
1499 if test "yes" = "$FNOSTRICTALIASING"; then
1500 AC_MSG_RESULT(yes)
1501 STD_CWARNINGS="$STD_CWARNINGS -fno-strict-aliasing"
1502 else
1503 AC_MSG_RESULT(no)
1504 fi
1505 #
1506 # turn off delete null pointer checks
1507 #
1508 AC_MSG_CHECKING(if "$CC" supports -fno-delete-null-pointer-checks)
1509 SAVE_CFLAGS="$CFLAGS"
1510 CFLAGS="$CFLAGS -Werror -fno-delete-null-pointer-checks"
1511 AC_TRY_COMPILE(,, [FNODELETENULLPOINTERCHECKS=yes],
1512 [FNODELETENULLPOINTERCHECKS=no])
1513 CFLAGS="$SAVE_CFLAGS"
1514 if test "yes" = "$FNODELETENULLPOINTERCHECKS"; then
1515 AC_MSG_RESULT(yes)
1516 STD_CWARNINGS="$STD_CWARNINGS -fno-delete-null-pointer-checks"
1517 else
1518 AC_MSG_RESULT(no)
1519 fi
1520 if test "X$enable_warn_shadow" = Xyes; then
1521 STD_CWARNINGS="$STD_CWARNINGS -Wshadow"
1522 fi
1523 if test "X$enable_warn_error" = Xyes; then
1524 STD_CWARNINGS="$STD_CWARNINGS -Werror"
1525 fi
1526 else
1527 case $host in
1528 *-solaris*)
1529 MKDEPCFLAGS="-xM"
1530 ;;
1531 esac
1532 fi
1533
1534 AC_SUBST(MKDEPCC)
1535 AC_SUBST(MKDEPCFLAGS)
1536 AC_SUBST(MKDEPPROG)
1537
1538 #
1539 # -lxnet buys us one big porting headache... standards, gotta love 'em.
1540 #
1541 # AC_CHECK_LIB(xnet, socket, ,
1542 # AC_CHECK_LIB(socket, socket)
1543 # )
1544 #
1545 # Use this for now, instead:
1546 #
1547 case "$host" in
1548 *-linux*)
1549 ;;
1550 *)
1551 AC_CHECK_LIB(socket, socket)
1552 AC_CHECK_LIB(nsl, inet_addr)
1553 ;;
1554 esac
1555
1556 #
1557 # Work around Solaris's select() limitations.
1558 #
1559 case "$host" in
1560 *-solaris2.[[89]]|*-solaris2.1?)
1561 AC_DEFINE(FD_SETSIZE, 65536,
1562 [Solaris hack to get select_large_fdset.])
1563 ;;
1564 esac
1565
1566 #
1567 # Purify support
1568 #
1569 AC_MSG_CHECKING(whether to use purify)
1570 AC_ARG_WITH(purify,
1571 AS_HELP_STRING([--with-purify[=PATH]],[use Rational purify]),
1572 use_purify="$withval", use_purify="no")
1573
1574 case "$use_purify" in
1575 no)
1576 ;;
1577 yes)
1578 AC_PATH_PROG(purify_path, purify, purify)
1579 ;;
1580 *)
1581 purify_path="$use_purify"
1582 ;;
1583 esac
1584
1585 case "$use_purify" in
1586 no)
1587 AC_MSG_RESULT(no)
1588 PURIFY=""
1589 ;;
1590 *)
1591 if test -f "$purify_path" || test purify = "$purify_path"; then
1592 AC_MSG_RESULT($purify_path)
1593 PURIFYFLAGS="`echo $PURIFYOPTIONS`"
1594 PURIFY="$purify_path $PURIFYFLAGS"
1595 else
1596 AC_MSG_ERROR([$purify_path not found.
1597
1598 Please choose the proper path with the following command:
1599
1600 configure --with-purify=PATH
1601 ])
1602 fi
1603 ;;
1604 esac
1605
1606 AC_SUBST(PURIFY)
1607
1608 #
1609 # Google/Great Performance Tools CPU Profiler
1610 #
1611 AC_MSG_CHECKING(whether to use gperftools profiler)
1612 AC_ARG_WITH(gperftools-profiler,
1613 AS_HELP_STRING([--with-gperftools-profiler],
1614 [use gperftools CPU profiler]),
1615 use_profiler="$withval", use_profiler="no")
1616
1617 case $use_profiler in
1618 yes)
1619 AC_MSG_RESULT(yes)
1620 AC_DEFINE([HAVE_GPERFTOOLS_PROFILER], 1,
1621 [Define to use gperftools CPU profiler.])
1622 LIBS="$LIBS -lprofiler"
1623 ;;
1624 *)
1625 AC_MSG_RESULT(no)
1626 ;;
1627 esac
1628
1629 #
1630 # enable/disable dumping stack backtrace. Also check if the system supports
1631 # glibc-compatible backtrace() function.
1632 #
1633 AC_ARG_ENABLE([backtrace],
1634 [AS_HELP_STRING([--enable-backtrace],
1635 [log stack backtrace on abort [default=yes]])],
1636 [], [enable_backtrace="yes"])
1637
1638 AS_IF([test "$enable_backtrace" = "yes"],
1639 [AC_DEFINE([USE_BACKTRACE], [1], [define if we can use backtrace])
1640 AC_LINK_IFELSE(
1641 [AC_LANG_PROGRAM(
1642 [[#include <execinfo.h>]],
1643 [[return (backtrace((void **)0, 0));]]
1644 )],
1645 [AC_DEFINE([HAVE_LIBCTRACE], [1], [define if system have backtrace function])]
1646 )])
1647
1648 AC_ARG_ENABLE(symtable,
1649 AS_HELP_STRING([--enable-symtable],
1650 [use internal symbol table for backtrace
1651 [all|minimal(default)|none]]),
1652 want_symtable="$enableval", want_symtable="minimal")
1653 case $want_symtable in
1654 yes|all|minimal) # "yes" is a hidden value equivalent to "minimal"
1655 if test "" = "$PERL"
1656 then
1657 AC_MSG_ERROR([Internal symbol table requires perl but no perl is found.
1658 Install perl or explicitly disable the feature by --disable-symtable.])
1659 fi
1660 if test "yes" = "$use_libtool"; then
1661 AC_MSG_WARN([Internal symbol table does not work with libtool. Disabling symbol table.])
1662 else
1663 # we generate the internal symbol table only for those systems
1664 # known to work to avoid unexpected build failure. Also, warn
1665 # about unsupported systems when the feature is enabled
1666 # manually.
1667 case $host_os in
1668 freebsd*|netbsd*|openbsd*|linux*|solaris*|darwin*)
1669 MKSYMTBL_PROGRAM="$PERL"
1670 if test "all" = "$want_symtable"; then
1671 ALWAYS_MAKE_SYMTABLE="yes"
1672 fi
1673 ;;
1674 *)
1675 if test "yes" = "$want_symtable" -o "all" = "$want_symtable"
1676 then
1677 AC_MSG_WARN([this system is not known to generate internal symbol table safely; disabling it])
1678 fi
1679 esac
1680 fi
1681 ;;
1682 *)
1683 ;;
1684 esac
1685 AC_SUBST(MKSYMTBL_PROGRAM)
1686 AC_SUBST(ALWAYS_MAKE_SYMTABLE)
1687
1688 #
1689 # File name extension for static archive files, for those few places
1690 # where they are treated differently from dynamic ones.
1691 #
1692 SA=a
1693
1694 AC_SUBST(O)
1695 AC_SUBST(A)
1696 AC_SUBST(SA)
1697 AC_SUBST(LIBTOOL_MKDEP_SED)
1698 AC_SUBST(LIBTOOL_MODE_COMPILE)
1699 AC_SUBST(LIBTOOL_MODE_INSTALL)
1700 AC_SUBST(LIBTOOL_MODE_LINK)
1701 AC_SUBST(LIBTOOL_MODE_UNINSTALL)
1702
1703 BIND9_CO_RULE=".c.$O:"
1704 AC_SUBST(BIND9_CO_RULE)
1705
1706 #
1707 # Here begins a very long section to determine the system's networking
1708 # capabilities. The order of the tests is significant.
1709 #
1710
1711 #
1712 # We do the IPv6 compilation checking after libtool so that we can put
1713 # the right suffix on the files.
1714 #
1715 AC_MSG_CHECKING([for IPv6 structures])
1716 AC_COMPILE_IFELSE(
1717 [AC_LANG_PROGRAM(
1718 [[
1719 #include <sys/types.h>
1720 #include <sys/socket.h>
1721 #include <netinet/in.h>
1722 ]],
1723 [[
1724 struct sockaddr_in6 sin6;
1725 struct in6_addr in6;
1726 struct in6_pktinfo in6_pi;
1727 struct sockaddr_storage storage;
1728 in6 = in6addr_any;
1729 in6 = in6addr_loopback;
1730 sin6.sin6_scope_id = 0;
1731 return (0);
1732 ]])],
1733 [AC_MSG_RESULT([yes])],
1734 [AC_MSG_FAILURE([IPv6 support is mandatory])])
1735
1736 #
1737 # Allow forcibly disabling TCP Fast Open support as autodetection might yield
1738 # confusing results on some systems (e.g. FreeBSD; see set_tcp_fastopen()
1739 # comment in lib/isc/unix/socket.c).
1740 #
1741
1742 AC_ARG_ENABLE([tcp_fastopen],
1743 [AS_HELP_STRING([--disable-tcp-fastopen],
1744 [disable TCP Fast Open support [default=yes]])],
1745 [], [enable_tcp_fastopen="yes"])
1746
1747 AS_IF([test "$enable_tcp_fastopen" = "yes"],
1748 [AC_DEFINE([ENABLE_TCP_FASTOPEN], [1], [define if you want TCP_FASTOPEN enabled if available])])
1749
1750 #
1751 # Check for some other useful functions that are not ever-present.
1752 #
1753 AC_CHECK_FUNCS([strlcpy strlcat])
1754
1755 AC_SUBST(READLINE_LIB)
1756 AC_ARG_WITH(readline,
1757 AS_HELP_STRING([--with-readline[=LIBSPEC]],
1758 [specify readline library [default auto]]),
1759 use_readline="$withval", use_readline="auto")
1760 case "$use_readline" in
1761 no) ;;
1762 *)
1763 saved_LIBS="$LIBS"
1764 case "$use_readline" in
1765 yes|auto) try_readline="-ledit"; or_readline="-lreadline" ;;
1766 *) try_readline="$use_readline"
1767 esac
1768 for readline in "$try_readline" $or_readline
1769 do
1770 LIBS="$readline"
1771 AC_MSG_NOTICE(checking for readline with $readline)
1772 AC_CHECK_FUNCS(readline)
1773 if test "yes" = "$ac_cv_func_readline"
1774 then
1775 READLINE_LIB="$readline"
1776 break
1777 fi
1778 for lib in -lterminfo -ltermcap -lncurses -lcurses
1779 do
1780 AC_MSG_NOTICE(checking for readline with $readline $lib)
1781 unset ac_cv_func_readline
1782 LIBS="$readline $lib"
1783 AC_CHECK_FUNCS(readline)
1784 if test "yes" = "$ac_cv_func_readline"
1785 then
1786 READLINE_LIB="$readline $lib"
1787 break
1788 fi
1789 done
1790 if test "yes" = "$ac_cv_func_readline"
1791 then
1792 break
1793 fi
1794 done
1795 if test "auto" != "$use_readline" &&
1796 test "X$READLINE_LIB" = "X"
1797 then
1798 AC_MSG_ERROR([The readline library was not found.])
1799 fi
1800 LIBS="$saved_LIBS"
1801 ;;
1802 esac
1803 if test "yes" = "$ac_cv_func_readline"
1804 then
1805 case "$READLINE_LIB" in
1806 *edit*)
1807 AC_CHECK_HEADERS(editline/readline.h)
1808 AC_CHECK_HEADERS(edit/readline/readline.h)
1809 AC_CHECK_HEADERS(edit/readline/history.h)
1810 ;;
1811 esac
1812 AC_CHECK_HEADERS(readline/readline.h)
1813 AC_CHECK_HEADERS(readline/history.h)
1814 fi
1815
1816 #
1817 # Use our own SPNEGO implementation?
1818 #
1819 AC_ARG_ENABLE(isc-spnego,
1820 AS_HELP_STRING([--disable-isc-spnego],
1821 [use SPNEGO from GSSAPI library]))
1822
1823 if test -n "$USE_GSSAPI"
1824 then
1825 case "$enable_isc_spnego" in
1826 yes|'')
1827 USE_ISC_SPNEGO='-DUSE_ISC_SPNEGO'
1828 DST_EXTRA_OBJS="$DST_EXTRA_OBJS spnego.$O"
1829 DST_EXTRA_SRCS="$DST_EXTRA_SRCS spnego.c"
1830 AC_MSG_RESULT(using SPNEGO from lib/dns)
1831 ;;
1832 no)
1833 AC_MSG_RESULT(using SPNEGO from GSSAPI library)
1834 ;;
1835 esac
1836 fi
1837
1838 AC_SUBST(USE_ISC_SPNEGO)
1839
1840 AC_SUBST(DST_EXTRA_OBJS)
1841 AC_SUBST(DST_EXTRA_SRCS)
1842
1843 #
1844 # Security Stuff
1845 #
1846 # Note it is very recommended to *not* disable chroot(),
1847 # this is only because chroot() was made obsolete by Posix.
1848 AC_ARG_ENABLE(chroot, AS_HELP_STRING([--disable-chroot], [disable chroot]))
1849 case "$enable_chroot" in
1850 yes|'')
1851 AC_CHECK_FUNCS(chroot)
1852 ;;
1853 no)
1854 ;;
1855 esac
1856
1857 LIBCAP_LIBS=""
1858 AC_MSG_CHECKING([whether to enable Linux capabilities])
1859 AC_ARG_ENABLE([linux-caps],
1860 [AS_HELP_STRING([--disable-linux-caps],
1861 [disable Linux capabilities])],
1862 [],
1863 [AS_CASE([$host],
1864 [*-linux*],[enable_linux_caps=yes],
1865 [enable_linux_caps=no])])
1866
1867 AS_IF([test "$enable_linux_caps" = "yes"],
1868 [AC_MSG_RESULT([yes])
1869 AC_CHECK_HEADERS([sys/capability.h],
1870 [],
1871 [AC_MSG_ERROR(m4_normalize([sys/capability.h header is required for Linux capabilities support.
1872 Either install libcap or use --disable-linux-caps.]))])
1873 save_LIBS="$LIBS"
1874 AC_SEARCH_LIBS([cap_set_proc], [cap],
1875 [LIBCAP_LIBS="$ac_cv_search_cap_set_proc"],
1876 [AC_MSG_ERROR(m4_normalize([libcap is required for Linux capabilities support.
1877 Either install libcap or use --disable-linux-caps.]))])
1878 LIBS="$save_LIBS"],
1879 [AC_MSG_RESULT([no])])
1880 AC_SUBST([LIBCAP_LIBS])
1881
1882 AC_CHECK_HEADERS(sys/un.h,
1883 ISC_PLATFORM_HAVESYSUNH="#define ISC_PLATFORM_HAVESYSUNH 1"
1884 ,
1885 ISC_PLATFORM_HAVESYSUNH="#undef ISC_PLATFORM_HAVESYSUNH"
1886 )
1887 AC_SUBST(ISC_PLATFORM_HAVESYSUNH)
1888
1889 case "$host" in
1890 *-solaris*)
1891 AC_DEFINE(NEED_SECURE_DIRECTORY, 1,
1892 [Define if connect does not honour the permission on the UNIX domain socket.])
1893 ;;
1894 esac
1895
1896 #
1897 # Time Zone Stuff
1898 #
1899 AC_CHECK_FUNCS([tzset])
1900
1901 AC_MSG_CHECKING(for optarg declaration)
1902 AC_TRY_COMPILE([
1903 #include <unistd.h>
1904 ],
1905 [optarg = 0;],
1906 [AC_MSG_RESULT(yes)],
1907 [AC_MSG_RESULT(no)
1908 GEN_NEED_OPTARG="-DNEED_OPTARG=1"
1909 AC_DEFINE(NEED_OPTARG, 1, [Defined if extern char *optarg is not declared.])])
1910
1911 #
1912 # Check for nanoseconds in file stats
1913 #
1914 AC_MSG_CHECKING([for st_mtim.tv_nsec])
1915 AC_COMPILE_IFELSE(
1916 [AC_LANG_PROGRAM(
1917 [[#include <sys/fcntl.h>]],
1918 [[struct stat s;
1919 return(s.st_mtim.tv_nsec);
1920 ]])],
1921 [AC_DEFINE([HAVE_STAT_NSEC], [1], [define if struct stat has st_mtim.tv_nsec field])])
1922
1923 #
1924 # Check for if_nametoindex() for IPv6 scoped addresses support
1925 #
1926 AC_CHECK_FUNCS([if_nametoindex])
1927
1928 AC_CHECK_FUNCS(nanosleep usleep explicit_bzero)
1929
1930 ISC_ATOMIC_LIBS=""
1931 AC_CHECK_HEADERS(
1932 [stdatomic.h],
1933 [AC_MSG_CHECKING([for memory model aware atomic operations])
1934 AC_COMPILE_IFELSE(
1935 [AC_LANG_PROGRAM(
1936 [[#include <stdatomic.h>]],
1937 [[atomic_int_fast32_t val = 0; atomic_fetch_add_explicit(&val, 1, memory_order_relaxed);]]
1938 )],
1939 [AC_MSG_RESULT([stdatomic.h])
1940 AC_MSG_CHECKING([whether -latomic is needed for 64-bit stdatomic.h functions])
1941 AC_LINK_IFELSE(
1942 [AC_LANG_PROGRAM(
1943 [[#include <stdatomic.h>]],
1944 [[atomic_int_fast64_t val = 0; atomic_fetch_add_explicit(&val, 1, memory_order_relaxed);]]
1945 )],
1946 [AC_MSG_RESULT([no])],
1947 [ISC_ATOMIC_LIBS="-latomic"
1948 save_LIBS="$LIBS"
1949 LIBS="$LIBS $ISC_ATOMIC_LIBS"
1950 AC_LINK_IFELSE(
1951 [AC_LANG_PROGRAM(
1952 [[#include <stdatomic.h>]],
1953 [[atomic_int_fast64_t val = 0; atomic_fetch_add_explicit(&val, 1, memory_order_relaxed);]]
1954 )],
1955 [AC_MSG_RESULT([yes])],
1956 [AC_MSG_FAILURE([libatomic needed, but linking with -latomic failed, please fix your toolchain.])])
1957 LIBS="$save_LIBS"
1958 ])
1959 ],
1960 [AC_MSG_FAILURE([stdatomic.h header found, but compilation failed, please fix your toolchain.])]
1961 )],
1962 [AC_MSG_CHECKING([for memory model aware atomic operations])
1963 AC_COMPILE_IFELSE(
1964 [AC_LANG_PROGRAM(
1965 [[#include <inttypes.h>]],
1966 [[int32_t val = 0; __atomic_fetch_add(&val, 1, __ATOMIC_RELAXED);]]
1967 )],
1968 [AC_MSG_RESULT([__atomic builtins])
1969 AC_DEFINE([HAVE___ATOMIC], [1], [define if __atomic builtins are not available])
1970 AC_MSG_CHECKING([whether -latomic is needed for 64-bit __atomic builtins])
1971 AC_LINK_IFELSE(
1972 [AC_LANG_PROGRAM(
1973 [[#include <inttypes.h>]],
1974 [[int64_t val = 0; __atomic_fetch_add(&val, 1, __ATOMIC_RELAXED);]]
1975 )],
1976 [AC_MSG_RESULT([no])],
1977 [ISC_ATOMIC_LIBS="-latomic"
1978 save_LIBS="$LIBS"
1979 LIBS="$LIBS $ISC_ATOMIC_LIBS"
1980 AC_LINK_IFELSE(
1981 [AC_LANG_PROGRAM(
1982 [[#include <inttypes.h>]],
1983 [[int64_t val = 0; __atomic_fetch_add(&val, 1, __ATOMIC_RELAXED);]]
1984 )],
1985 [AC_MSG_RESULT([yes])],
1986 [AC_MSG_FAILURE([libatomic needed, but linking with -latomic failed, please fix your toolchain.])])
1987 LIBS="$save_LIBS"
1988 ])
1989 ],
1990 [AC_MSG_RESULT([__sync builtins])
1991 ])
1992 ])
1993 LIBS="$LIBS $ISC_ATOMIC_LIBS"
1994
1995 AC_CHECK_HEADERS([uchar.h])
1996
1997 #
1998 # Check for __builtin_unreachable
1999 #
2000 AC_MSG_CHECKING([compiler support for __builtin_unreachable()])
2001 AC_LINK_IFELSE(
2002 [AC_LANG_PROGRAM(
2003 [[]],
2004 [[__builtin_unreachable();]]
2005 )],
2006 [AC_MSG_RESULT([yes])
2007 AC_DEFINE([HAVE_BUILTIN_UNREACHABLE], [1], [define if the compiler supports __builtin_unreachable().])
2008 ],
2009 [AC_MSG_RESULT([no])
2010 ])
2011
2012 #
2013 # Check for __builtin_expect
2014 #
2015 AC_MSG_CHECKING([compiler support for __builtin_expect])
2016 AC_TRY_LINK(, [
2017 return (__builtin_expect(1, 1) ? 1 : 0);
2018 ], [
2019 have_builtin_expect=yes
2020 AC_MSG_RESULT(yes)
2021 ], [
2022 have_builtin_expect=no
2023 AC_MSG_RESULT(no)
2024 ])
2025 if test "yes" = "$have_builtin_expect"; then
2026 AC_DEFINE(HAVE_BUILTIN_EXPECT, 1, [Define to 1 if the compiler supports __builtin_expect.])
2027 fi
2028
2029 #
2030 # Check for __builtin_clz
2031 #
2032 AC_MSG_CHECKING([compiler support for __builtin_clz])
2033 AC_TRY_LINK(, [
2034 return (__builtin_clz(0xff) == 24 ? 1 : 0);
2035 ], [
2036 have_builtin_clz=yes
2037 AC_MSG_RESULT(yes)
2038 ], [
2039 have_builtin_clz=no
2040 AC_MSG_RESULT(no)
2041 ])
2042 if test "yes" = "$have_builtin_clz"; then
2043 AC_DEFINE(HAVE_BUILTIN_CLZ, 1, [Define to 1 if the compiler supports __builtin_clz.])
2044 fi
2045
2046 #
2047 # Activate "rrset-order fixed" or not?
2048 #
2049 AC_ARG_ENABLE(fixed-rrset,
2050 AS_HELP_STRING([--enable-fixed-rrset],
2051 [enable fixed rrset ordering [default=no]]),
2052 enable_fixed="$enableval", enable_fixed="no")
2053 case "$enable_fixed" in
2054 yes)
2055 AC_DEFINE(DNS_RDATASET_FIXED, 1,
2056 [Define to enable "rrset-order fixed" syntax.])
2057 ;;
2058 no)
2059 ;;
2060 *)
2061 ;;
2062 esac
2063
2064 #
2065 # Activate dnstap?
2066 #
2067 AC_ARG_ENABLE(dnstap,
2068 AS_HELP_STRING([--enable-dnstap],
2069 [enable dnstap support
2070 (requires fstrm, protobuf-c)]),
2071 use_dnstap=$enableval, use_dnstap=no)
2072
2073 DNSTAP=
2074 DNSTAPSRCS=
2075 DNSTAPOBJS=
2076 DNSTAPTARGETS=
2077 if test "x$use_dnstap" != "xno"; then
2078 AC_ARG_WITH([protobuf-c],
2079 AS_HELP_STRING([--with-protobuf-c=path],
2080 [Path where protobuf-c is installed, for dnstap]), [
2081 # workaround for protobuf-c includes at old dir
2082 # before protobuf-c-1.0.0
2083 if test -f $withval/include/google/protobuf-c/protobuf-c.h
2084 then
2085 CFLAGS="$CFLAGS -I$withval/include/google"
2086 else
2087 CFLAGS="$CFLAGS -I$withval/include"
2088 fi
2089 LDFLAGS="$LDFLAGS -L$withval/lib"
2090 AC_PATH_PROG([PROTOC_C], [protoc-c], [],
2091 [$PATH$PATH_SEPARATOR$withval/bin])
2092 ], [
2093 # workaround for protobuf-c includes at old dir
2094 # before protobuf-c-1.0.0
2095 if test -f /usr/include/google/protobuf-c/protobuf-c.h
2096 then
2097 CFLAGS="$CFLAGS -I/usr/include/google"
2098 else
2099 if test -f /usr/local/include/google/protobuf-c/protobuf-c.h
2100 then
2101 CFLAGS="$CFLAGS -I/usr/local/include/google"
2102 LDFLAGS="$LDFLAGS -L/usr/local/lib"
2103 fi
2104 fi
2105 AC_PATH_PROG([PROTOC_C],[protoc-c])
2106 ])
2107 if test -z "$PROTOC_C"; then
2108 AC_MSG_ERROR([The protoc-c program was not found.])
2109 fi
2110 AC_ARG_WITH([libfstrm], AS_HELP_STRING([--with-libfstrm=path],
2111 [Path where libfstrm is installed, for dnstap]), [
2112 CFLAGS="$CFLAGS -I$withval/include"
2113 LDFLAGS="$LDFLAGS -L$withval/lib"
2114 AC_PATH_PROG([FSTRM_CAPTURE], [fstrm_capture], [], [$PATH$PATH_SEPARATOR$withval/bin])
2115 ],[
2116 AC_PATH_PROG([FSTRM_CAPTURE], [fstrm_capture])
2117 ])
2118
2119 AC_SEARCH_LIBS([fstrm_iothr_init], [fstrm], [],
2120 AC_MSG_ERROR([The fstrm library was not found. Please install fstrm!]))
2121 AC_SEARCH_LIBS([protobuf_c_message_pack], [protobuf-c], [],
2122 AC_MSG_ERROR([The protobuf-c library was not found. Please install protobuf-c!]))
2123
2124 AC_DEFINE(HAVE_DNSTAP, 1, [Define to 1 to enable dnstap support])
2125 DNSTAP=dnstap
2126 DNSTAPSRCS='${DNSTAPSRCS}'
2127 DNSTAPOBJS='${DNSTAPOBJS}'
2128 DNSTAPTARGETS='${DNSTAPTARGETS}'
2129 fi
2130 AC_SUBST(DNSTAP)
2131 AC_SUBST(DNSTAPSRCS)
2132 AC_SUBST(DNSTAPOBJS)
2133 AC_SUBST(DNSTAPTARGETS)
2134
2135 #
2136 # The following sets up how non-blocking i/o is established.
2137 # cygwin and solaris 2.x (x<5) require special handling.
2138 #
2139 case "$host" in
2140 *-cygwin*) AC_DEFINE(PORT_NONBLOCK, O_NDELAY);;
2141 *-solaris2.[[01234]])
2142 AC_DEFINE(PORT_NONBLOCK, O_NONBLOCK)
2143 AC_DEFINE(USE_FIONBIO_IOCTL, 1,
2144 [Defined if you need to use ioctl(FIONBIO) instead a fcntl call to make non-blocking.])
2145 ;;
2146 *) AC_DEFINE(PORT_NONBLOCK, O_NONBLOCK,
2147 [Sets which flag to pass to open/fcntl to make non-blocking (O_NDELAY/O_NONBLOCK).])
2148 ;;
2149 esac
2150 #
2151 # Solaris 2.5.1 and earlier cannot bind() then connect() a TCP socket.
2152 # This prevents the source address being set.
2153 #
2154 case "$host" in
2155 *-solaris2.[[012345]]|*-solaris2.5.1)
2156 AC_DEFINE(BROKEN_TCP_BIND_BEFORE_CONNECT, 1,
2157 [Define if you cannot bind() before connect() for TCP sockets.])
2158 ;;
2159 esac
2160 #
2161 # The following sections deal with tools used for formatting
2162 # the documentation. They are all optional, unless you are
2163 # a developer editing the documentation source.
2164 #
2165
2166 #
2167 # Look for TeX.
2168 #
2169
2170 AC_PATH_PROGS(LATEX, latex, latex)
2171 AC_SUBST(LATEX)
2172
2173 AC_PATH_PROGS(PDFLATEX, pdflatex, pdflatex)
2174 AC_SUBST(PDFLATEX)
2175
2176 AC_PATH_PROGS(DBLATEX, dblatex, dblatex)
2177 AC_SUBST(DBLATEX)
2178
2179 #
2180 # Look for w3m
2181 #
2182
2183 AC_PATH_PROGS(W3M, w3m, w3m)
2184 AC_SUBST(W3M)
2185
2186 #
2187 # Look for pandoc
2188 #
2189 AC_PATH_PROG(PANDOC, pandoc, pandoc)
2190 AC_SUBST(PANDOC)
2191
2192
2193 #
2194 # Look for xsltproc (libxslt)
2195 #
2196
2197 AC_PATH_PROG(XSLTPROC, xsltproc, xsltproc)
2198 AC_SUBST(XSLTPROC)
2199
2200 #
2201 # Look for xmllint (libxml2)
2202 #
2203
2204 AC_PATH_PROG(XMLLINT, xmllint, xmllint)
2205 AC_SUBST(XMLLINT)
2206
2207 #
2208 # Look for Doxygen
2209 #
2210
2211 AC_PATH_PROG(DOXYGEN, doxygen, doxygen)
2212 AC_SUBST(DOXYGEN)
2213
2214 #
2215 # Look for curl
2216 #
2217
2218 AC_PATH_PROG(CURL, curl, curl)
2219 AC_SUBST(CURL)
2220
2221 #
2222 # Subroutine for searching for an ordinary file (e.g., a stylesheet)
2223 # in a number of directories:
2224 #
2225 # NOM_PATH_FILE(VARIABLE, FILENAME, DIRECTORIES)
2226 #
2227 # If the file FILENAME is found in one of the DIRECTORIES, the shell
2228 # variable VARIABLE is defined to its absolute pathname. Otherwise,
2229 # it is set to FILENAME, with no directory prefix (that's not terribly
2230 # useful, but looks less confusing in substitutions than leaving it
2231 # empty). The variable VARIABLE will be substituted into output files.
2232 #
2233
2234 AC_DEFUN([NOM_PATH_FILE], [
2235 $1=""
2236 AC_MSG_CHECKING(for $2)
2237 for d in $3
2238 do
2239 f=$d/$2
2240 if test -f $f
2241 then
2242 $1=$f
2243 AC_MSG_RESULT($f)
2244 break
2245 fi
2246 done
2247 if test "X[$]$1" = "X"
2248 then
2249 AC_MSG_RESULT("not found");
2250 $1=$2
2251 fi
2252 AC_SUBST($1)
2253 ])
2254
2255 #
2256 # Look for Docbook-XSL stylesheets. Location probably varies by system.
2257 # If it's not explicitly specified, guess where it might be found, based on
2258 # where SGML stuff lives on some systems (FreeBSD is the only one we're sure
2259 # of at the moment).
2260 #
2261 AC_MSG_CHECKING(for Docbook-XSL path)
2262 AC_ARG_WITH(docbook-xsl,
2263 AS_HELP_STRING([--with-docbook-xsl[=PATH]],
2264 [specify path for Docbook-XSL stylesheets]),
2265 docbook_path="$withval", docbook_path="auto")
2266 case "$docbook_path" in
2267 auto)
2268 AC_MSG_RESULT(auto)
2269 docbook_xsl_trees="/usr/pkg/share/xsl/docbook /usr/local/share/xsl/docbook-ns /usr/local/share/xsl/docbook /usr/share/xsl/docbook /opt/local/share/xsl/docbook-xsl /opt/local/share/xsl/docbook-xsl-nons /usr/share/xml/docbook/stylesheet/docbook-xsl"
2270 ;;
2271 *)
2272 docbook_xsl_trees="$withval"
2273 AC_MSG_RESULT($docbook_xsl_trees)
2274 ;;
2275 esac
2276
2277 #
2278 # Look for stylesheets we need.
2279 #
2280
2281 NOM_PATH_FILE(XSLT_DOCBOOK_STYLE_HTML, html/docbook.xsl, $docbook_xsl_trees)
2282 NOM_PATH_FILE(XSLT_DOCBOOK_STYLE_XHTML, xhtml/docbook.xsl, $docbook_xsl_trees)
2283 NOM_PATH_FILE(XSLT_DOCBOOK_STYLE_MAN, manpages/docbook.xsl, $docbook_xsl_trees)
2284 NOM_PATH_FILE(XSLT_DOCBOOK_CHUNK_HTML, html/chunk.xsl, $docbook_xsl_trees)
2285 NOM_PATH_FILE(XSLT_DOCBOOK_CHUNK_XHTML, xhtml/chunk.xsl, $docbook_xsl_trees)
2286 NOM_PATH_FILE(XSLT_DOCBOOK_CHUNKTOC_HTML, html/chunktoc.xsl, $docbook_xsl_trees)
2287 NOM_PATH_FILE(XSLT_DOCBOOK_CHUNKTOC_XHTML, xhtml/chunktoc.xsl, $docbook_xsl_trees)
2288 NOM_PATH_FILE(XSLT_DOCBOOK_MAKETOC_HTML, html/maketoc.xsl, $docbook_xsl_trees)
2289 NOM_PATH_FILE(XSLT_DOCBOOK_MAKETOC_XHTML, xhtml/maketoc.xsl, $docbook_xsl_trees)
2290
2291 #
2292 # Same dance for dblatex
2293 #
2294 dblatex_xsl_trees="/usr/local/share/xml/docbook/stylesheet/dblatex /usr/pkg/share/xml/docbook/stylesheet/dblatex /usr/share/xml/docbook/stylesheet/dblatex"
2295 NOM_PATH_FILE(XSLT_DBLATEX_STYLE, xsl/docbook.xsl, $dblatex_xsl_trees)
2296 NOM_PATH_FILE(XSLT_DBLATEX_FASTBOOK, xsl/latex_book_fast.xsl, $dblatex_xsl_trees)
2297
2298 #
2299 # IDN support using libidn2
2300 #
2301
2302 LIBIDN2_CFLAGS=
2303 LIBIDN2_LDFLAGS=
2304 LIBIDN2_LIBS=
2305 AC_ARG_WITH([libidn2],
2306 [AS_HELP_STRING([--with-libidn2[=PATH]], [enable IDN support using GNU libidn2 [yes|no(default)|path]])],
2307 [with_libidn2="$withval"], [with_libidn2="no"])
2308 AS_CASE([$with_libidn2],
2309 [yes], [PKG_CHECK_MODULES([LIBIDN2], [libidn2],
2310 [AC_DEFINE([HAVE_LIBIDN2], [1], [Define if libidn2 was found])])],
2311 [no], [],
2312 [*], [save_CFLAGS="$CFLAGS"
2313 save_CPPFLAGS="$CPPFLAGS"
2314 save_LDFLAGS="$LDFLAGS"
2315 save_LIBS="$LIBS"
2316 LIBIDN2_CFLAGS="-I$with_libidn2/include"
2317 LIBIDN2_LDFLAGS="-L$with_libidn2/lib"
2318 CFLAGS="$LIBIDN2_CFLAGS $CFLAGS"
2319 CPPFLAGS="$LIBIDN2_CFLAGS $CPPFLAGS"
2320 LDFLAGS="$LIBIDN2_LDFLAGS $LDFLAGS"
2321 AC_CHECK_HEADERS([idn2.h],
2322 [],
2323 [AC_MSG_ERROR([idn2.h not found])])
2324 AC_SEARCH_LIBS([idn2_to_ascii_lz], [idn2],
2325 [LIBIDN2_LIBS="$ac_cv_search_idn2_to_ascii_lz"
2326 AC_DEFINE([HAVE_LIBIDN2], [1], [Define if libidn2 was found])],
2327 [AC_MSG_ERROR([libidn2 requested, but not found])])
2328 CFLAGS="$save_CFLAGS"
2329 CPPFLAGS="$save_CPPFLAGS"
2330 LDFLAGS="$save_LDFLAGS"
2331 LIBS="$save_LIBS"])
2332 AC_SUBST([LIBIDN2_CFLAGS])
2333 AC_SUBST([LIBIDN2_LDFLAGS])
2334 AC_SUBST([LIBIDN2_LIBS])
2335
2336 #
2337 # Check whether to build with cmocka unit testing framework
2338 #
2339
2340 AC_ARG_WITH([cmocka],
2341 [AS_HELP_STRING([--with-cmocka=detect],[enable CMocka based tests (default is detect)])],
2342 [],[with_cmocka=detect])
2343
2344 AS_CASE([$with_cmocka],
2345 [no],[],
2346 [detect],[PKG_CHECK_MODULES([CMOCKA], [cmocka >= 1.0.0],
2347 [AC_DEFINE([HAVE_CMOCKA], [1], [Use CMocka])
2348 UNITTESTS=tests],[with_cmocka=no])],
2349 [yes],[PKG_CHECK_MODULES([CMOCKA], [cmocka >= 1.0.0],
2350 [AC_DEFINE([HAVE_CMOCKA], [1], [Use CMocka])])
2351 UNITTESTS=tests],
2352 [AC_MSG_ERROR([Use PKG_CONFIG_PATH to specify path to CMocka library])]
2353 )
2354 AC_SUBST([CMOCKA_CFLAGS])
2355 AC_SUBST([CMOCKA_LIBS])
2356 AC_SUBST(UNITTESTS)
2357
2358 #
2359 # Check for kyua execution engine if CMocka was requested
2360 # and bail out if execution engine was not found
2361 #
2362 AC_ARG_VAR([KYUA], [path to kyua execution engine])
2363 AS_IF([test "$with_cmocka" != "no"],
2364 [AC_PATH_PROGS([KYUA], [kyua], [])
2365 AS_IF([test -z "$KYUA"],
2366 [AC_MSG_WARN([kyua test execution engine not found])])])
2367
2368 AC_SUBST([KYUA])
2369
2370 #
2371 # Check for -Wl,--wrap= support
2372 #
2373
2374 save_LDFLAGS=$LDFLAGS
2375 LDFLAGS="--wrap=printf"
2376
2377 LD_WRAP_TESTS=false
2378 enable_ld_wrap=no
2379 AC_MSG_CHECKING([for linker support for --wrap option])
2380 AC_LINK_IFELSE(
2381 [AC_LANG_PROGRAM([#include <stdio.h>], [__wrap_printf("success"); return (0);])],
2382 [enable_ld_wrap=yes
2383 LD_WRAP_TESTS=true
2384 AC_DEFINE([LD_WRAP], [1], [define if the linker supports --wrap option])
2385 AC_MSG_RESULT([yes])],
2386 [AC_MSG_RESULT([no])])
2387 # AM_CONDITIONAL([LD_WRAP], [test $enable_ld_wrap = yes])
2388 AC_SUBST([LD_WRAP_TESTS])
2389
2390 LDFLAGS=$save_LDFLAGS
2391
2392 #
2393 # Check for i18n
2394 #
2395 AC_CHECK_HEADERS(locale.h)
2396 AC_CHECK_FUNCS(setlocale)
2397
2398 #
2399 # was --with-tuning specified?
2400 #
2401 AC_ARG_WITH(tuning,
2402 AS_HELP_STRING([--with-tuning=ARG],
2403 [Specify server tuning (large or default)]),
2404 use_tuning="$withval", use_tuning="no")
2405
2406 case "$use_tuning" in
2407 large)
2408 AC_DEFINE(TUNE_LARGE, 1, [Define to use large-system tuning.])
2409 AC_MSG_RESULT(using large-system tuning)
2410 ;;
2411 no|default)
2412 AC_MSG_RESULT(using default tuning)
2413 ;;
2414 yes|*)
2415 AC_MSG_ERROR([You must specify "large" or "default" for --with-tuning.])
2416 ;;
2417 esac
2418
2419 #
2420 # was --enable-querytrace specified?
2421 #
2422 AC_ARG_ENABLE(querytrace,
2423 AS_HELP_STRING([--enable-querytrace],
2424 [enable very verbose query trace logging
2425 [default=no]]),
2426 want_querytrace="$enableval", want_querytrace="no")
2427
2428 AC_MSG_CHECKING([whether to enable query trace logging])
2429 case "$want_querytrace" in
2430 yes)
2431 AC_MSG_RESULT(yes)
2432 AC_DEFINE(WANT_QUERYTRACE, 1, [Define to enable very verbose query trace logging.])
2433 ;;
2434 no)
2435 AC_MSG_RESULT(no)
2436 ;;
2437 *)
2438 AC_MSG_ERROR("--enable-querytrace requires yes or no")
2439 ;;
2440 esac
2441
2442 #
2443 # Was --disable-auto-validation specified?
2444 #
2445 validation_default=auto
2446 AC_ARG_ENABLE(auto-validation,
2447 AS_HELP_STRING([--enable-auto-validation],
2448 [turn on DNSSEC validation by default, using the IANA root key [default=yes]]),
2449 [:],[enable_auto_validation=yes])
2450 AS_IF([test "$enable_auto_validation" = "no"],[validation_default=yes])
2451 AC_DEFINE_UNQUOTED([VALIDATION_DEFAULT], ["$validation_default"], [the default value of dnssec-validation option])
2452
2453 #
2454 # Substitutions
2455 #
2456 AC_SUBST(BIND9_TOP_BUILDDIR)
2457 BIND9_TOP_BUILDDIR=`pwd`
2458
2459 AC_SUBST(BIND9_ISC_BUILDINCLUDE)
2460 AC_SUBST(BIND9_ISCCC_BUILDINCLUDE)
2461 AC_SUBST(BIND9_ISCCFG_BUILDINCLUDE)
2462 AC_SUBST(BIND9_DNS_BUILDINCLUDE)
2463 AC_SUBST(BIND9_NS_BUILDINCLUDE)
2464 AC_SUBST(BIND9_BIND9_BUILDINCLUDE)
2465 AC_SUBST(BIND9_IRS_BUILDINCLUDE)
2466 if test "X$srcdir" != "X"; then
2467 BIND9_ISC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isc/include"
2468 BIND9_ISCCC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isccc/include"
2469 BIND9_ISCCFG_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isccfg/include"
2470 BIND9_DNS_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/dns/include"
2471 BIND9_NS_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/ns/include"
2472 BIND9_BIND9_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/bind9/include"
2473 BIND9_IRS_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/irs/include"
2474 else
2475 BIND9_ISC_BUILDINCLUDE=""
2476 BIND9_ISCCC_BUILDINCLUDE=""
2477 BIND9_ISCCFG_BUILDINCLUDE=""
2478 BIND9_DNS_BUILDINCLUDE=""
2479 BIND9_NS_BUILDINCLUDE=""
2480 BIND9_BIND9_BUILDINCLUDE=""
2481 BIND9_IRS_BUILDINCLUDE=""
2482 fi
2483
2484 AC_SUBST_FILE(BIND9_MAKE_INCLUDES)
2485 BIND9_MAKE_INCLUDES=$BIND9_TOP_BUILDDIR/make/includes
2486
2487 AC_SUBST_FILE(BIND9_MAKE_RULES)
2488 BIND9_MAKE_RULES=$BIND9_TOP_BUILDDIR/make/rules
2489
2490 . "$srcdir/version"
2491 BIND9_PRODUCT="PRODUCT=\"${PRODUCT}\""
2492 AC_SUBST(BIND9_PRODUCT)
2493 BIND9_DESCRIPTION="DESCRIPTION=\"${DESCRIPTION}\""
2494 AC_SUBST(BIND9_DESCRIPTION)
2495 BIND9_VERSION="${MAJORVER}.${MINORVER}${PATCHVER:+.}${PATCHVER}${RELEASETYPE}${RELEASEVER}${EXTENSIONS}"
2496 AC_SUBST(BIND9_VERSION)
2497 BIND9_MAJOR="MAJOR=${MAJORVER}.${MINORVER}"
2498 AC_SUBST(BIND9_MAJOR)
2499 BIND9_VERSIONSTRING="${PRODUCT} ${MAJORVER}.${MINORVER}${PATCHVER:+.}${PATCHVER}${RELEASETYPE}${RELEASEVER}${EXTENSIONS}${DESCRIPTION:+ }${DESCRIPTION}"
2500 AC_SUBST(BIND9_VERSIONSTRING)
2501 BIND9_VERSIONSHORT="${PRODUCT} ${MAJORVER}.${MINORVER}${PATCHVER:+.}${PATCHVER}${RELEASETYPE}${RELEASEVER}${EXTENSIONS}"
2502 AC_SUBST(BIND9_VERSIONSHORT)
2503
2504 BIND9_SRCID="SRCID=unset_id"
2505 if test -f "${srcdir}/srcid"; then
2506 . "${srcdir}/srcid"
2507 BIND9_SRCID="SRCID=$SRCID"
2508 elif test -d "${srcdir}/.git"; then
2509 BIND9_SRCID="SRCID="`(cd "${srcdir}";git rev-parse --short HEAD)`
2510 fi
2511
2512 AC_SUBST(BIND9_SRCID)
2513
2514 if test -z "$ac_configure_args"; then
2515 BIND9_CONFIGARGS="defaults"
2516 else
2517 for a in $ac_configure_args
2518 do
2519 BIND9_CONFIGARGS="$BIND9_CONFIGARGS $a"
2520 done
2521 fi
2522 BIND9_CONFIGARGS="`echo $BIND9_CONFIGARGS | sed 's/^ //'`"
2523 BIND9_CONFIGARGS="CONFIGARGS=${BIND9_CONFIGARGS}"
2524 AC_SUBST(BIND9_CONFIGARGS)
2525
2526 AC_SUBST_FILE(LIBISC_API)
2527 LIBISC_API="$srcdir/lib/isc/api"
2528
2529 AC_SUBST_FILE(LIBISCCC_API)
2530 LIBISCCC_API="$srcdir/lib/isccc/api"
2531
2532 AC_SUBST_FILE(LIBISCCFG_API)
2533 LIBISCCFG_API="$srcdir/lib/isccfg/api"
2534
2535 AC_SUBST_FILE(LIBDNS_API)
2536 LIBDNS_API="$srcdir/lib/dns/api"
2537
2538 AC_SUBST_FILE(LIBDNS_MAPAPI)
2539 LIBDNS_MAPAPI="$srcdir/lib/dns/mapapi"
2540
2541 AC_SUBST_FILE(LIBBIND9_API)
2542 LIBBIND9_API="$srcdir/lib/bind9/api"
2543
2544 AC_SUBST_FILE(LIBIRS_API)
2545 LIBIRS_API="$srcdir/lib/irs/api"
2546
2547 AC_SUBST_FILE(LIBNS_API)
2548 LIBNS_API="$srcdir/lib/ns/api"
2549
2550 #
2551 # Configure any DLZ drivers.
2552 #
2553 # If config.dlz.in selects one or more DLZ drivers, it will set
2554 # CONTRIB_DLZ to a non-empty value, which will be our clue to
2555 # build DLZ drivers in contrib.
2556 #
2557 # This section has to come after the libtool stuff because it needs to
2558 # know how to name the driver object files.
2559 #
2560
2561 CONTRIB_DLZ=""
2562 DLZ_DRIVER_INCLUDES=""
2563 DLZ_DRIVER_LIBS=""
2564 DLZ_DRIVER_SRCS=""
2565 DLZ_DRIVER_OBJS=""
2566 DLZ_SYSTEM_TEST=""
2567 DLZ_DRIVER_MYSQL_INCLUDES=""
2568 DLZ_DRIVER_MYSQL_LIBS=""
2569
2570 #
2571 # Configure support for building a shared library object
2572 #
2573 # Even when libtool is available it can't always be relied upon
2574 # to build an object that can be dlopen()'ed, but this is necessary
2575 # for building the dlzexternal system test, so we'll try it the
2576 # old-fashioned way.
2577 #
2578 SO="so"
2579 SO_CFLAGS=""
2580 SO_LDFLAGS=""
2581 SO_LD=""
2582 SO_TARGETS=""
2583 SO_STRIP="cat"
2584
2585 AC_ARG_WITH([dlopen],
2586 AS_HELP_STRING([--with-dlopen=ARG],
2587 [support dynamically loadable DLZ and DYNDB drivers]),
2588 [], [with_dlopen="auto"])
2589
2590
2591 #
2592 # If PIC is disabled, dlopen must also be
2593 #
2594 AS_IF([test "$pic_mode" = "no"],
2595 [AS_CASE([$with_dlopen],
2596 [auto],[with_dlopen="no"],
2597 [yes],[AC_MSG_ERROR([--with-dlopen requires PIC])])])
2598
2599 AS_CASE([$with_dlopen],
2600 [auto|yes],[
2601 AC_SEARCH_LIBS([dlopen],[dl])
2602 AC_CHECK_FUNCS([dlopen dlclose dlsym],
2603 [with_dlopen="yes"],
2604 [with_dlopen="no"])
2605 ])
2606
2607 AS_IF([test "$with_dlopen" = "yes"],
2608 [AS_CASE([$host],
2609 [*-linux*|*-gnu*],[
2610 LDFLAGS="${LDFLAGS} -Wl,--export-dynamic"
2611 SO_CFLAGS="-fPIC"
2612 SO_LDFLAGS=""
2613 AS_IF([test "$use_libtool" = "yes"],[
2614 SO_LDFLAGS="-Xcompiler -shared"
2615 SO_LD="${CC}"
2616 ],[
2617 SO_LDFLAGS="-shared"
2618 SO_LD="${CC}"
2619 ])
2620 ],
2621 [*-freebsd*|*-openbsd*|*-netbsd*],[
2622 LDFLAGS="${LDFLAGS} -Wl,-E"
2623 SO_CFLAGS="-fpic"
2624 AS_IF([test "$use_libtool" = "yes"],[
2625 SO_LDFLAGS="-Xcompiler -shared"
2626 SO_LD="${CC}"
2627 ],[
2628 SO_LDFLAGS="-shared"
2629 SO_LD="${CC}"
2630 ])
2631 ],
2632 [*-darwin*],[
2633 SO_CFLAGS="-fPIC"
2634 SO_LD="${CC}"
2635 AS_IF([test "$use_libtool" = "yes"],[
2636 SO_LDFLAGS="-Xcompiler -dynamiclib -undefined dynamic_lookup"
2637 ],[
2638 SO_LDFLAGS="-dynamiclib -undefined dynamic_lookup"
2639 ])
2640 ],
2641 [*-solaris*],[
2642 SO_CFLAGS="-KPIC"
2643 SO_LDFLAGS="-G -z text"
2644 SO_LD="ld"
2645 ],
2646 [
2647 SO_CFLAGS="-fPIC"
2648 ])
2649 AS_IF([test "$GCC" = "yes"],[
2650 SO_CFLAGS="-fPIC"
2651 AS_IF([test -z "$SO_LD"],
2652 [AS_IF([test "$use_libtool" = "yes"],[
2653 SO_LDFLAGS="-Xcompiler -shared"
2654 SO_LD="${CC}"
2655 ],[
2656 SO_LDFLAGS="-shared"
2657 SO_LD="${CC}"
2658 ])
2659 ])
2660 ])
2661 # If we still don't know how to make shared objects, don't make any.
2662 AS_IF([test -n "$SO_LD"],
2663 [SO_TARGETS="\${SO_TARGETS}"
2664 AC_DEFINE([ISC_DLZ_DLOPEN], [1],
2665 [Define to allow building of objects for dlopen().])
2666 ])
2667 ])
2668
2669 CFLAGS="$CFLAGS $SO_CFLAGS"
2670
2671 AC_SUBST(SO)
2672 AC_SUBST(SO_CFLAGS)
2673 AC_SUBST(SO_LDFLAGS)
2674 AC_SUBST(SO_LD)
2675 AC_SUBST(SO_STRIP)
2676 AC_SUBST(SO_TARGETS)
2677
2678 #
2679 # Response policy rewriting using DNS Response Policy Service (DNSRPS)
2680 # interface.
2681 #
2682 # DNSRPS can be compiled into BIND everywhere with a reasonably
2683 # modern C compiler. It is enabled on systems with dlopen() and librpz.so.
2684 #
2685 dnsrps_avail=yes
2686 AC_MSG_CHECKING([for librpz __attribute__s])
2687 AC_COMPILE_IFELSE(
2688 [AC_LANG_PROGRAM(
2689 [[]],
2690 [[
2691 extern void f(char *p __attribute__((unused)), ...)
2692 __attribute__((format(printf,1,2))) __attribute__((__noreturn__));
2693 ]])],
2694 [
2695 librpz_have_attr=yes
2696 AC_DEFINE([LIBRPZ_HAVE_ATTR], [1], [have __attribute__s used in librpz.h])
2697 AC_MSG_RESULT([yes])
2698 ],[
2699 librpz_have_attr=no
2700 AC_MSG_RESULT([no])
2701 ])
2702
2703 AC_ARG_ENABLE([dnsrps-dl],
2704 [AS_HELP_STRING([--enable-dnsrps-dl],
2705 [DNS Response Policy Service delayed link
2706 [default=$librpz_dl]])],
2707 [enable_librpz_dl="$enableval"], [enable_librpz_dl="$with_dlopen"])
2708
2709 AS_IF([test "$enable_librpz_dl" = "yes" -a "$with_dlopen" = "no"],
2710 [AC_MSG_ERROR([DNS Response Policy Service delayed link requires dlopen to be enabled])])
2711
2712 AC_ARG_WITH([dnsrps-libname],
2713 [AS_HELP_STRING([--with-dnsrps-libname],
2714 [DNSRPS provider library name (librpz.so)])],
2715 [librpz_name="$withval"], [librpz_name="librpz.so"])
2716 AC_ARG_WITH([dnsrps-dir],
2717 [AS_HELP_STRING([--with-dnsrps-dir],
2718 [path to DNSRPS provider library])],
2719 [librpz_path="$withval/$librpz_name"], [librpz_path="$librpz_name"])
2720 AC_DEFINE_UNQUOTED([DNSRPS_LIBRPZ_PATH], ["$librpz_path"],
2721 [dnsrps $librpz_name])
2722 AS_IF([test "$enable_librpz_dl" = "yes"],
2723 [
2724 dnsrps_lib_open=2
2725 ],[
2726 dnsrps_lib_open=1
2727 # Add librpz.so to linked libraries if we are not using dlopen()
2728 AC_SEARCH_LIBS([librpz_client_create], [rpz], [],
2729 [dnsrps_lib_open=0
2730 dnsrps_avail=no])
2731 ])
2732 AC_DEFINE_UNQUOTED([DNSRPS_LIB_OPEN], [$dnsrps_lib_open],
2733 [0=no DNSRPS 1=static link 2=dlopen()])
2734
2735 AC_ARG_ENABLE([dnsrps],
2736 AS_HELP_STRING([--enable-dnsrps],
2737 [enable DNS Response Policy Service API]),
2738 [enable_dnsrps=$enableval], [enable_dnsrps=no])
2739
2740 AS_IF([test "$enable_dnsrps" != "no"],[
2741 AS_IF([test "$dnsrps_avail" != "yes"],
2742 [AC_MSG_ERROR([dlopen and librpz.so needed for DNSRPS])])
2743 AS_IF([test "$dnsrps_lib_open" = "0"],
2744 [AC_MSG_ERROR([dlopen and librpz.so needed for DNSRPS])])
2745 AC_DEFINE([USE_DNSRPS], [1], [Enable DNS Response Policy Service API])
2746 ])
2747
2748 sinclude(contrib/dlz/config.dlz.in)
2749 AC_MSG_CHECKING(contributed DLZ drivers)
2750
2751 if test -n "$CONTRIB_DLZ"
2752 then
2753 AC_MSG_RESULT(yes)
2754 DLZ_DRIVER_RULES=contrib/dlz/drivers/rules
2755 AC_CONFIG_FILES([$DLZ_DRIVER_RULES
2756 contrib/dlz/modules/mysql/Makefile
2757 contrib/dlz/modules/mysqldyn/Makefile])
2758 else
2759 AC_MSG_RESULT(no)
2760 DLZ_DRIVER_RULES=/dev/null
2761 fi
2762
2763 AC_SUBST(CONTRIB_DLZ)
2764 AC_SUBST(DLZ_DRIVER_INCLUDES)
2765 AC_SUBST(DLZ_DRIVER_LIBS)
2766 AC_SUBST(DLZ_DRIVER_SRCS)
2767 AC_SUBST(DLZ_DRIVER_OBJS)
2768 AC_SUBST(DLZ_SYSTEM_TEST)
2769 AC_SUBST(DLZ_DRIVER_MYSQL_INCLUDES)
2770 AC_SUBST(DLZ_DRIVER_MYSQL_LIBS)
2771 AC_SUBST_FILE(DLZ_DRIVER_RULES)
2772
2773 if test "yes" = "$cross_compiling"; then
2774 if test -z "$BUILD_CC"; then
2775 AC_MSG_ERROR([BUILD_CC not set])
2776 fi
2777 BUILD_CFLAGS="$BUILD_CFLAGS"
2778 BUILD_CPPFLAGS="$BUILD_CPPFLAGS"
2779 BUILD_LDFLAGS="$BUILD_LDFLAGS"
2780 BUILD_LIBS="$BUILD_LIBS"
2781 else
2782 BUILD_CC="$CC"
2783 BUILD_CFLAGS="$CFLAGS"
2784 BUILD_CPPFLAGS="$CPPFLAGS $GEN_NEED_OPTARG"
2785 BUILD_LDFLAGS="$LDFLAGS"
2786 BUILD_LIBS="$LIBS"
2787 fi
2788
2789 NEWFLAGS=""
2790 for e in $BUILD_LDFLAGS ; do
2791 case $e in
2792 -L*)
2793 case $host_os in
2794 netbsd*)
2795 ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
2796 NEWFLAGS="$NEWFLAGS $e $ee"
2797 ;;
2798 freebsd*)
2799 ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
2800 NEWFLAGS="$NEWFLAGS $e $ee"
2801 ;;
2802 solaris*)
2803 ee=`echo $e | sed -e 's%^-L%-R%'`
2804 NEWFLAGS="$NEWFLAGS $e $ee"
2805 ;;
2806 *)
2807 NEWFLAGS="$NEWFLAGS $e"
2808 ;;
2809 esac
2810 ;;
2811 *)
2812 NEWFLAGS="$NEWFLAGS $e"
2813 ;;
2814 esac
2815 done
2816 BUILD_LDFLAGS="$NEWFLAGS"
2817
2818 NEWFLAGS=""
2819 for e in $DNS_GSSAPI_LIBS ; do
2820 case $e in
2821 -L*)
2822 case $host_os in
2823 netbsd*)
2824 ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
2825 NEWFLAGS="$NEWFLAGS $e $ee"
2826 ;;
2827 freebsd*)
2828 ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
2829 NEWFLAGS="$NEWFLAGS $e $ee"
2830 ;;
2831 solaris*)
2832 ee=`echo $e | sed -e 's%^-L%-R%'`
2833 NEWFLAGS="$NEWFLAGS $e $ee"
2834 ;;
2835 *)
2836 NEWFLAGS="$NEWFLAGS $e"
2837 ;;
2838 esac
2839 ;;
2840 *)
2841 NEWFLAGS="$NEWFLAGS $e"
2842 ;;
2843 esac
2844 done
2845 DNS_GSSAPI_LIBS="$NEWFLAGS"
2846
2847 NEWFLAGS=""
2848 for e in $ISC_OPENSSL_LIBS ; do
2849 case $e in
2850 -L*)
2851 case $host_os in
2852 netbsd*)
2853 ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
2854 NEWFLAGS="$NEWFLAGS $e $ee"
2855 ;;
2856 freebsd*)
2857 ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
2858 NEWFLAGS="$NEWFLAGS $e $ee"
2859 ;;
2860 solaris*)
2861 ee=`echo $e | sed -e 's%^-L%-R%'`
2862 NEWFLAGS="$NEWFLAGS $e $ee"
2863 ;;
2864 *)
2865 NEWFLAGS="$NEWFLAGS $e"
2866 ;;
2867 esac
2868 ;;
2869 *)
2870 NEWFLAGS="$NEWFLAGS $e"
2871 ;;
2872 esac
2873 done
2874 ISC_OPENSSL_LIBS="$NEWFLAGS"
2875
2876 NEWFLAGS=""
2877 for e in $DNS_CRYPTO_LIBS ; do
2878 case $e in
2879 -L*)
2880 case $host_os in
2881 netbsd*)
2882 ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
2883 NEWFLAGS="$NEWFLAGS $e $ee"
2884 ;;
2885 freebsd*)
2886 ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
2887 NEWFLAGS="$NEWFLAGS $e $ee"
2888 ;;
2889 solaris*)
2890 ee=`echo $e | sed -e 's%^-L%-R%'`
2891 NEWFLAGS="$NEWFLAGS $e $ee"
2892 ;;
2893 *)
2894 NEWFLAGS="$NEWFLAGS $e"
2895 ;;
2896 esac
2897 ;;
2898 *)
2899 NEWFLAGS="$NEWFLAGS $e"
2900 ;;
2901 esac
2902 done
2903 DNS_CRYPTO_LIBS="$NEWFLAGS"
2904
2905 AC_SUBST(BUILD_CC)
2906 AC_SUBST(BUILD_CFLAGS)
2907 AC_SUBST(BUILD_CPPFLAGS)
2908 AC_SUBST(BUILD_LDFLAGS)
2909 AC_SUBST(BUILD_LIBS)
2910
2911 #
2912 # Commands to run at the end of config.status.
2913 # Don't just put these into configure, it won't work right if somebody
2914 # runs config.status directly (which autoconf allows).
2915 #
2916
2917 AC_CONFIG_COMMANDS(
2918 [chmod],
2919 [chmod a+x isc-config.sh doc/doxygen/doxygen-input-filter])
2920
2921 #
2922 # Files to configure. These are listed here because we used to
2923 # specify them as arguments to AC_OUTPUT. It's (now) ok to move these
2924 # elsewhere if there's a good reason for doing so.
2925 #
2926
2927 AC_CONFIG_FILES([
2928 make/Makefile
2929 make/mkdep
2930 Makefile
2931 bin/Makefile
2932 bin/check/Makefile
2933 bin/confgen/Makefile
2934 bin/confgen/unix/Makefile
2935 bin/delv/Makefile
2936 bin/dig/Makefile
2937 bin/dnssec/Makefile
2938 bin/named/Makefile
2939 bin/named/unix/Makefile
2940 bin/nsupdate/Makefile
2941 bin/pkcs11/Makefile
2942 bin/plugins/Makefile
2943 bin/python/Makefile
2944 bin/python/isc/Makefile
2945 bin/python/isc/utils.py
2946 bin/python/isc/tests/Makefile
2947 bin/python/dnssec-checkds.py
2948 bin/python/dnssec-coverage.py
2949 bin/python/dnssec-keymgr.py
2950 bin/python/isc/__init__.py
2951 bin/python/isc/checkds.py
2952 bin/python/isc/coverage.py
2953 bin/python/isc/dnskey.py
2954 bin/python/isc/eventlist.py
2955 bin/python/isc/keydict.py
2956 bin/python/isc/keyevent.py
2957 bin/python/isc/keymgr.py
2958 bin/python/isc/keyseries.py
2959 bin/python/isc/keyzone.py
2960 bin/python/isc/policy.py
2961 bin/python/isc/rndc.py
2962 bin/python/isc/tests/dnskey_test.py
2963 bin/python/isc/tests/policy_test.py
2964 bin/rndc/Makefile
2965 bin/tests/Makefile
2966 bin/tests/headerdep_test.sh
2967 bin/tests/optional/Makefile
2968 bin/tests/pkcs11/Makefile
2969 bin/tests/pkcs11/benchmarks/Makefile
2970 bin/tests/system/Makefile
2971 bin/tests/system/conf.sh
2972 bin/tests/system/dlzexternal/Makefile
2973 bin/tests/system/dlzexternal/ns1/dlzs.conf
2974 bin/tests/system/dyndb/Makefile
2975 bin/tests/system/dyndb/driver/Makefile
2976 bin/tests/system/pipelined/Makefile
2977 bin/tests/system/rndc/Makefile
2978 bin/tests/system/rpz/Makefile
2979 bin/tests/system/rsabigexponent/Makefile
2980 bin/tests/system/tkey/Makefile
2981 bin/tests/virtual-time/Makefile
2982 bin/tests/virtual-time/conf.sh
2983 bin/tools/Makefile
2984 contrib/scripts/check-secure-delegation.pl
2985 contrib/scripts/zone-edit.sh
2986 doc/Makefile
2987 doc/arm/Makefile
2988 doc/arm/noteversion.xml
2989 doc/arm/pkgversion.xml
2990 doc/arm/releaseinfo.xml
2991 doc/doxygen/Doxyfile
2992 doc/doxygen/Makefile
2993 doc/doxygen/doxygen-input-filter
2994 doc/misc/Makefile
2995 doc/tex/Makefile
2996 doc/tex/armstyle.sty
2997 doc/xsl/Makefile
2998 doc/xsl/isc-docbook-chunk.xsl
2999 doc/xsl/isc-docbook-html.xsl
3000 doc/xsl/isc-manpage.xsl
3001 doc/xsl/isc-notes-html.xsl
3002 isc-config.sh
3003 lib/Makefile
3004 lib/bind9/Makefile
3005 lib/bind9/include/Makefile
3006 lib/bind9/include/bind9/Makefile
3007 lib/dns/Makefile
3008 lib/dns/include/Makefile
3009 lib/dns/include/dns/Makefile
3010 lib/dns/include/dst/Makefile
3011 lib/dns/tests/Makefile
3012 lib/irs/Makefile
3013 lib/irs/include/Makefile
3014 lib/irs/include/irs/Makefile
3015 lib/irs/include/irs/netdb.h
3016 lib/irs/include/irs/platform.h
3017 lib/irs/tests/Makefile
3018 lib/isc/pthreads/Makefile
3019 lib/isc/pthreads/include/Makefile
3020 lib/isc/pthreads/include/isc/Makefile
3021 lib/isc/Makefile
3022 lib/isc/include/Makefile
3023 lib/isc/include/isc/Makefile
3024 lib/isc/include/isc/platform.h
3025 lib/isc/include/pk11/Makefile
3026 lib/isc/include/pkcs11/Makefile
3027 lib/isc/tests/Makefile
3028 lib/isc/unix/Makefile
3029 lib/isc/unix/include/Makefile
3030 lib/isc/unix/include/isc/Makefile
3031 lib/isc/unix/include/pkcs11/Makefile
3032 lib/isccc/Makefile
3033 lib/isccc/include/Makefile
3034 lib/isccc/include/isccc/Makefile
3035 lib/isccc/tests/Makefile
3036 lib/isccfg/Makefile
3037 lib/isccfg/include/Makefile
3038 lib/isccfg/include/isccfg/Makefile
3039 lib/isccfg/tests/Makefile
3040 lib/ns/Makefile
3041 lib/ns/include/Makefile
3042 lib/ns/include/ns/Makefile
3043 lib/ns/tests/Makefile
3044 lib/samples/Makefile
3045 lib/samples/Makefile-postinstall
3046 unit/unittest.sh
3047 fuzz/Makefile
3048 ])
3049
3050 #
3051 # Do it
3052 #
3053
3054 AC_OUTPUT
3055
3056 #
3057 # Now that the Makefiles exist we can ensure that everything is rebuilt.
3058 #
3059 AC_ARG_WITH(make-clean,
3060 AS_HELP_STRING([--with-make-clean],
3061 [run "make clean" at end of configure [yes|no]]),
3062 make_clean="$withval", make_clean="yes")
3063 case "$make_clean" in
3064 yes)
3065 if test "yes" != "$no_create"
3066 then
3067 if test "yes" = "$silent"
3068 then
3069 make clean > /dev/null
3070 else
3071 make clean
3072 fi
3073 fi
3074 ;;
3075 esac
3076
3077 AC_ARG_ENABLE(full-report,
3078 AS_HELP_STRING([--enable-full-report],
3079 [report values of all configure options]))
3080
3081 report() {
3082 echo "==============================================================================="
3083 echo "Configuration summary:"
3084 echo "-------------------------------------------------------------------------------"
3085 echo "Optional features enabled:"
3086 if test "yes" = "$enable_full_report" -o "standard" = "$locktype"; then
3087 echo " Mutex lock type: $locktype"
3088 fi
3089 test "large" = "$use_tuning" && echo " Large-system tuning (--with-tuning)"
3090 test "no" = "$use_dnstap" || \
3091 echo " Allow 'dnstap' packet logging (--enable-dnstap)"
3092 test "no" = "$use_geoip" || echo " GeoIP access control (--with-geoip)"
3093 test "no" = "$use_gssapi" || echo " GSS-API (--with-gssapi)"
3094 if test "yes" = "$enable_full_report" -o "aes" != "$with_cc_alg"; then
3095 echo " Algorithm: $with_cc_alg"
3096 fi
3097
3098 # these lines are only printed if run with --enable-full-report
3099 if test "yes" = "$enable_full_report"; then
3100 test "no" = "$found_ipv6" || echo " IPv6 support (--enable-ipv6)"
3101 test "X$PYTHON" = "X" || echo " Python tools (--with-python)"
3102 test "X$XMLSTATS" = "X" || echo " XML statistics (--with-libxml2)"
3103 test "X$JSONSTATS" = "X" || echo " JSON statistics (--with-libjson)"
3104 test "X$ZLIB" = "X" || echo " HTTP zlib compression (--with-zlib)"
3105 test "X$NZD_TOOLS" = "X" || echo " LMDB database to store configuration for 'addzone' zones (--with-lmdb)"
3106 test "no" = "$with_libidn2" || echo " IDN support (--with-libidn2)"
3107 fi
3108
3109 test "yes" = "$enable_dnsrps" && \
3110 echo " DNS Response Policy Service interface (--enable-dnsrps)"
3111 test "yes" = "$enable_fixed" && \
3112 echo " Allow 'fixed' rrset-order (--enable-fixed-rrset)"
3113 test "yes" = "$enable_backtrace" && \
3114 echo " Print backtrace on crash (--enable-backtrace)"
3115 test "minimal" = "$want_symtable" && \
3116 echo " Use symbol table for backtrace, named only (--enable-symtable)"
3117 test "yes" = "$want_symtable" -o "all" = "$want_symtable" && \
3118 echo " Use symbol table for backtrace, all binaries (--enable-symtable=all)"
3119 test "no" = "$use_libtool" || echo " Use GNU libtool (--with-libtool)"
3120 test "yes" = "$want_querytrace" && \
3121 echo " Very verbose query trace logging (--enable-querytrace)"
3122 test "no" = "$with_cmocka" || echo " CMocka Unit Testing Framework (--with-cmocka)"
3123
3124 test "no" = "$want_autoval" || echo " DNSSEC validation active by default (--enable-auto-validation)"
3125
3126 test "$CRYPTO" = "pkcs11" && (
3127 echo " Using PKCS#11 for Public-Key Cryptography (--with-native-pkcs11)"
3128 echo " PKCS#11 module (--with-pkcs11): $with_pkcs11"
3129 )
3130
3131 echo " Dynamically loadable zone (DLZ) drivers:"
3132 test "no" = "$use_dlz_bdb" || \
3133 echo " Berkeley DB (--with-dlz-bdb)"
3134 test "no" = "$use_dlz_ldap" || \
3135 echo " LDAP (--with-dlz-ldap)"
3136 test "no" = "$use_dlz_mysql" || \
3137 echo " MySQL (--with-dlz-mysql)"
3138 test "no" = "$use_dlz_odbc" || \
3139 echo " ODBC (--with-dlz-odbc)"
3140 test "no" = "$use_dlz_postgres" || \
3141 echo " Postgres (--with-dlz-postgres)"
3142 test "no" = "$use_dlz_filesystem" || \
3143 echo " Filesystem (--with-dlz-filesystem)"
3144 test "no" = "$use_dlz_stub" || \
3145 echo " Stub (--with-dlz-stub)"
3146 test "$use_dlz_bdb $use_dlz_ldap $use_dlz_mysql $use_dlz_odbc $use_dlz_postgres $use_dlz_filesystem $use_dlz_stub" = "no no no no no no no" && echo " None"
3147
3148 echo "-------------------------------------------------------------------------------"
3149
3150 echo "Features disabled or unavailable on this platform:"
3151 test "no" = "$found_ipv6" && echo " IPv6 support (--enable-ipv6)"
3152 test "large" = "$use_tuning" || echo " Large-system tuning (--with-tuning)"
3153
3154 test "no" = "$use_dnstap" && \
3155 echo " Allow 'dnstap' packet logging (--enable-dnstap)"
3156 test "no" = "$use_geoip" && echo " GeoIP access control (--with-geoip)"
3157 test "no" = "$use_gssapi" && echo " GSS-API (--with-gssapi)"
3158
3159 test "no" = "$enable_dnsrps" && \
3160 echo " DNS Response Policy Service interface (--enable-dnsrps)"
3161
3162 test "yes" = "$enable_fixed" || \
3163 echo " Allow 'fixed' rrset-order (--enable-fixed-rrset)"
3164
3165 test "no" = "$want_autoval" && echo " DNSSEC validation requires configuration (--disable-auto-validation)"
3166
3167 test "$CRYPTO" = "pkcs11" || (
3168 echo " Using PKCS#11 for Public-Key Cryptography (--without-native-pkcs11)"
3169 )
3170
3171 test "yes" = "$enable_backtrace" || \
3172 echo " Print backtrace on crash (--enable-backtrace)"
3173 test "yes" = "$want_querytrace" || \
3174 echo " Very verbose query trace logging (--enable-querytrace)"
3175
3176 test "yes" = "$use_libtool" || echo " Use GNU libtool (--with-libtool)"
3177 test "no" = "$with_cmocka" && echo " CMocka Unit Testing Framework (--with-cmocka)"
3178
3179 test "X$PYTHON" = "X" && echo " Python tools (--with-python)"
3180 test "X$XMLSTATS" = "X" && echo " XML statistics (--with-libxml2)"
3181 test "X$JSONSTATS" = "X" && echo " JSON statistics (--with-libjson)"
3182 test "X$ZLIB" = "X" && echo " HTTP zlib compression (--with-zlib)"
3183 test "X$NZD_TOOLS" = "X" && echo " LMDB database to store configuration for 'addzone' zones (--with-lmdb)"
3184 test "no" = "$with_libidn2" && echo " IDN support (--with-libidn2)"
3185
3186 echo "-------------------------------------------------------------------------------"
3187 echo "Configured paths:"
3188 echo " prefix: $prefix"
3189 echo " sysconfdir: $sysconfdir"
3190 echo " localstatedir: $localstatedir"
3191 echo "-------------------------------------------------------------------------------"
3192 echo "Compiler: $CC"
3193 $CC --version 2>&1 | sed 's/^/ /'
3194
3195 if test "X$ac_unrecognized_opts" != "X"; then
3196 echo "Unrecognized options:"
3197 echo " $ac_unrecognized_opts"
3198 fi
3199
3200 if test "yes" != "$enable_full_report"; then
3201 echo "-------------------------------------------------------------------------------"
3202 echo "For more detail, use --enable-full-report."
3203 fi
3204 echo "==============================================================================="
3205 }
3206
3207 if test "yes" != "$silent"; then
3208 report
3209 fi
3210
3211 # Tell Emacs to edit this file in shell mode.
3212 # Local Variables:
3213 # mode: sh
3214 # End:
3215