/contrib/bind9/configure.in

https://bitbucket.org/freebsd/freebsd-head/ · Autoconf · 3615 lines · 2647 code · 287 blank · 681 comment · 155 complexity · 556ae3bcc788f39e8f3ac74535031dae MD5 · raw file

Large files are truncated click here to view the full file

  1. # Copyright (C) 2004-2011 Internet Systems Consortium, Inc. ("ISC")
  2. # Copyright (C) 1998-2003 Internet Software Consortium.
  3. #
  4. # Permission to use, copy, modify, and/or distribute this software for any
  5. # purpose with or without fee is hereby granted, provided that the above
  6. # copyright notice and this permission notice appear in all copies.
  7. #
  8. # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  9. # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  10. # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  11. # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  12. # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  13. # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  14. # PERFORMANCE OF THIS SOFTWARE.
  15. dnl
  16. AC_DIVERT_PUSH(1)dnl
  17. esyscmd([sed "s/^/# /" COPYRIGHT])dnl
  18. AC_DIVERT_POP()dnl
  19. AC_REVISION($Revision: 1.512.8.15 $)
  20. AC_INIT(lib/dns/name.c)
  21. AC_PREREQ(2.59)
  22. AC_CONFIG_HEADER(config.h)
  23. AC_CANONICAL_HOST
  24. AC_PROG_MAKE_SET
  25. #
  26. # GNU libtool support
  27. #
  28. case $build_os in
  29. sunos*)
  30. # Just set the maximum command line length for sunos as it otherwise
  31. # takes a exceptionally long time to work it out. Required for libtool.
  32. lt_cv_sys_max_cmd_len=4096;
  33. ;;
  34. esac
  35. AC_PROG_LIBTOOL
  36. AC_PROG_INSTALL
  37. AC_PROG_LN_S
  38. AC_SUBST(STD_CINCLUDES)
  39. AC_SUBST(STD_CDEFINES)
  40. AC_SUBST(STD_CWARNINGS)
  41. AC_SUBST(CCOPT)
  42. # Warn if the user specified libbind, which is now deprecated
  43. AC_ARG_ENABLE(libbind, [ --enable-libbind deprecated])
  44. case "$enable_libbind" in
  45. yes)
  46. AC_MSG_ERROR(['libbind' is no longer part of the BIND 9 distribution.
  47. It is available from http://www.isc.org as a separate download.])
  48. ;;
  49. no|'')
  50. ;;
  51. esac
  52. AC_ARG_ENABLE(developer, [ --enable-developer enable developer build settings])
  53. case "$enable_developer" in
  54. yes)
  55. test "${enable_fixed_rrset+set}" = set || enable_fixed_rrset=yes
  56. test "${with_atf+set}" = set || with_atf=yes
  57. test "${enable_filter_aaaa+set}" = set || enable_filter_aaaa=yes
  58. test "${enable_rpz_nsip+set}" = set || enable_rpz_nsip=yes
  59. test "${enable_rpz_nsdname+set}" = set || enable_rpz_nsdname=yes
  60. test "${with_dlz_filesystem+set}" = set || with_dlz_filesystem=yes
  61. case "$host" in
  62. *-darwin*)
  63. test "${enable_exportlib+set}" = set || enable_exportlib=yes
  64. ;;
  65. *-linux*)
  66. test "${enable_exportlib+set}" = set || enable_exportlib=yes
  67. ;;
  68. esac
  69. ;;
  70. esac
  71. #
  72. # Make very sure that these are the first files processed by
  73. # config.status, since we use the processed output as the input for
  74. # AC_SUBST_FILE() substitutions in other files.
  75. #
  76. AC_CONFIG_FILES([make/rules make/includes])
  77. AC_PATH_PROG(AR, ar)
  78. ARFLAGS="cruv"
  79. AC_SUBST(AR)
  80. AC_SUBST(ARFLAGS)
  81. # The POSIX ln(1) program. Non-POSIX systems may substitute
  82. # "copy" or something.
  83. LN=ln
  84. AC_SUBST(LN)
  85. case "$AR" in
  86. "")
  87. AC_MSG_ERROR([
  88. ar program not found. Please fix your PATH to include the directory in
  89. which ar resides, or set AR in the environment with the full path to ar.
  90. ])
  91. ;;
  92. esac
  93. #
  94. # Etags.
  95. #
  96. AC_PATH_PROGS(ETAGS, etags emacs-etags)
  97. #
  98. # Some systems, e.g. RH7, have the Exuberant Ctags etags instead of
  99. # GNU emacs etags, and it requires the -L flag.
  100. #
  101. if test "X$ETAGS" != "X"; then
  102. AC_MSG_CHECKING(for Exuberant Ctags etags)
  103. if $ETAGS --version 2>&1 | grep 'Exuberant Ctags' >/dev/null 2>&1; then
  104. AC_MSG_RESULT(yes)
  105. ETAGS="$ETAGS -L"
  106. else
  107. AC_MSG_RESULT(no)
  108. fi
  109. fi
  110. AC_SUBST(ETAGS)
  111. #
  112. # Perl is optional; it is used only by some of the system test scripts.
  113. # Note: the backtrace feature (see below) uses perl to build the symbol table,
  114. # but it still compiles without perl, in which case an empty table will be used.
  115. #
  116. AC_PATH_PROGS(PERL, perl5 perl)
  117. AC_SUBST(PERL)
  118. #
  119. # Special processing of paths depending on whether --prefix,
  120. # --sysconfdir or --localstatedir arguments were given. What's
  121. # desired is some compatibility with the way previous versions
  122. # of BIND built; they defaulted to /usr/local for most parts of
  123. # the installation, but named.boot/named.conf was in /etc
  124. # and named.pid was in /var/run.
  125. #
  126. # So ... if none of --prefix, --sysconfdir or --localstatedir are
  127. # specified, set things up that way. If --prefix is given, use
  128. # it for sysconfdir and localstatedir the way configure normally
  129. # would. To change the prefix for everything but leave named.conf
  130. # in /etc or named.pid in /var/run, then do this the usual configure way:
  131. # ./configure --prefix=/somewhere --sysconfdir=/etc
  132. # ./configure --prefix=/somewhere --localstatedir=/var
  133. #
  134. # To put named.conf and named.pid in /usr/local with everything else,
  135. # set the prefix explicitly to /usr/local even though that's the default:
  136. # ./configure --prefix=/usr/local
  137. #
  138. case "$prefix" in
  139. NONE)
  140. case "$sysconfdir" in
  141. '${prefix}/etc')
  142. sysconfdir=/etc
  143. ;;
  144. esac
  145. case "$localstatedir" in
  146. '${prefix}/var')
  147. localstatedir=/var
  148. ;;
  149. esac
  150. ;;
  151. esac
  152. #
  153. # Make sure INSTALL uses an absolute path, else it will be wrong in all
  154. # Makefiles, since they use make/rules.in and INSTALL will be adjusted by
  155. # configure based on the location of the file where it is substituted.
  156. # Since in BIND9 INSTALL is only substituted into make/rules.in, an immediate
  157. # subdirectory of install-sh, This relative path will be wrong for all
  158. # directories more than one level down from install-sh.
  159. #
  160. case "$INSTALL" in
  161. /*)
  162. ;;
  163. *)
  164. #
  165. # Not all systems have dirname.
  166. #
  167. changequote({, })
  168. ac_dir="`echo $INSTALL | sed 's%/[^/]*$%%'`"
  169. changequote([, ])
  170. ac_prog="`echo $INSTALL | sed 's%.*/%%'`"
  171. test "$ac_dir" = "$ac_prog" && ac_dir=.
  172. test -d "$ac_dir" && ac_dir="`(cd \"$ac_dir\" && pwd)`"
  173. INSTALL="$ac_dir/$ac_prog"
  174. ;;
  175. esac
  176. #
  177. # On these hosts, we really want to use cc, not gcc, even if it is
  178. # found. The gcc that these systems have will not correctly handle
  179. # pthreads.
  180. #
  181. # However, if the user sets $CC to be something, let that override
  182. # our change.
  183. #
  184. if test "X$CC" = "X" ; then
  185. case "$host" in
  186. *-dec-osf*)
  187. CC="cc"
  188. ;;
  189. *-solaris*)
  190. # Use Sun's cc if it is available, but watch
  191. # out for /usr/ucb/cc; it will never be the right
  192. # compiler to use.
  193. #
  194. # If setting CC here fails, the AC_PROG_CC done
  195. # below might still find gcc.
  196. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
  197. for ac_dir in $PATH; do
  198. test -z "$ac_dir" && ac_dir=.
  199. case "$ac_dir" in
  200. /usr/ucb)
  201. # exclude
  202. ;;
  203. *)
  204. if test -f "$ac_dir/cc"; then
  205. CC="$ac_dir/cc"
  206. break
  207. fi
  208. ;;
  209. esac
  210. done
  211. IFS="$ac_save_ifs"
  212. ;;
  213. *-hp-hpux*)
  214. CC="cc"
  215. ;;
  216. mips-sgi-irix*)
  217. CC="cc"
  218. ;;
  219. esac
  220. fi
  221. AC_PROG_CC
  222. #
  223. # gcc's optimiser is broken at -02 for ultrasparc
  224. #
  225. if test "$ac_env_CFLAGS_set" != set -a "X$GCC" = "Xyes"; then
  226. case "$host" in
  227. sparc-*)
  228. CCFLAGS="-g -O1"
  229. ;;
  230. esac
  231. fi
  232. #
  233. # OS dependent CC flags
  234. #
  235. case "$host" in
  236. # OSF 5.0: recv/send are only available with -D_POSIX_PII_SOCKET or
  237. # -D_XOPEN_SOURCE_EXTENDED.
  238. *-dec-osf*)
  239. STD_CDEFINES="$STD_CDEFINES -D_POSIX_PII_SOCKET"
  240. CPPFLAGS="$CPPFLAGS -D_POSIX_PII_SOCKET"
  241. ;;
  242. #HP-UX: need -D_XOPEN_SOURCE_EXTENDED and -lxnet for CMSG macros
  243. *-hp-hpux*)
  244. STD_CDEFINES="$STD_CDEFINES -D_XOPEN_SOURCE_EXTENDED"
  245. CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
  246. LIBS="-lxnet $LIBS"
  247. ;;
  248. # Solaris: need -D_XPG4_2 and -D__EXTENSIONS__ for CMSG macros
  249. *-solaris*)
  250. STD_CDEFINES="$STD_CDEFINES -D_XPG4_2 -D__EXTENSIONS__"
  251. CPPFLAGS="$CPPFLAGS -D_XPG4_2 -D__EXTENSIONS__"
  252. ;;
  253. # POSIX doesn't include the IPv6 Advanced Socket API and glibc hides
  254. # parts of the IPv6 Advanced Socket API as a result. This is stupid
  255. # as it breaks how the two halves (Basic and Advanced) of the IPv6
  256. # Socket API were designed to be used but we have to live with it.
  257. # Define _GNU_SOURCE to pull in the IPv6 Advanced Socket API.
  258. *-linux* | *-kfreebsd*-gnu)
  259. STD_CDEFINES="$STD_CDEFINES -D_GNU_SOURCE"
  260. CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
  261. ;;
  262. #
  263. # Starting with OSX 10.7 (Lion) we must choose which IPv6 API to use.
  264. # Setting this is sufficient to select the correct behavior for BIND 9.
  265. #
  266. *-darwin*)
  267. STD_CDEFINES="$STD_CDEFINES -D__APPLE_USE_RFC_3542"
  268. CPPFLAGS="$CPPFLAGS -D__APPLE_USE_RFC_3542"
  269. ;;
  270. esac
  271. AC_HEADER_STDC
  272. AC_CHECK_HEADERS(fcntl.h regex.h sys/time.h unistd.h sys/sockio.h sys/select.h sys/param.h sys/sysctl.h net/if6.h,,,
  273. [$ac_includes_default
  274. #ifdef HAVE_SYS_PARAM_H
  275. # include <sys/param.h>
  276. #endif
  277. ])
  278. AC_C_CONST
  279. AC_C_INLINE
  280. AC_C_VOLATILE
  281. AC_CHECK_FUNC(sysctlbyname, AC_DEFINE(HAVE_SYSCTLBYNAME))
  282. AC_C_FLEXIBLE_ARRAY_MEMBER
  283. #
  284. # Older versions of HP/UX don't define seteuid() and setegid()
  285. #
  286. AC_CHECK_FUNCS(seteuid setresuid)
  287. AC_CHECK_FUNCS(setegid setresgid)
  288. #
  289. # UnixWare 7.1.1 with the feature supplement to the UDK compiler
  290. # is reported to not support "static inline" (RT #1212).
  291. #
  292. AC_MSG_CHECKING(for static inline breakage)
  293. AC_TRY_COMPILE(, [
  294. foo1();
  295. }
  296. static inline int foo1() {
  297. return 0;
  298. }
  299. static inline int foo2() {
  300. return foo1();
  301. ],
  302. [AC_MSG_RESULT(no)],
  303. [AC_MSG_RESULT(yes)
  304. AC_DEFINE(inline, ,[Define to empty if your compiler does not support "static inline".])])
  305. AC_TYPE_SIZE_T
  306. AC_CHECK_TYPE(ssize_t, int)
  307. AC_CHECK_TYPE(uintptr_t,unsigned long)
  308. AC_CHECK_TYPE(socklen_t,
  309. [AC_DEFINE(ISC_SOCKADDR_LEN_T, socklen_t)],
  310. [
  311. AC_TRY_COMPILE(
  312. [
  313. #include <sys/types.h>
  314. #include <sys/socket.h>
  315. int getsockname(int, struct sockaddr *, size_t *);
  316. ],[],
  317. [AC_DEFINE(ISC_SOCKADDR_LEN_T, size_t)],
  318. [AC_DEFINE(ISC_SOCKADDR_LEN_T, int)])
  319. ],
  320. [
  321. #include <sys/types.h>
  322. #include <sys/socket.h>
  323. ])
  324. AC_SUBST(ISC_SOCKADDR_LEN_T)
  325. AC_HEADER_TIME
  326. AC_MSG_CHECKING(for long long)
  327. AC_TRY_COMPILE([],[long long i = 0; return (0);],
  328. [AC_MSG_RESULT(yes)
  329. ISC_PLATFORM_HAVELONGLONG="#define ISC_PLATFORM_HAVELONGLONG 1"],
  330. [AC_MSG_RESULT(no)
  331. ISC_PLATFORM_HAVELONGLONG="#undef ISC_PLATFORM_HAVELONGLONG"])
  332. AC_SUBST(ISC_PLATFORM_HAVELONGLONG)
  333. #
  334. # check for GCC noreturn attribute
  335. #
  336. AC_MSG_CHECKING(for GCC noreturn attribute)
  337. AC_TRY_COMPILE([],[void foo() __attribute__((noreturn));],
  338. [AC_MSG_RESULT(yes)
  339. ISC_PLATFORM_NORETURN_PRE="#define ISC_PLATFORM_NORETURN_PRE"
  340. ISC_PLATFORM_NORETURN_POST="#define ISC_PLATFORM_NORETURN_POST __attribute__((noreturn))"],
  341. [AC_MSG_RESULT(no)
  342. ISC_PLATFORM_NORETURN_PRE="#define ISC_PLATFORM_NORETURN_PRE"
  343. ISC_PLATFORM_NORETURN_POST="#define ISC_PLATFORM_NORETURN_POST"])
  344. AC_SUBST(ISC_PLATFORM_NORETURN_PRE)
  345. AC_SUBST(ISC_PLATFORM_NORETURN_POST)
  346. #
  347. # check if we have lifconf
  348. #
  349. AC_MSG_CHECKING(for struct lifconf)
  350. AC_TRY_COMPILE([
  351. #include <sys/types.h>
  352. #include <sys/socket.h>
  353. #include <net/if.h>
  354. ],
  355. [
  356. struct lifconf lifconf;
  357. lifconf.lifc_len = 0;
  358. ]
  359. ,
  360. [AC_MSG_RESULT(yes)
  361. ISC_PLATFORM_HAVELIFCONF="#define ISC_PLATFORM_HAVELIFCONF 1"],
  362. [AC_MSG_RESULT(no)
  363. ISC_PLATFORM_HAVELIFCONF="#undef ISC_PLATFORM_HAVELIFCONF"])
  364. AC_SUBST(ISC_PLATFORM_HAVELIFCONF)
  365. #
  366. # check if we have kqueue
  367. #
  368. AC_ARG_ENABLE(kqueue,
  369. [ --enable-kqueue use BSD kqueue when available [[default=yes]]],
  370. want_kqueue="$enableval", want_kqueue="yes")
  371. case $want_kqueue in
  372. yes)
  373. AC_CHECK_FUNC(kqueue, ac_cv_have_kqueue=yes, ac_cv_have_kqueue=no)
  374. case $ac_cv_have_kqueue in
  375. yes)
  376. ISC_PLATFORM_HAVEKQUEUE="#define ISC_PLATFORM_HAVEKQUEUE 1"
  377. ;;
  378. *)
  379. ISC_PLATFORM_HAVEKQUEUE="#undef ISC_PLATFORM_HAVEKQUEUE"
  380. ;;
  381. esac
  382. ;;
  383. *)
  384. ISC_PLATFORM_HAVEKQUEUE="#undef ISC_PLATFORM_HAVEKQUEUE"
  385. ;;
  386. esac
  387. AC_SUBST(ISC_PLATFORM_HAVEKQUEUE)
  388. #
  389. # check if we have epoll. Linux kernel 2.4 has epoll_create() which fails,
  390. # so we need to try running the code, not just test its existence.
  391. #
  392. AC_ARG_ENABLE(epoll,
  393. [ --enable-epoll use Linux epoll when available [[default=auto]]],
  394. want_epoll="$enableval", want_epoll="auto")
  395. case $want_epoll in
  396. auto)
  397. AC_MSG_CHECKING(epoll support)
  398. AC_TRY_RUN([
  399. #include <sys/epoll.h>
  400. int main() {
  401. if (epoll_create(1) < 0)
  402. return (1);
  403. return (0);
  404. }
  405. ],
  406. [AC_MSG_RESULT(yes)
  407. ISC_PLATFORM_HAVEEPOLL="#define ISC_PLATFORM_HAVEEPOLL 1"],
  408. [AC_MSG_RESULT(no)
  409. ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL"])
  410. ;;
  411. yes)
  412. ISC_PLATFORM_HAVEEPOLL="#define ISC_PLATFORM_HAVEEPOLL 1"
  413. ;;
  414. *)
  415. ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL"
  416. ;;
  417. esac
  418. AC_SUBST(ISC_PLATFORM_HAVEEPOLL)
  419. #
  420. # check if we support /dev/poll
  421. #
  422. AC_ARG_ENABLE(devpoll,
  423. [ --enable-devpoll use /dev/poll when available [[default=yes]]],
  424. want_devpoll="$enableval", want_devpoll="yes")
  425. case $want_devpoll in
  426. yes)
  427. AC_CHECK_HEADERS(sys/devpoll.h devpoll.h,
  428. ISC_PLATFORM_HAVEDEVPOLL="#define ISC_PLATFORM_HAVEDEVPOLL 1"
  429. ,
  430. ISC_PLATFORM_HAVEDEVPOLL="#undef ISC_PLATFORM_HAVEDEVPOLL"
  431. )
  432. ;;
  433. *)
  434. ISC_PLATFORM_HAVEDEVPOLL="#undef ISC_PLATFORM_HAVEDEVPOLL"
  435. ;;
  436. esac
  437. AC_SUBST(ISC_PLATFORM_HAVEDEVPOLL)
  438. #
  439. # check if we need to #include sys/select.h explicitly
  440. #
  441. case $ac_cv_header_unistd_h in
  442. yes)
  443. AC_MSG_CHECKING(if unistd.h or sys/types.h defines fd_set)
  444. AC_TRY_COMPILE([
  445. #include <sys/types.h> /* Ultrix */
  446. #include <unistd.h>],
  447. [fd_set read_set; return (0);],
  448. [AC_MSG_RESULT(yes)
  449. ISC_PLATFORM_NEEDSYSSELECTH="#undef ISC_PLATFORM_NEEDSYSSELECTH"
  450. LWRES_PLATFORM_NEEDSYSSELECTH="#undef LWRES_PLATFORM_NEEDSYSSELECTH"],
  451. [AC_MSG_RESULT(no)
  452. case $ac_cv_header_sys_select_h in
  453. yes)
  454. ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
  455. LWRES_PLATFORM_NEEDSYSSELECTH="#define LWRES_PLATFORM_NEEDSYSSELECTH 1"
  456. ;;
  457. no)
  458. AC_MSG_ERROR([need either working unistd.h or sys/select.h])
  459. ;;
  460. esac
  461. ])
  462. ;;
  463. no)
  464. case $ac_cv_header_sys_select_h in
  465. yes)
  466. ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1"
  467. LWRES_PLATFORM_NEEDSYSSELECTH="#define LWRES_PLATFORM_NEEDSYSSELECTH 1"
  468. ;;
  469. no)
  470. AC_MSG_ERROR([need either unistd.h or sys/select.h])
  471. ;;
  472. esac
  473. ;;
  474. esac
  475. AC_SUBST(ISC_PLATFORM_NEEDSYSSELECTH)
  476. AC_SUBST(LWRES_PLATFORM_NEEDSYSSELECTH)
  477. #
  478. # Find the machine's endian flavor.
  479. #
  480. AC_C_BIGENDIAN
  481. #
  482. # was --with-openssl specified?
  483. #
  484. OPENSSL_WARNING=
  485. AC_MSG_CHECKING(for OpenSSL library)
  486. AC_ARG_WITH(openssl,
  487. [ --with-openssl[=PATH] Build with OpenSSL [yes|no|path].
  488. (Required for DNSSEC)],
  489. use_openssl="$withval", use_openssl="auto")
  490. openssldirs="/usr /usr/local /usr/local/ssl /usr/pkg /usr/sfw"
  491. if test "$use_openssl" = "auto"
  492. then
  493. for d in $openssldirs
  494. do
  495. if test -f $d/include/openssl/opensslv.h
  496. then
  497. use_openssl=$d
  498. break
  499. fi
  500. done
  501. fi
  502. OPENSSL_GOST=""
  503. case "$use_openssl" in
  504. no)
  505. AC_MSG_RESULT(no)
  506. DST_OPENSSL_INC=""
  507. USE_OPENSSL=""
  508. OPENSSLLINKOBJS=""
  509. OPENSSLLINKSRCS=""
  510. ;;
  511. auto)
  512. DST_OPENSSL_INC=""
  513. USE_OPENSSL=""
  514. OPENSSLLINKOBJS=""
  515. OPENSSLLINKSRCS=""
  516. AC_MSG_ERROR(
  517. [OpenSSL was not found in any of $openssldirs; use --with-openssl=/path
  518. If you don't want OpenSSL, use --without-openssl])
  519. ;;
  520. *)
  521. if test "$use_openssl" = "yes"
  522. then
  523. # User did not specify a path - guess it
  524. for d in $openssldirs
  525. do
  526. if test -f $d/include/openssl/opensslv.h
  527. then
  528. use_openssl=$d
  529. break
  530. fi
  531. done
  532. if test "$use_openssl" = "yes"
  533. then
  534. AC_MSG_RESULT(not found)
  535. AC_MSG_ERROR(
  536. [OpenSSL was not found in any of $openssldirs; use --with-openssl=/path])
  537. fi
  538. elif ! test -f "$use_openssl"/include/openssl/opensslv.h
  539. then
  540. AC_MSG_ERROR(["$use_openssl/include/openssl/opensslv.h" not found])
  541. fi
  542. USE_OPENSSL='-DOPENSSL'
  543. if test "$use_openssl" = "/usr"
  544. then
  545. DST_OPENSSL_INC=""
  546. DNS_OPENSSL_LIBS="-lcrypto"
  547. else
  548. DST_OPENSSL_INC="-I$use_openssl/include"
  549. case $host in
  550. *-solaris*)
  551. DNS_OPENSSL_LIBS="-L$use_openssl/lib -R$use_openssl/lib -lcrypto"
  552. ;;
  553. *-hp-hpux*)
  554. DNS_OPENSSL_LIBS="-L$use_openssl/lib -Wl,+b: -lcrypto"
  555. ;;
  556. *-apple-darwin*)
  557. #
  558. # Apple's ld seaches for serially for dynamic
  559. # then static libraries. This means you can't
  560. # use -L to override dynamic system libraries
  561. # with static ones when linking. Instead
  562. # we specify a absolute path.
  563. #
  564. if test -f "$use_openssl/lib/libcrypto.dylib"
  565. then
  566. DNS_OPENSSL_LIBS="-L$use_openssl/lib -lcrypto"
  567. else
  568. DNS_OPENSSL_LIBS="$use_openssl/lib/libcrypto.a"
  569. fi
  570. ;;
  571. *)
  572. DNS_OPENSSL_LIBS="-L$use_openssl/lib -lcrypto"
  573. ;;
  574. esac
  575. fi
  576. AC_MSG_RESULT(using OpenSSL from $use_openssl/lib and $use_openssl/include)
  577. saved_cflags="$CFLAGS"
  578. saved_libs="$LIBS"
  579. CFLAGS="$CFLAGS $DST_OPENSSL_INC"
  580. LIBS="$LIBS $DNS_OPENSSL_LIBS"
  581. AC_MSG_CHECKING(whether linking with OpenSSL works)
  582. AC_TRY_RUN([
  583. #include <openssl/err.h>
  584. int main() {
  585. ERR_clear_error();
  586. return (0);
  587. }
  588. ],
  589. [AC_MSG_RESULT(yes)],
  590. [AC_MSG_RESULT(no)
  591. AC_MSG_ERROR(Could not run test program using OpenSSL from
  592. $use_openssl/lib and $use_openssl/include.
  593. Please check the argument to --with-openssl and your
  594. shared library configuration (e.g., LD_LIBRARY_PATH).)],
  595. [AC_MSG_RESULT(assuming it does work on target platform)])
  596. AC_MSG_CHECKING(whether linking with OpenSSL requires -ldl)
  597. AC_TRY_LINK([
  598. #include <openssl/err.h>],
  599. [ DSO_METHOD_dlfcn(); ],
  600. [AC_MSG_RESULT(no)],
  601. [LIBS="$LIBS -ldl"
  602. AC_TRY_LINK([
  603. #include <openssl/err.h>
  604. ],[ DSO_METHOD_dlfcn(); ],
  605. [AC_MSG_RESULT(yes)
  606. DNS_OPENSSL_LIBS="$DNS_OPENSSL_LIBS -ldl"
  607. ],
  608. [AC_MSG_RESULT(unknown)
  609. AC_MSG_ERROR(OpenSSL has unsupported dynamic loading)],
  610. [AC_MSG_RESULT(assuming it does work on target platform)])
  611. ],
  612. [AC_MSG_RESULT(assuming it does work on target platform)]
  613. )
  614. AC_ARG_ENABLE(openssl-version-check,
  615. [AC_HELP_STRING([--enable-openssl-version-check],
  616. [Check OpenSSL Version @<:@default=yes@:>@])])
  617. case "$enable_openssl_version_check" in
  618. yes|'')
  619. AC_MSG_CHECKING(OpenSSL library version)
  620. AC_TRY_RUN([
  621. #include <stdio.h>
  622. #include <openssl/opensslv.h>
  623. int main() {
  624. if ((OPENSSL_VERSION_NUMBER >= 0x009070cfL &&
  625. OPENSSL_VERSION_NUMBER < 0x00908000L) ||
  626. OPENSSL_VERSION_NUMBER >= 0x0090804fL)
  627. return (0);
  628. printf("\n\nFound OPENSSL_VERSION_NUMBER %#010x\n",
  629. OPENSSL_VERSION_NUMBER);
  630. printf("Require OPENSSL_VERSION_NUMBER 0x009070cf or greater (0.9.7l)\n"
  631. "Require OPENSSL_VERSION_NUMBER 0x0090804f or greater (0.9.8d)\n\n");
  632. return (1);
  633. }
  634. ],
  635. [AC_MSG_RESULT(ok)],
  636. [AC_MSG_RESULT(not compatible)
  637. OPENSSL_WARNING=yes
  638. ],
  639. [AC_MSG_RESULT(assuming target platform has compatible version)])
  640. ;;
  641. no)
  642. AC_MSG_RESULT(Skipped OpenSSL version check)
  643. ;;
  644. esac
  645. AC_MSG_CHECKING(for OpenSSL DSA support)
  646. if test -f $use_openssl/include/openssl/dsa.h
  647. then
  648. AC_DEFINE(HAVE_OPENSSL_DSA)
  649. AC_MSG_RESULT(yes)
  650. else
  651. AC_MSG_RESULT(no)
  652. fi
  653. AC_CHECK_FUNCS(EVP_sha256 EVP_sha512)
  654. AC_MSG_CHECKING(for OpenSSL GOST support)
  655. have_gost=""
  656. AC_TRY_RUN([
  657. #include <openssl/conf.h>
  658. #include <openssl/engine.h>
  659. int main() {
  660. #if (OPENSSL_VERSION_NUMBER >= 0x10000000L)
  661. ENGINE *e;
  662. EC_KEY *ek;
  663. ek = NULL;
  664. OPENSSL_config(NULL);
  665. e = ENGINE_by_id("gost");
  666. if (e == NULL)
  667. return (1);
  668. if (ENGINE_init(e) <= 0)
  669. return (1);
  670. return (0);
  671. #else
  672. return (1);
  673. #endif
  674. }
  675. ],
  676. [AC_MSG_RESULT(yes)
  677. have_gost="yes"],
  678. [AC_MSG_RESULT(no)
  679. have_gost="no"],
  680. [AC_MSG_RESULT(using --with-gost)])
  681. AC_ARG_WITH(gost, , with_gost="$withval", with_gost="auto")
  682. case "$with_gost" in
  683. yes)
  684. case "$have_gost" in
  685. no) AC_MSG_ERROR([gost not supported]) ;;
  686. *) have_gost=yes ;;
  687. esac
  688. ;;
  689. no)
  690. have_gost=no ;;
  691. *)
  692. case "$have_gost" in
  693. yes|no) ;;
  694. *) AC_MSG_ERROR([need --with-gost=[[yes or no]]]) ;;
  695. esac
  696. ;;
  697. esac
  698. case $have_gost in
  699. yes)
  700. OPENSSL_GOST="yes"
  701. AC_DEFINE(HAVE_OPENSSL_GOST, 1,
  702. [Define if your OpenSSL version supports GOST.])
  703. ;;
  704. *)
  705. ;;
  706. esac
  707. CFLAGS="$saved_cflags"
  708. LIBS="$saved_libs"
  709. OPENSSLLINKOBJS='${OPENSSLLINKOBJS}'
  710. OPENSSLLINKSRCS='${OPENSSLLINKSRCS}'
  711. ;;
  712. esac
  713. #
  714. # This would include the system openssl path (and linker options to use
  715. # it as needed) if it is found.
  716. #
  717. AC_SUBST(USE_OPENSSL)
  718. AC_SUBST(DST_OPENSSL_INC)
  719. AC_SUBST(OPENSSLLINKOBJS)
  720. AC_SUBST(OPENSSLLINKSRCS)
  721. AC_SUBST(OPENSSL_GOST)
  722. DNS_CRYPTO_LIBS="$DNS_CRYPTO_LIBS $DNS_OPENSSL_LIBS"
  723. #
  724. # Use OpenSSL for hash functions
  725. #
  726. AC_ARG_ENABLE(openssl-hash,
  727. [ --enable-openssl-hash use OpenSSL for hash functions [[default=no]]],
  728. want_openssl_hash="$enableval", want_openssl_hash="no")
  729. case $want_openssl_hash in
  730. yes)
  731. if test "$USE_OPENSSL" = ""
  732. then
  733. AC_MSG_ERROR([No OpenSSL for hash functions])
  734. fi
  735. ISC_PLATFORM_OPENSSLHASH="#define ISC_PLATFORM_OPENSSLHASH 1"
  736. ISC_OPENSSL_INC="$DST_OPENSSL_INC"
  737. ;;
  738. no)
  739. ISC_PLATFORM_OPENSSLHASH="#undef ISC_PLATFORM_OPENSSLHASH"
  740. ISC_OPENSSL_INC=""
  741. ;;
  742. esac
  743. AC_SUBST(ISC_PLATFORM_OPENSSLHASH)
  744. AC_SUBST(ISC_OPENSSL_INC)
  745. #
  746. # PKCS11 (aka crypto hardware) support
  747. #
  748. # This works only with the right OpenSSL with PKCS11 engine!
  749. #
  750. AC_MSG_CHECKING(for PKCS11 support)
  751. AC_ARG_WITH(pkcs11,
  752. [ --with-pkcs11[=PATH] Build with PKCS11 support [yes|no|path]
  753. (PATH is for the PKCS11 provider)],
  754. use_pkcs11="$withval", use_pkcs11="no")
  755. case "$use_pkcs11" in
  756. no|'')
  757. AC_MSG_RESULT(disabled)
  758. USE_PKCS11=''
  759. PKCS11_TOOLS=''
  760. ;;
  761. yes|*)
  762. AC_MSG_RESULT(using OpenSSL with PKCS11 support)
  763. USE_PKCS11='-DUSE_PKCS11'
  764. PKCS11_TOOLS=pkcs11
  765. ;;
  766. esac
  767. AC_SUBST(USE_PKCS11)
  768. AC_SUBST(PKCS11_TOOLS)
  769. AC_MSG_CHECKING(for PKCS11 tools)
  770. case "$use_pkcs11" in
  771. no|yes|'')
  772. AC_MSG_RESULT(disabled)
  773. PKCS11_PROVIDER="undefined"
  774. ;;
  775. *)
  776. AC_MSG_RESULT(PKCS11 provider is "$use_pkcs11")
  777. PKCS11_PROVIDER="$use_pkcs11"
  778. ;;
  779. esac
  780. AC_SUBST(PKCS11_PROVIDER)
  781. AC_MSG_CHECKING(for GSSAPI library)
  782. AC_ARG_WITH(gssapi,
  783. [ --with-gssapi=PATH Specify path for system-supplied GSSAPI [[default=yes]]],
  784. use_gssapi="$withval", use_gssapi="yes")
  785. # gssapi is just the framework, we really require kerberos v5, so
  786. # look for those headers (the gssapi headers must be there, too)
  787. # The problem with this implementation is that it doesn't allow
  788. # for the specification of gssapi and krb5 headers in different locations,
  789. # which probably ought to be fixed although fixing might raise the issue of
  790. # trying to build with incompatible versions of gssapi and krb5.
  791. if test "$use_gssapi" = "yes"
  792. then
  793. # first, deal with the obvious
  794. if test \( -f /usr/include/kerberosv5/krb5.h -o \
  795. -f /usr/include/krb5/krb5.h -o \
  796. -f /usr/include/krb5.h \) -a \
  797. \( -f /usr/include/gssapi.h -o \
  798. -f /usr/include/gssapi/gssapi.h \)
  799. then
  800. use_gssapi=/usr
  801. else
  802. krb5dirs="/usr/local /usr/local/krb5 /usr/local/kerberosv5 /usr/local/kerberos /usr/pkg /usr/krb5 /usr/kerberosv5 /usr/kerberos /usr"
  803. for d in $krb5dirs
  804. do
  805. if test -f $d/include/gssapi/gssapi_krb5.h -o \
  806. -f $d/include/krb5.h
  807. then
  808. if test -f $d/include/gssapi/gssapi.h -o \
  809. -f $d/include/gssapi.h
  810. then
  811. use_gssapi=$d
  812. break
  813. fi
  814. fi
  815. use_gssapi="no"
  816. done
  817. fi
  818. fi
  819. case "$use_gssapi" in
  820. no)
  821. AC_MSG_RESULT(disabled)
  822. USE_GSSAPI=''
  823. ;;
  824. yes)
  825. AC_MSG_ERROR([--with-gssapi must specify a path])
  826. ;;
  827. *)
  828. AC_MSG_RESULT(looking in $use_gssapi/lib)
  829. USE_GSSAPI='-DGSSAPI'
  830. saved_cppflags="$CPPFLAGS"
  831. CPPFLAGS="-I$use_gssapi/include $CPPFLAGS"
  832. AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h,
  833. [ISC_PLATFORM_GSSAPIHEADER="#define ISC_PLATFORM_GSSAPIHEADER <$ac_header>"])
  834. if test "$ISC_PLATFORM_GSSAPIHEADER" = ""; then
  835. AC_MSG_ERROR([gssapi.h not found])
  836. fi
  837. AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h,
  838. [ISC_PLATFORM_GSSAPI_KRB5_HEADER="#define ISC_PLATFORM_GSSAPI_KRB5_HEADER <$ac_header>"])
  839. AC_CHECK_HEADERS(krb5.h krb5/krb5.h kerberosv5/krb5.h,
  840. [ISC_PLATFORM_KRB5HEADER="#define ISC_PLATFORM_KRB5HEADER <$ac_header>"])
  841. if test "$ISC_PLATFORM_KRB5HEADER" = ""; then
  842. AC_MSG_ERROR([krb5.h not found])
  843. fi
  844. CPPFLAGS="$saved_cppflags"
  845. #
  846. # XXXDCL This probably doesn't work right on all systems.
  847. # It will need to be worked on as problems become evident.
  848. #
  849. # Essentially the problems here relate to two different
  850. # areas. The first area is building with either KTH
  851. # or MIT Kerberos, particularly when both are present on
  852. # the machine. The other is static versus dynamic linking.
  853. #
  854. # On the KTH vs MIT issue, Both have libkrb5 that can mess
  855. # up the works if one implementation ends up trying to
  856. # use the other's krb. This is unfortunately a situation
  857. # that very easily arises.
  858. #
  859. # Dynamic linking when the dependency information is built
  860. # into MIT's libgssapi_krb5 or KTH's libgssapi magically makes
  861. # all such problems go away, but when that setup is not
  862. # present, because either the dynamic libraries lack
  863. # dependencies or static linking is being done, then the
  864. # problems start to show up.
  865. saved_libs="$LIBS"
  866. for TRY_LIBS in \
  867. "-lgssapi_krb5" \
  868. "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err" \
  869. "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lresolv" \
  870. "-lgssapi" \
  871. "-lgssapi -lkrb5 -ldes -lcrypt -lasn1 -lroken -lcom_err" \
  872. "-lgssapi -lkrb5 -lcrypto -lcrypt -lasn1 -lroken -lcom_err" \
  873. "-lgss -lkrb5"
  874. do
  875. # Note that this does not include $saved_libs, because
  876. # on FreeBSD machines this configure script has added
  877. # -L/usr/local/lib to LIBS, which can make the
  878. # -lgssapi_krb5 test succeed with shared libraries even
  879. # when you are trying to build with KTH in /usr/lib.
  880. if test "$use_gssapi" = "/usr"
  881. then
  882. LIBS="$TRY_LIBS"
  883. else
  884. LIBS="-L$use_gssapi/lib $TRY_LIBS"
  885. fi
  886. AC_MSG_CHECKING(linking as $TRY_LIBS)
  887. AC_TRY_LINK( , [gss_acquire_cred();krb5_init_context()],
  888. gssapi_linked=yes, gssapi_linked=no)
  889. case $gssapi_linked in
  890. yes) AC_MSG_RESULT(yes); break ;;
  891. no) AC_MSG_RESULT(no) ;;
  892. esac
  893. done
  894. case $gssapi_linked in
  895. no) AC_MSG_ERROR(could not determine proper GSSAPI linkage) ;;
  896. esac
  897. #
  898. # XXXDCL Major kludge. Tries to cope with KTH in /usr/lib
  899. # but MIT in /usr/local/lib and trying to build with KTH.
  900. # /usr/local/lib can end up earlier on the link lines.
  901. # Like most kludges, this one is not only inelegant it
  902. # is also likely to be the wrong thing to do at least as
  903. # many times as it is the right thing. Something better
  904. # needs to be done.
  905. #
  906. if test "$use_gssapi" = "/usr" -a \
  907. -f /usr/local/lib/libkrb5.a; then
  908. FIX_KTH_VS_MIT=yes
  909. fi
  910. case "$FIX_KTH_VS_MIT" in
  911. yes)
  912. case "$enable_static_linking" in
  913. yes) gssapi_lib_suffix=".a" ;;
  914. *) gssapi_lib_suffix=".so" ;;
  915. esac
  916. for lib in $LIBS; do
  917. case $lib in
  918. -L*)
  919. ;;
  920. -l*)
  921. new_lib=`echo $lib |
  922. sed -e s%^-l%$use_gssapi/lib/lib% \
  923. -e s%$%$gssapi_lib_suffix%`
  924. NEW_LIBS="$NEW_LIBS $new_lib"
  925. ;;
  926. *)
  927. AC_MSG_ERROR([KTH vs MIT Kerberos confusion!])
  928. ;;
  929. esac
  930. done
  931. LIBS="$NEW_LIBS"
  932. ;;
  933. esac
  934. DST_GSSAPI_INC="-I$use_gssapi/include"
  935. DNS_GSSAPI_LIBS="$LIBS"
  936. AC_MSG_RESULT(using GSSAPI from $use_gssapi/lib and $use_gssapi/include)
  937. LIBS="$saved_libs"
  938. ;;
  939. esac
  940. AC_SUBST(ISC_PLATFORM_HAVEGSSAPI)
  941. AC_SUBST(ISC_PLATFORM_GSSAPIHEADER)
  942. AC_SUBST(ISC_PLATFORM_GSSAPI_KRB5_HEADER)
  943. AC_SUBST(ISC_PLATFORM_KRB5HEADER)
  944. AC_SUBST(USE_GSSAPI)
  945. AC_SUBST(DST_GSSAPI_INC)
  946. AC_SUBST(DNS_GSSAPI_LIBS)
  947. DNS_CRYPTO_LIBS="$DNS_GSSAPI_LIBS $DNS_CRYPTO_LIBS"
  948. #
  949. # Applications linking with libdns also need to link with these libraries.
  950. #
  951. AC_SUBST(DNS_CRYPTO_LIBS)
  952. #
  953. # was --with-randomdev specified?
  954. #
  955. AC_MSG_CHECKING(for random device)
  956. AC_ARG_WITH(randomdev,
  957. [ --with-randomdev=PATH Specify path for random device],
  958. use_randomdev="$withval", use_randomdev="unspec")
  959. case "$use_randomdev" in
  960. unspec)
  961. case "$host" in
  962. *-openbsd*)
  963. devrandom=/dev/arandom
  964. ;;
  965. *)
  966. devrandom=/dev/random
  967. ;;
  968. esac
  969. AC_MSG_RESULT($devrandom)
  970. AC_CHECK_FILE($devrandom,
  971. AC_DEFINE_UNQUOTED(PATH_RANDOMDEV,
  972. "$devrandom"),)
  973. ;;
  974. yes)
  975. AC_MSG_ERROR([--with-randomdev must specify a path])
  976. ;;
  977. no)
  978. AC_MSG_RESULT(disabled)
  979. ;;
  980. *)
  981. AC_DEFINE_UNQUOTED(PATH_RANDOMDEV, "$use_randomdev")
  982. AC_MSG_RESULT(using "$use_randomdev")
  983. ;;
  984. esac
  985. #
  986. # Do we have arc4random() ?
  987. #
  988. AC_CHECK_FUNC(arc4random, AC_DEFINE(HAVE_ARC4RANDOM))
  989. sinclude(config.threads.in)dnl
  990. if $use_threads
  991. then
  992. if test "X$GCC" = "Xyes"; then
  993. case "$host" in
  994. *-freebsd*)
  995. CC="$CC -pthread"
  996. CCOPT="$CCOPT -pthread"
  997. STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
  998. ;;
  999. *-openbsd*)
  1000. CC="$CC -pthread"
  1001. CCOPT="$CCOPT -pthread"
  1002. ;;
  1003. *-solaris*)
  1004. LIBS="$LIBS -lthread"
  1005. ;;
  1006. *-ibm-aix*)
  1007. STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
  1008. ;;
  1009. esac
  1010. else
  1011. case $host in
  1012. *-dec-osf*)
  1013. CC="$CC -pthread"
  1014. CCOPT="$CCOPT -pthread"
  1015. ;;
  1016. *-solaris*)
  1017. CC="$CC -mt"
  1018. CCOPT="$CCOPT -mt"
  1019. ;;
  1020. *-ibm-aix*)
  1021. STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
  1022. ;;
  1023. *-sco-sysv*uw*|*-*-sysv*UnixWare*)
  1024. CC="$CC -Kthread"
  1025. CCOPT="$CCOPT -Kthread"
  1026. ;;
  1027. *-*-sysv*OpenUNIX*)
  1028. CC="$CC -Kpthread"
  1029. CCOPT="$CCOPT -Kpthread"
  1030. ;;
  1031. esac
  1032. fi
  1033. ALWAYS_DEFINES="-D_REENTRANT"
  1034. ISC_PLATFORM_USETHREADS="#define ISC_PLATFORM_USETHREADS 1"
  1035. THREADOPTOBJS='${THREADOPTOBJS}'
  1036. THREADOPTSRCS='${THREADOPTSRCS}'
  1037. thread_dir=pthreads
  1038. #
  1039. # We'd like to use sigwait() too
  1040. #
  1041. AC_CHECK_FUNC(sigwait,
  1042. AC_DEFINE(HAVE_SIGWAIT),
  1043. AC_CHECK_LIB(c, sigwait,
  1044. AC_DEFINE(HAVE_SIGWAIT),
  1045. AC_CHECK_LIB(pthread, sigwait,
  1046. AC_DEFINE(HAVE_SIGWAIT),
  1047. AC_CHECK_LIB(pthread, _Psigwait,
  1048. AC_DEFINE(HAVE_SIGWAIT),))))
  1049. AC_CHECK_FUNC(pthread_attr_getstacksize,
  1050. AC_DEFINE(HAVE_PTHREAD_ATTR_GETSTACKSIZE),)
  1051. AC_CHECK_FUNC(pthread_attr_setstacksize,
  1052. AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACKSIZE),)
  1053. #
  1054. # Additional OS-specific issues related to pthreads and sigwait.
  1055. #
  1056. case "$host" in
  1057. #
  1058. # One more place to look for sigwait.
  1059. #
  1060. *-freebsd*)
  1061. AC_CHECK_LIB(c_r, sigwait, AC_DEFINE(HAVE_SIGWAIT),)
  1062. case $host in
  1063. *-freebsd5.[[012]]|*-freebsd5.[[012]].*);;
  1064. *-freebsd5.[[3456789]]|*-freebsd5.[[3456789]].*)
  1065. AC_DEFINE(NEED_PTHREAD_SCOPE_SYSTEM)
  1066. ;;
  1067. *-freebsd6.*)
  1068. AC_DEFINE(NEED_PTHREAD_SCOPE_SYSTEM)
  1069. ;;
  1070. esac
  1071. ;;
  1072. #
  1073. # BSDI 3.0 through 4.0.1 needs pthread_init() to be
  1074. # called before certain pthreads calls. This is deprecated
  1075. # in BSD/OS 4.1.
  1076. #
  1077. *-bsdi3.*|*-bsdi4.0*)
  1078. AC_DEFINE(NEED_PTHREAD_INIT)
  1079. ;;
  1080. #
  1081. # LinuxThreads requires some changes to the way we
  1082. # deal with signals.
  1083. #
  1084. *-linux*)
  1085. AC_DEFINE(HAVE_LINUXTHREADS)
  1086. ;;
  1087. #
  1088. # Ensure the right sigwait() semantics on Solaris and make
  1089. # sure we call pthread_setconcurrency.
  1090. #
  1091. *-solaris*)
  1092. AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
  1093. AC_CHECK_FUNC(pthread_setconcurrency,
  1094. AC_DEFINE(CALL_PTHREAD_SETCONCURRENCY))
  1095. ;;
  1096. #
  1097. # UnixWare does things its own way.
  1098. #
  1099. *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
  1100. AC_DEFINE(HAVE_UNIXWARE_SIGWAIT)
  1101. ;;
  1102. esac
  1103. #
  1104. # Look for sysconf to allow detection of the number of processors.
  1105. #
  1106. AC_CHECK_FUNC(sysconf, AC_DEFINE(HAVE_SYSCONF),)
  1107. else
  1108. ISC_PLATFORM_USETHREADS="#undef ISC_PLATFORM_USETHREADS"
  1109. thread_dir=nothreads
  1110. THREADOPTOBJS=""
  1111. THREADOPTSRCS=""
  1112. ALWAYS_DEFINES=""
  1113. fi
  1114. AC_SUBST(ALWAYS_DEFINES)
  1115. AC_SUBST(ISC_PLATFORM_USETHREADS)
  1116. AC_SUBST(THREADOPTOBJS)
  1117. AC_SUBST(THREADOPTSRCS)
  1118. ISC_THREAD_DIR=$thread_dir
  1119. AC_SUBST(ISC_THREAD_DIR)
  1120. #
  1121. # was --with-libxml2 specified?
  1122. #
  1123. AC_MSG_CHECKING(for libxml2 library)
  1124. AC_ARG_WITH(libxml2,
  1125. [ --with-libxml2[=PATH] Build with libxml2 library [yes|no|path]],
  1126. use_libxml2="$withval", use_libxml2="auto")
  1127. case "$use_libxml2" in
  1128. no)
  1129. DST_LIBXML2_INC=""
  1130. ;;
  1131. auto|yes)
  1132. case X`(xml2-config --version) 2>/dev/null` in
  1133. X2.[[67]].*)
  1134. libxml2_libs=`xml2-config --libs`
  1135. libxml2_cflags=`xml2-config --cflags`
  1136. ;;
  1137. *)
  1138. libxml2_libs=
  1139. libxml2_cflags=
  1140. ;;
  1141. esac
  1142. ;;
  1143. *)
  1144. if test -f "$use_libxml2/bin/xml2-config" ; then
  1145. libxml2_libs=`$use_libxml2/bin/xml2-config --libs`
  1146. libxml2_cflags=`$use_libxml2/bin/xml2-config --cflags`
  1147. fi
  1148. ;;
  1149. esac
  1150. if test "X$libxml2_libs" != "X"
  1151. then
  1152. AC_MSG_RESULT(yes)
  1153. CFLAGS="$CFLAGS $libxml2_cflags"
  1154. LIBS="$LIBS $libxml2_libs"
  1155. AC_DEFINE(HAVE_LIBXML2, 1, [Define if libxml2 was found])
  1156. else
  1157. AC_MSG_RESULT(no)
  1158. fi
  1159. #
  1160. # In solaris 10, SMF can manage named service
  1161. #
  1162. AC_CHECK_LIB(scf, smf_enable_instance)
  1163. #
  1164. # flockfile is usually provided by pthreads, but we may want to use it
  1165. # even if compiled with --disable-threads. getc_unlocked might also not
  1166. # be defined.
  1167. #
  1168. AC_CHECK_FUNC(flockfile, AC_DEFINE(HAVE_FLOCKFILE),)
  1169. AC_CHECK_FUNC(getc_unlocked, AC_DEFINE(HAVE_GETCUNLOCKED),)
  1170. #
  1171. # Indicate what the final decision was regarding threads.
  1172. #
  1173. AC_MSG_CHECKING(whether to build with threads)
  1174. if $use_threads; then
  1175. AC_MSG_RESULT(yes)
  1176. else
  1177. AC_MSG_RESULT(no)
  1178. fi
  1179. #
  1180. # End of pthreads stuff.
  1181. #
  1182. #
  1183. # Large File
  1184. #
  1185. AC_ARG_ENABLE(largefile, [ --enable-largefile 64-bit file support],
  1186. want_largefile="yes", want_largefile="no")
  1187. case $want_largefile in
  1188. yes)
  1189. ALWAYS_DEFINES="$ALWAYS_DEFINES -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
  1190. ;;
  1191. *)
  1192. ;;
  1193. esac
  1194. #
  1195. # Additional compiler settings.
  1196. #
  1197. MKDEPCC="$CC"
  1198. MKDEPCFLAGS="-M"
  1199. IRIX_DNSSEC_WARNINGS_HACK=""
  1200. if test "X$GCC" = "Xyes"; then
  1201. AC_MSG_CHECKING(if "$CC" supports -fno-strict-aliasing)
  1202. SAVE_CFLAGS=$CFLAGS
  1203. CFLAGS="$CFLAGS -fno-strict-aliasing"
  1204. AC_TRY_COMPILE(,, [FNOSTRICTALIASING=yes],[FNOSTRICTALIASING=no])
  1205. CFLAGS=$SAVE_CFLAGS
  1206. if test "$FNOSTRICTALIASING" = "yes"; then
  1207. AC_MSG_RESULT(yes)
  1208. STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith -fno-strict-aliasing"
  1209. else
  1210. AC_MSG_RESULT(no)
  1211. STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith"
  1212. fi
  1213. case "$host" in
  1214. *-hp-hpux*)
  1215. LDFLAGS="-Wl,+vnocompatwarnings $LDFLAGS"
  1216. ;;
  1217. esac
  1218. else
  1219. case $host in
  1220. *-dec-osf*)
  1221. CC="$CC -std"
  1222. CCOPT="$CCOPT -std"
  1223. MKDEPCC="$CC"
  1224. ;;
  1225. *-hp-hpux*)
  1226. CC="$CC -Ae -z"
  1227. # The version of the C compiler that constantly warns about
  1228. # 'const' as well as alignment issues is unfortunately not
  1229. # able to be discerned via the version of the operating
  1230. # system, nor does cc have a version flag.
  1231. case "`$CC +W 123 2>&1`" in
  1232. *Unknown?option*)
  1233. STD_CWARNINGS="+w1"
  1234. ;;
  1235. *)
  1236. # Turn off the pointlessly noisy warnings.
  1237. STD_CWARNINGS="+w1 +W 474,530,2193,2236"
  1238. ;;
  1239. esac
  1240. CCOPT="$CCOPT -Ae -z"
  1241. LDFLAGS="-Wl,+vnocompatwarnings $LDFLAGS"
  1242. MKDEPPROG='cc -Ae -E -Wp,-M >/dev/null 2>>$TMP'
  1243. ;;
  1244. *-sgi-irix*)
  1245. STD_CWARNINGS="-fullwarn -woff 1209"
  1246. #
  1247. # Silence more than 250 instances of
  1248. # "prototyped function redeclared without prototype"
  1249. # and 11 instances of
  1250. # "variable ... was set but never used"
  1251. # from lib/dns/sec/openssl.
  1252. #
  1253. IRIX_DNSSEC_WARNINGS_HACK="-woff 1692,1552"
  1254. ;;
  1255. *-solaris*)
  1256. MKDEPCFLAGS="-xM"
  1257. ;;
  1258. *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
  1259. # UnixWare
  1260. CC="$CC -w"
  1261. ;;
  1262. esac
  1263. fi
  1264. AC_SUBST(MKDEPCC)
  1265. AC_SUBST(MKDEPCFLAGS)
  1266. AC_SUBST(MKDEPPROG)
  1267. AC_SUBST(IRIX_DNSSEC_WARNINGS_HACK)
  1268. #
  1269. # NLS
  1270. #
  1271. AC_CHECK_FUNC(catgets, AC_DEFINE(HAVE_CATGETS),)
  1272. #
  1273. # -lxnet buys us one big porting headache... standards, gotta love 'em.
  1274. #
  1275. # AC_CHECK_LIB(xnet, socket, ,
  1276. # AC_CHECK_LIB(socket, socket)
  1277. # )
  1278. #
  1279. # Use this for now, instead:
  1280. #
  1281. case "$host" in
  1282. mips-sgi-irix*)
  1283. ;;
  1284. *-linux*)
  1285. ;;
  1286. *)
  1287. AC_CHECK_LIB(socket, socket)
  1288. AC_CHECK_LIB(nsl, inet_addr)
  1289. ;;
  1290. esac
  1291. #
  1292. # Work around Solaris's select() limitations.
  1293. #
  1294. case "$host" in
  1295. *-solaris2.[[89]]|*-solaris2.1?)
  1296. AC_DEFINE(FD_SETSIZE, 65536,
  1297. [Solaris hack to get select_large_fdset.])
  1298. ;;
  1299. esac
  1300. #
  1301. # Purify support
  1302. #
  1303. AC_MSG_CHECKING(whether to use purify)
  1304. AC_ARG_WITH(purify,
  1305. [ --with-purify[=PATH] use Rational purify],
  1306. use_purify="$withval", use_purify="no")
  1307. case "$use_purify" in
  1308. no)
  1309. ;;
  1310. yes)
  1311. AC_PATH_PROG(purify_path, purify, purify)
  1312. ;;
  1313. *)
  1314. purify_path="$use_purify"
  1315. ;;
  1316. esac
  1317. case "$use_purify" in
  1318. no)
  1319. AC_MSG_RESULT(no)
  1320. PURIFY=""
  1321. ;;
  1322. *)
  1323. if test -f $purify_path || test $purify_path = purify; then
  1324. AC_MSG_RESULT($purify_path)
  1325. PURIFYFLAGS="`echo $PURIFYOPTIONS`"
  1326. PURIFY="$purify_path $PURIFYFLAGS"
  1327. else
  1328. AC_MSG_ERROR([$purify_path not found.
  1329. Please choose the proper path with the following command:
  1330. configure --with-purify=PATH
  1331. ])
  1332. fi
  1333. ;;
  1334. esac
  1335. AC_SUBST(PURIFY)
  1336. AC_ARG_WITH(libtool,
  1337. [ --with-libtool use GNU libtool],
  1338. use_libtool="$withval", use_libtool="no")
  1339. case $use_libtool in
  1340. yes)
  1341. AM_PROG_LIBTOOL
  1342. O=lo
  1343. A=la
  1344. LIBTOOL_MKDEP_SED='s;\.o;\.lo;'
  1345. LIBTOOL_MODE_COMPILE='--mode=compile --tag=CC'
  1346. LIBTOOL_MODE_INSTALL='--mode=install --tag=CC'
  1347. LIBTOOL_MODE_LINK='--mode=link --tag=CC'
  1348. case "$host" in
  1349. *) LIBTOOL_ALLOW_UNDEFINED= ;;
  1350. esac
  1351. case "$host" in
  1352. *-ibm-aix*) LIBTOOL_IN_MAIN="-Wl,-bI:T_testlist.imp" ;;
  1353. *) LIBTOOL_IN_MAIN= ;;
  1354. esac;
  1355. ;;
  1356. *)
  1357. O=o
  1358. A=a
  1359. LIBTOOL=
  1360. AC_SUBST(LIBTOOL)
  1361. LIBTOOL_MKDEP_SED=
  1362. LIBTOOL_MODE_COMPILE=
  1363. LIBTOOL_MODE_INSTALL=
  1364. LIBTOOL_MODE_LINK=
  1365. LIBTOOL_ALLOW_UNDEFINED=
  1366. LIBTOOL_IN_MAIN=
  1367. ;;
  1368. esac
  1369. #
  1370. # enable/disable dumping stack backtrace. Also check if the system supports
  1371. # glibc-compatible backtrace() function.
  1372. #
  1373. AC_ARG_ENABLE(backtrace,
  1374. [ --enable-backtrace log stack backtrace on abort [[default=yes]]],
  1375. want_backtrace="$enableval", want_backtrace="yes")
  1376. case $want_backtrace in
  1377. yes)
  1378. ISC_PLATFORM_USEBACKTRACE="#define ISC_PLATFORM_USEBACKTRACE 1"
  1379. AC_TRY_LINK([#include <execinfo.h>],
  1380. [return (backtrace((void **)0, 0));],
  1381. [AC_DEFINE([HAVE_LIBCTRACE], [], [if system have backtrace function])],)
  1382. ;;
  1383. *)
  1384. ISC_PLATFORM_USEBACKTRACE="#undef ISC_PLATFORM_USEBACKTRACE"
  1385. ;;
  1386. esac
  1387. AC_SUBST(ISC_PLATFORM_USEBACKTRACE)
  1388. AC_ARG_ENABLE(symtable,
  1389. [ --enable-symtable use internal symbol table for backtrace
  1390. [[all|minimal(default)|none]]],
  1391. want_symtable="$enableval", want_symtable="minimal")
  1392. case $want_symtable in
  1393. yes|all|minimal) # "yes" is a hidden value equivalent to "minimal"
  1394. if test "$PERL" = ""
  1395. then
  1396. AC_MSG_ERROR([Internal symbol table requires perl but no perl is found.
  1397. Install perl or explicitly disable the feature by --disable-symtable.])
  1398. fi
  1399. if test "$use_libtool" = "yes"; then
  1400. AC_MSG_WARN([Internal symbol table does not work with libtool. Disabling symbol table.])
  1401. else
  1402. # we generate the internal symbol table only for those systems
  1403. # known to work to avoid unexpected build failure. Also, warn
  1404. # about unsupported systems when the feature is enabled
  1405. # manually.
  1406. case $host_os in
  1407. freebsd*|netbsd*|openbsd*|linux*|solaris*|darwin*)
  1408. MKSYMTBL_PROGRAM="$PERL"
  1409. if test $want_symtable = all; then
  1410. ALWAYS_MAKE_SYMTABLE="yes"
  1411. fi
  1412. ;;
  1413. *)
  1414. if test $want_symtable = yes -o $want_symtable = all
  1415. then
  1416. AC_MSG_WARN([this system is not known to generate internal symbol table safely; disabling it])
  1417. fi
  1418. esac
  1419. fi
  1420. ;;
  1421. *)
  1422. ;;
  1423. esac
  1424. AC_SUBST(MKSYMTBL_PROGRAM)
  1425. AC_SUBST(ALWAYS_MAKE_SYMTABLE)
  1426. #
  1427. # File name extension for static archive files, for those few places
  1428. # where they are treated differently from dynamic ones.
  1429. #
  1430. SA=a
  1431. AC_SUBST(O)
  1432. AC_SUBST(A)
  1433. AC_SUBST(SA)
  1434. AC_SUBST(LIBTOOL_MKDEP_SED)
  1435. AC_SUBST(LIBTOOL_MODE_COMPILE)
  1436. AC_SUBST(LIBTOOL_MODE_INSTALL)
  1437. AC_SUBST(LIBTOOL_MODE_LINK)
  1438. AC_SUBST(LIBTOOL_ALLOW_UNDEFINED)
  1439. AC_SUBST(LIBTOOL_IN_MAIN)
  1440. #
  1441. # build exportable DNS library?
  1442. #
  1443. AC_ARG_ENABLE(exportlib,
  1444. [ --enable-exportlib build exportable library (GNU make required)
  1445. [[default=no]]])
  1446. case "$enable_exportlib" in
  1447. yes)
  1448. gmake=
  1449. for x in gmake gnumake make; do
  1450. if $x --version 2>/dev/null | grep GNU > /dev/null; then
  1451. gmake=$x
  1452. break;
  1453. fi
  1454. done
  1455. if test -z "$gmake"; then
  1456. AC_MSG_ERROR([exportlib requires GNU make. Install it or disable the feature.])
  1457. fi
  1458. LIBEXPORT=lib/export
  1459. AC_SUBST(LIBEXPORT)
  1460. BIND9_CO_RULE="%.$O: \${srcdir}/%.c"
  1461. ;;
  1462. no|*)
  1463. BIND9_CO_RULE=".c.$O:"
  1464. ;;
  1465. esac
  1466. AC_SUBST(BIND9_CO_RULE)
  1467. AC_ARG_WITH(export-libdir,
  1468. [ --with-export-libdir[=PATH]
  1469. installation directory for the export library
  1470. [[EPREFIX/lib/bind9]]],
  1471. export_libdir="$withval",)
  1472. if test -z "$export_libdir"; then
  1473. export_libdir="\${exec_prefix}/lib/bind9/"
  1474. fi
  1475. AC_SUBST(export_libdir)
  1476. AC_ARG_WITH(export-includedir,
  1477. [ --with-export-includedir[=PATH]
  1478. installation directory for the header files of the
  1479. export library [[PREFIX/include/bind9]]],
  1480. export_includedir="$withval",)
  1481. if test -z "$export_includedir"; then
  1482. export_includedir="\${prefix}/include/bind9/"
  1483. fi
  1484. AC_SUBST(export_includedir)
  1485. #
  1486. # Here begins a very long section to determine the system's networking
  1487. # capabilities. The order of the tests is significant.
  1488. #
  1489. #
  1490. # IPv6
  1491. #
  1492. AC_ARG_ENABLE(ipv6,
  1493. [ --enable-ipv6 use IPv6 [default=autodetect]])
  1494. case "$enable_ipv6" in
  1495. yes|''|autodetect)
  1496. AC_DEFINE(WANT_IPV6)
  1497. ;;
  1498. no)
  1499. ;;
  1500. esac
  1501. #
  1502. # We do the IPv6 compilation checking after libtool so that we can put
  1503. # the right suffix on the files.
  1504. #
  1505. AC_MSG_CHECKING(for IPv6 structures)
  1506. AC_TRY_COMPILE([
  1507. #include <sys/types.h>
  1508. #include <sys/socket.h>
  1509. #include <netinet/in.h>],
  1510. [struct sockaddr_in6 sin6; return (0);],
  1511. [AC_MSG_RESULT(yes)
  1512. found_ipv6=yes],
  1513. [AC_MSG_RESULT(no)
  1514. found_ipv6=no])
  1515. #
  1516. # See whether IPv6 support is provided via a Kame add-on.
  1517. # This is done before other IPv6 linking tests to LIBS is properly set.
  1518. #
  1519. AC_MSG_CHECKING(for Kame IPv6 support)
  1520. AC_ARG_WITH(kame,
  1521. [ --with-kame[=PATH] use Kame IPv6 [default path /usr/local/v6]],
  1522. use_kame="$withval", use_kame="no")
  1523. case "$use_kame" in
  1524. no)
  1525. ;;
  1526. yes)
  1527. kame_path=/usr/local/v6
  1528. ;;
  1529. *)
  1530. kame_path="$use_kame"
  1531. ;;
  1532. esac
  1533. case "$use_kame" in
  1534. no)
  1535. AC_MSG_RESULT(no)
  1536. ;;
  1537. *)
  1538. if test -f $kame_path/lib/libinet6.a; then
  1539. AC_MSG_RESULT($kame_path/lib/libinet6.a)
  1540. LIBS="-L$kame_path/lib -linet6 $LIBS"
  1541. else
  1542. AC_MSG_ERROR([$kame_path/lib/libinet6.a not found.
  1543. Please choose the proper path with the following command:
  1544. configure --with-kame=PATH
  1545. ])
  1546. fi
  1547. ;;
  1548. esac
  1549. #
  1550. # Whether netinet6/in6.h is needed has to be defined in isc/platform.h.
  1551. # Including it on Kame-using platforms is very bad, though, because
  1552. # Kame uses #error against direct inclusion. So include it on only
  1553. # the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1.
  1554. # This is done before the in6_pktinfo check because that's what
  1555. # netinet6/in6.h is needed for.
  1556. #
  1557. changequote({, })
  1558. case "$host" in
  1559. *-bsdi4.[01]*)
  1560. ISC_PLATFORM_NEEDNETINET6IN6H="#define ISC_PLATFORM_NEEDNETINET6IN6H 1"
  1561. LWRES_PLATFORM_NEEDNETINET6IN6H="#define LWRES_PLATFORM_NEEDNETINET6IN6H 1"
  1562. isc_netinet6in6_hack="#include <netinet6/in6.h>"
  1563. ;;
  1564. *)
  1565. ISC_PLATFORM_NEEDNETINET6IN6H="#undef ISC_PLATFORM_NEEDNETINET6IN6H"
  1566. LWRES_PLATFORM_NEEDNETINET6IN6H="#undef LWRES_PLATFORM_NEEDNETINET6IN6H"
  1567. isc_netinet6in6_hack=""
  1568. ;;
  1569. esac
  1570. changequote([, ])
  1571. #
  1572. # This is similar to the netinet6/in6.h issue.
  1573. #
  1574. case "$host" in
  1575. *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
  1576. # UnixWare
  1577. ISC_PLATFORM_NEEDNETINETIN6H="#define ISC_PLATFORM_NEEDNETINETIN6H 1"
  1578. LWRES_PLATFORM_NEEDNETINETIN6H="#define LWRES_PLATFORM_NEEDNETINETIN6H 1"
  1579. ISC_PLATFORM_FIXIN6ISADDR="#define ISC_PLATFORM_FIXIN6ISADDR 1"
  1580. isc_netinetin6_hack="#include <netinet/in6.h>"
  1581. ;;
  1582. *)
  1583. ISC_PLATFORM_NEEDNETINETIN6H="#undef ISC_PLATFORM_NEEDNETINETIN6H"
  1584. LWRES_PLATFORM_NEEDNETINETIN6H="#undef LWRES_PLATFORM_NEEDNETINETIN6H"
  1585. ISC_PLATFORM_FIXIN6ISADDR="#undef ISC_PLATFORM_FIXIN6ISADDR"
  1586. isc_netinetin6_hack=""
  1587. ;;
  1588. esac
  1589. #
  1590. # Now delve deeper into the suitability of the IPv6 support.
  1591. #
  1592. case "$found_ipv6" in
  1593. yes)
  1594. ISC_PLATFORM_HAVEIPV6="#define ISC_PLATFORM_HAVEIPV6 1"
  1595. LWRES_PLATFORM_HAVEIPV6="#define LWRES_PLATFORM_HAVEIPV6 1"
  1596. AC_MSG_CHECKING(for in6_addr)
  1597. AC_TRY_COMPILE([
  1598. #include <sys/types.h>
  1599. #include <sys/socket.h>
  1600. #include <netinet/in.h>
  1601. $isc_netinetin6_hack
  1602. $isc_netinet6in6_hack
  1603. ],
  1604. [struct in6_addr in6; return (0);],
  1605. [AC_MSG_RESULT(yes)
  1606. ISC_PLATFORM_HAVEINADDR6="#undef ISC_PLATFORM_HAVEINADDR6"
  1607. LWRES_PLATFORM_HAVEINADDR6="#undef LWRES_PLATFORM_HAVEINADDR6"
  1608. isc_in_addr6_hack=""],
  1609. [AC_MSG_RESULT(no)
  1610. ISC_PLATFORM_HAVEINADDR6="#define ISC_PLATFORM_HAVEINADDR6 1"
  1611. LWRES_PLATFORM_HAVEINADDR6="#define LWRES_PLATFORM_HAVEINADDR6 1"
  1612. isc_in_addr6_hack="#define in6_addr in_addr6"])
  1613. AC_MSG_CHECKING(for in6addr_any)
  1614. AC_TRY_LINK([
  1615. #include <sys/types.h>
  1616. #include <sys/socket.h>
  1617. #include <netinet/in.h>
  1618. $isc_netinetin6_hack
  1619. $isc_netinet6in6_hack
  1620. $isc_in_addr6_hack
  1621. ],
  1622. [struct in6_addr in6; in6 = in6addr_any; return (in6.s6_addr[0]);],
  1623. [AC_MSG_RESULT(yes)
  1624. ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
  1625. LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"],
  1626. [AC_MSG_RESULT(no)
  1627. ISC_PLATFORM_NEEDIN6ADDRANY="#define ISC_PLATFORM_NEEDIN6ADDRANY 1"
  1628. LWRES_PLATFORM_NEEDIN6ADDRANY="#define LWRES_PLATFORM_NEEDIN6ADDRANY 1"])
  1629. AC_MSG_CHECKING(for in6addr_loopback)
  1630. AC_TRY_LINK([
  1631. #include <sys/types.h>
  1632. #include <sys/socket.h>
  1633. #include <netinet/in.h>
  1634. $isc_netinetin6_hack
  1635. $isc_netinet6in6_hack
  1636. $isc_in_addr6_hack
  1637. ],
  1638. [struct in6_addr in6; in6 = in6addr_loopback; return (in6.s6_addr[0]);],
  1639. [AC_MSG_RESULT(yes)
  1640. ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef ISC_PLATFORM_NEEDIN6ADDRLOOPBACK"
  1641. LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#undef LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK"],
  1642. [AC_MSG_RESULT(no)
  1643. ISC_PLATFORM_NEEDIN6ADDRLOOPBACK="#define ISC_PLATFORM_NEEDIN6ADDRLOOPBACK 1"
  1644. LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK="#define LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK 1"])
  1645. AC_MSG_CHECKING(for sin6_scope_id in struct sockaddr_in6)
  1646. AC_TRY_COMPILE([
  1647. #include <sys/types.h>
  1648. #include <sys/socket.h>
  1649. #include <netinet/in.h>
  1650. $isc_netinetin6_hack
  1651. $isc_netinet6in6_hack
  1652. ],
  1653. [struct sockaddr_in6 xyzzy; xyzzy.sin6_scope_id = 0; return (0);],
  1654. [AC_MSG_RESULT(yes)
  1655. ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1"
  1656. result="#define LWRES_HAVE_SIN6_SCOPE_ID 1"],
  1657. [AC_MSG_RESULT(no)
  1658. ISC_PLATFORM_HAVESCOPEID="#undef ISC_PLATFORM_HAVESCOPEID"
  1659. result="#undef LWRES_HAVE_SIN6_SCOPE_ID"])
  1660. LWRES_HAVE_SIN6_SCOPE_ID="$result"
  1661. AC_MSG_CHECKING(for in6_pktinfo)
  1662. AC_TRY_COMPILE([
  1663. #include <sys/types.h>
  1664. #include <sys/socket.h>
  1665. #include <netinet/in.h>
  1666. $isc_netinetin6_hack
  1667. $isc_netinet6in6_hack
  1668. ],
  1669. [struct in6_pktinfo xyzzy; return (0);],
  1670. [AC_MSG_RESULT(yes)
  1671. ISC_PLATFORM_HAVEIN6PKTINFO="#define ISC_PLATFORM_HAVEIN6PKTINFO 1"],
  1672. [AC_MSG_RESULT(no -- disabling runtime ipv6 support)
  1673. ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"])
  1674. ;;
  1675. no)
  1676. ISC_PLATFORM_HAVEIPV6="#undef ISC_PLATFORM_HAVEIPV6"
  1677. LWRES_PLATFORM_HAVEIPV6="#undef LWRES_PLATFORM_HAVEIPV6"
  1678. ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
  1679. LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"
  1680. ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"
  1681. LWRES_HAVE_SIN6_SCOPE_ID="#define LWRES_HAVE_SIN6_SCOPE_ID 1"
  1682. ISC_PLATFORM_HAVESCOPEID="#define ISC_PLATFORM_HAVESCOPEID 1"
  1683. ISC_IPV6_H="ipv6.h"
  1684. ISC_IPV6_O="ipv6.$O"
  1685. ISC_ISCIPV6_O="unix/ipv6.$O"
  1686. ISC_IPV6_C="ipv6.c"
  1687. ;;
  1688. esac
  1689. AC_SUBST(ISC_PLATFORM_HAVEIPV6)
  1690. AC_SUBST(LWRES_PLATFORM_HAVEIPV6)
  1691. AC_SUBST(ISC_PLATFORM_NEEDNETINETIN6H)
  1692. AC_SUBST(LWRES_PLATFORM_NEEDNETINETIN6H)
  1693. AC_SUBST(ISC_PLATFORM_NEEDNETINET6IN6H)
  1694. AC_SUBST(LWRES_PLATFORM_NEEDNETINET6IN6H)
  1695. AC_SUBST(ISC_PLATFORM_HAVEINADDR6)
  1696. AC_SUBST(LWRES_PLATFORM_HAVEINADDR6)
  1697. AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRANY)
  1698. AC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRANY)
  1699. AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK)
  1700. AC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK)
  1701. AC_SUBST(ISC_PLATFORM_HAVEIN6PKTINFO)
  1702. AC_SUBST(ISC_PLATFORM_FIXIN6ISADDR)
  1703. AC_SUBST(ISC_IPV6_H)
  1704. AC_SUBST(ISC_IPV6_O)
  1705. AC_SUBST(ISC_ISCIPV6_O)
  1706. AC_SUBST(ISC_IPV6_C)
  1707. AC_SUBST(LWRES_HAVE_SIN6_SCOPE_ID)
  1708. AC_SUBST(ISC_PLATFORM_HAVESCOPEID)
  1709. AC_MSG_CHECKING([for struct if_laddrreq])
  1710. AC_TRY_LINK([
  1711. #include <sys/types.h>
  1712. #include <net/if6.h>
  1713. ],[ struct if_laddrreq a; ],
  1714. [AC_MSG_RESULT(yes)
  1715. ISC_PLATFORM_HAVEIF_LADDRREQ="#define ISC_PLATFORM_HAVEIF_LADDRREQ 1"],
  1716. [AC_MSG_RESULT(no)
  1717. ISC_PLATFORM_HAVEIF_LADDRREQ="#undef ISC_PLATFORM_HAVEIF_LADDRREQ"])
  1718. AC_SUBST(ISC_PLATFORM_HAVEIF_LADDRREQ)
  1719. AC_MSG_CHECKING([for struct if_laddrconf])
  1720. AC_TRY_LINK([
  1721. #include <sys/types.h>
  1722. #include <net/if6.h>
  1723. ],[ struct if_laddrconf a; ],
  1724. [AC_MSG_RESULT(yes)
  1725. ISC_PLATFORM_HAVEIF_LADDRCONF="#define ISC_PLATFORM_HAVEIF_LADDRCONF 1"],
  1726. [AC_MSG_RESULT(no)
  1727. ISC_PLATFORM_HAVEIF_LADDRCONF="#undef ISC_PLATFORM_HAVEIF_LADDRCONF"])
  1728. AC_SUBST(ISC_PLATFORM_HAVEIF_LADDRCONF)
  1729. #
  1730. # Check for network functions that are often missing. We do this
  1731. # after the libtool checking, so we can put the right suffix on
  1732. # the files. It also needs to come after checking for a Kame add-on,
  1733. # which provides some (all?) of the desired functions.
  1734. #
  1735. AC_MSG_CHECKING([for inet_ntop with IPv6 support])
  1736. AC_TRY_RUN([
  1737. #include <sys/types.h>
  1738. #include <sys/socket.h>
  1739. #include <netinet/in.h>
  1740. #include <arpa/inet.h>
  1741. main() {
  1742. char a[16],b[64]; return(inet_ntop(AF_INET6, a, b, sizeof(b)) == (char*)0);}],
  1743. [AC_MSG_RESULT(yes)
  1744. ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"],
  1745. [AC_MSG_RESULT(no)
  1746. ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_ntop.$O"
  1747. ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_ntop.c"
  1748. ISC_PLATFORM_NEEDNTOP="#define ISC_PLATFORM_NEEDNTOP 1"],
  1749. [AC_MSG_RESULT(assuming inet_ntop not needed)
  1750. ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"])
  1751. # On NetBSD 1.4.2 and maybe others, inet_pton() incorrectly accepts
  1752. # addresses with less than four octets, like "1.2.3". Also leading
  1753. # zeros should also be rejected.
  1754. AC_MSG_CHECKING([for working inet_pton with IPv6 support])
  1755. AC_TRY_RUN([
  1756. #include <sys/types.h>
  1757. #include <sys/socket.h>
  1758. #include <netinet/in.h>
  1759. #include <arpa/inet.h>
  1760. main() { char a[16]; return (inet_pton(AF_INET, "1.2.3", a) == 1 ? 1 :
  1761. inet_pton(AF_INET, "1.2.3.04", a) == 1 ? 1 :
  1762. (inet_pton(AF_INET6, "::1.2.3.4", a) != 1)); }],
  1763. [AC_MSG_RESULT(yes)
  1764. ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"],
  1765. [AC_MSG_RESULT(no)
  1766. ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O"
  1767. ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c"
  1768. ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1"],
  1769. [AC_MSG_RESULT(assuming inet_pton needed)
  1770. ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O"
  1771. ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c"
  1772. ISC_PLATFORM_NEEDPTON="#define ISC_PLATFOR…