PageRenderTime 77ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 1ms

/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
Possible License(s): MPL-2.0-no-copyleft-exception, BSD-3-Clause, LGPL-2.0, LGPL-2.1, BSD-2-Clause, 0BSD, JSON, AGPL-1.0, GPL-2.0
  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_PLATFORM_NEEDPTON 1"])
  1773. AC_SUBST(ISC_PLATFORM_NEEDNTOP)
  1774. AC_SUBST(ISC_PLATFORM_NEEDPTON)
  1775. #
  1776. # Look for a 4.4BSD-style sa_len member in struct sockaddr.
  1777. #
  1778. case "$host" in
  1779. *-dec-osf*)
  1780. # Turn on 4.4BSD style sa_len support.
  1781. AC_DEFINE(_SOCKADDR_LEN)
  1782. ;;
  1783. esac
  1784. AC_MSG_CHECKING(for sa_len in struct sockaddr)
  1785. AC_TRY_COMPILE([
  1786. #include <sys/types.h>
  1787. #include <sys/socket.h>],
  1788. [struct sockaddr sa; sa.sa_len = 0; return (0);],
  1789. [AC_MSG_RESULT(yes)
  1790. ISC_PLATFORM_HAVESALEN="#define ISC_PLATFORM_HAVESALEN 1"
  1791. LWRES_PLATFORM_HAVESALEN="#define LWRES_PLATFORM_HAVESALEN 1"],
  1792. [AC_MSG_RESULT(no)
  1793. ISC_PLATFORM_HAVESALEN="#undef ISC_PLATFORM_HAVESALEN"
  1794. LWRES_PLATFORM_HAVESALEN="#undef LWRES_PLATFORM_HAVESALEN"])
  1795. AC_SUBST(ISC_PLATFORM_HAVESALEN)
  1796. AC_SUBST(LWRES_PLATFORM_HAVESALEN)
  1797. #
  1798. # Look for a 4.4BSD or 4.3BSD struct msghdr
  1799. #
  1800. AC_MSG_CHECKING(for struct msghdr flavor)
  1801. AC_TRY_COMPILE([
  1802. #include <sys/types.h>
  1803. #include <sys/socket.h>],
  1804. [struct msghdr msg; msg.msg_flags = 0; return (0);],
  1805. [AC_MSG_RESULT(4.4BSD)
  1806. ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD44MSGHDR 1"],
  1807. [AC_MSG_RESULT(4.3BSD)
  1808. ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD43MSGHDR 1"])
  1809. AC_SUBST(ISC_PLATFORM_MSGHDRFLAVOR)
  1810. #
  1811. # Look for in_port_t.
  1812. #
  1813. AC_MSG_CHECKING(for type in_port_t)
  1814. AC_TRY_COMPILE([
  1815. #include <sys/types.h>
  1816. #include <netinet/in.h>],
  1817. [in_port_t port = 25; return (0);],
  1818. [AC_MSG_RESULT(yes)
  1819. ISC_PLATFORM_NEEDPORTT="#undef ISC_PLATFORM_NEEDPORTT"],
  1820. [AC_MSG_RESULT(no)
  1821. ISC_PLATFORM_NEEDPORTT="#define ISC_PLATFORM_NEEDPORTT 1"])
  1822. AC_SUBST(ISC_PLATFORM_NEEDPORTT)
  1823. #
  1824. # Check for addrinfo
  1825. #
  1826. AC_MSG_CHECKING(for struct addrinfo)
  1827. AC_TRY_COMPILE([
  1828. #include <netdb.h>],
  1829. [struct addrinfo a; return (0);],
  1830. [AC_MSG_RESULT(yes)
  1831. ISC_LWRES_NEEDADDRINFO="#undef ISC_LWRES_NEEDADDRINFO"
  1832. ISC_IRS_NEEDADDRINFO="#undef ISC_IRS_NEEDADDRINFO"
  1833. AC_DEFINE(HAVE_ADDRINFO)],
  1834. [AC_MSG_RESULT(no)
  1835. ISC_LWRES_NEEDADDRINFO="#define ISC_LWRES_NEEDADDRINFO 1"
  1836. ISC_IRS_NEEDADDRINFO="#define ISC_IRS_NEEDADDRINFO 1"])
  1837. AC_SUBST(ISC_LWRES_NEEDADDRINFO)
  1838. AC_SUBST(ISC_IRS_NEEDADDRINFO)
  1839. #
  1840. # Check for rrsetinfo
  1841. #
  1842. AC_MSG_CHECKING(for struct rrsetinfo)
  1843. AC_TRY_COMPILE([
  1844. #include <netdb.h>],
  1845. [struct rrsetinfo r; return (0);],
  1846. [AC_MSG_RESULT(yes)
  1847. ISC_LWRES_NEEDRRSETINFO="#undef ISC_LWRES_NEEDRRSETINFO"],
  1848. [AC_MSG_RESULT(no)
  1849. ISC_LWRES_NEEDRRSETINFO="#define ISC_LWRES_NEEDRRSETINFO 1"])
  1850. AC_SUBST(ISC_LWRES_NEEDRRSETINFO)
  1851. AC_MSG_CHECKING(for int sethostent)
  1852. AC_TRY_COMPILE([
  1853. #include <netdb.h>],
  1854. [int i = sethostent(0); return(0);],
  1855. [AC_MSG_RESULT(yes)
  1856. ISC_LWRES_SETHOSTENTINT="#define ISC_LWRES_SETHOSTENTINT 1"],
  1857. [AC_MSG_RESULT(no)
  1858. ISC_LWRES_SETHOSTENTINT="#undef ISC_LWRES_SETHOSTENTINT"])
  1859. AC_SUBST(ISC_LWRES_SETHOSTENTINT)
  1860. AC_MSG_CHECKING(for int endhostent)
  1861. AC_TRY_COMPILE([
  1862. #include <netdb.h>],
  1863. [int i = endhostent(); return(0);],
  1864. [AC_MSG_RESULT(yes)
  1865. ISC_LWRES_ENDHOSTENTINT="#define ISC_LWRES_ENDHOSTENTINT 1"],
  1866. [AC_MSG_RESULT(no)
  1867. ISC_LWRES_ENDHOSTENTINT="#undef ISC_LWRES_ENDHOSTENTINT"])
  1868. AC_SUBST(ISC_LWRES_ENDHOSTENTINT)
  1869. AC_MSG_CHECKING(for getnetbyaddr(in_addr_t, ...))
  1870. AC_TRY_COMPILE([
  1871. #include <netdb.h>
  1872. struct netent *getnetbyaddr(in_addr_t, int);],
  1873. [],
  1874. [AC_MSG_RESULT(yes)
  1875. ISC_LWRES_GETNETBYADDRINADDR="#define ISC_LWRES_GETNETBYADDRINADDR 1"],
  1876. [AC_MSG_RESULT(no)
  1877. ISC_LWRES_GETNETBYADDRINADDR="#undef ISC_LWRES_GETNETBYADDRINADDR"])
  1878. AC_SUBST(ISC_LWRES_GETNETBYADDRINADDR)
  1879. AC_MSG_CHECKING(for int setnetent)
  1880. AC_TRY_COMPILE([
  1881. #include <netdb.h>],
  1882. [int i = setnetent(0); return(0);],
  1883. [AC_MSG_RESULT(yes)
  1884. ISC_LWRES_SETNETENTINT="#define ISC_LWRES_SETNETENTINT 1"],
  1885. [AC_MSG_RESULT(no)
  1886. ISC_LWRES_SETNETENTINT="#undef ISC_LWRES_SETNETENTINT"])
  1887. AC_SUBST(ISC_LWRES_SETNETENTINT)
  1888. AC_MSG_CHECKING(for int endnetent)
  1889. AC_TRY_COMPILE([
  1890. #include <netdb.h>],
  1891. [int i = endnetent(); return(0);],
  1892. [AC_MSG_RESULT(yes)
  1893. ISC_LWRES_ENDNETENTINT="#define ISC_LWRES_ENDNETENTINT 1"],
  1894. [AC_MSG_RESULT(no)
  1895. ISC_LWRES_ENDNETENTINT="#undef ISC_LWRES_ENDNETENTINT"])
  1896. AC_SUBST(ISC_LWRES_ENDNETENTINT)
  1897. AC_MSG_CHECKING(for gethostbyaddr(const void *, size_t, ...))
  1898. AC_TRY_COMPILE([
  1899. #include <netdb.h>
  1900. struct hostent *gethostbyaddr(const void *, size_t, int);],
  1901. [return(0);],
  1902. [AC_MSG_RESULT(yes)
  1903. ISC_LWRES_GETHOSTBYADDRVOID="#define ISC_LWRES_GETHOSTBYADDRVOID 1"],
  1904. [AC_MSG_RESULT(no)
  1905. ISC_LWRES_GETHOSTBYADDRVOID="#undef ISC_LWRES_GETHOSTBYADDRVOID"])
  1906. AC_SUBST(ISC_LWRES_GETHOSTBYADDRVOID)
  1907. AC_MSG_CHECKING(for h_errno in netdb.h)
  1908. AC_TRY_COMPILE([
  1909. #include <netdb.h>],
  1910. [h_errno = 1; return(0);],
  1911. [AC_MSG_RESULT(yes)
  1912. ISC_LWRES_NEEDHERRNO="#undef ISC_LWRES_NEEDHERRNO"],
  1913. [AC_MSG_RESULT(no)
  1914. ISC_LWRES_NEEDHERRNO="#define ISC_LWRES_NEEDHERRNO 1"])
  1915. AC_SUBST(ISC_LWRES_NEEDHERRNO)
  1916. #
  1917. # Sadly, the definitions of system-supplied getnameinfo(3) vary. Try to catch
  1918. # known variations here:
  1919. #
  1920. AC_MSG_CHECKING(for getnameinfo prototype definitions)
  1921. AC_TRY_COMPILE([
  1922. #include <sys/types.h>
  1923. #include <sys/socket.h>
  1924. #include <netdb.h>
  1925. int getnameinfo(const struct sockaddr *, socklen_t, char *,
  1926. socklen_t, char *, socklen_t, unsigned int);],
  1927. [ return (0);],
  1928. [AC_MSG_RESULT(socklen_t for buflen; u_int for flags)
  1929. AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, socklen_t,
  1930. [Define to the buffer length type used by getnameinfo(3).])
  1931. AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, unsigned int,
  1932. [Define to the flags type used by getnameinfo(3).])],
  1933. [AC_TRY_COMPILE([
  1934. #include <sys/types.h>
  1935. #include <sys/socket.h>
  1936. #include <netdb.h>
  1937. int getnameinfo(const struct sockaddr *, socklen_t, char *,
  1938. size_t, char *, size_t, int);],
  1939. [ return (0);],
  1940. [AC_MSG_RESULT(size_t for buflen; int for flags)
  1941. AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, size_t)
  1942. AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, int)],
  1943. [AC_MSG_RESULT(not match any subspecies; assume standard definition)
  1944. AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, socklen_t)
  1945. AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, int)])])
  1946. #
  1947. # ...and same for gai_strerror().
  1948. #
  1949. AC_MSG_CHECKING(for gai_strerror prototype definitions)
  1950. AC_TRY_COMPILE([
  1951. #include <sys/types.h>
  1952. #include <sys/socket.h>
  1953. #include <netdb.h>
  1954. char *gai_strerror(int ecode);],
  1955. [ return (0); ],
  1956. [AC_MSG_RESULT(returning char *)
  1957. AC_DEFINE([IRS_GAISTRERROR_RETURN_T], [char *],
  1958. [return type of gai_strerror])],
  1959. [AC_MSG_RESULT(not match any subspecies; assume standard definition)
  1960. AC_DEFINE([IRS_GAISTRERROR_RETURN_T], [const char *])])
  1961. AC_CHECK_FUNC(getipnodebyname,
  1962. [ISC_LWRES_GETIPNODEPROTO="#undef ISC_LWRES_GETIPNODEPROTO"],
  1963. [ISC_LWRES_GETIPNODEPROTO="#define ISC_LWRES_GETIPNODEPROTO 1"])
  1964. AC_CHECK_FUNC(getnameinfo,
  1965. [ISC_LWRES_GETNAMEINFOPROTO="#undef ISC_LWRES_GETNAMEINFOPROTO"],
  1966. [ISC_LWRES_GETNAMEINFOPROTO="#define ISC_LWRES_GETNAMEINFOPROTO 1"])
  1967. AC_CHECK_FUNC(getaddrinfo,
  1968. [ISC_LWRES_GETADDRINFOPROTO="#undef ISC_LWRES_GETADDRINFOPROTO"
  1969. AC_DEFINE(HAVE_GETADDRINFO)],
  1970. [ISC_LWRES_GETADDRINFOPROTO="#define ISC_LWRES_GETADDRINFOPROTO 1"])
  1971. AC_CHECK_FUNC(gai_strerror, AC_DEFINE(HAVE_GAISTRERROR))
  1972. AC_SUBST(ISC_LWRES_GETIPNODEPROTO)
  1973. AC_SUBST(ISC_LWRES_GETADDRINFOPROTO)
  1974. AC_SUBST(ISC_LWRES_GETNAMEINFOPROTO)
  1975. AC_SUBST(ISC_IRS_GETNAMEINFOSOCKLEN)
  1976. AC_ARG_ENABLE(getifaddrs,
  1977. [ --enable-getifaddrs Enable the use of getifaddrs() [[yes|no]].],
  1978. want_getifaddrs="$enableval", want_getifaddrs="yes")
  1979. #
  1980. # This interface iteration code for getifaddrs() will fall back to using
  1981. # /proc/net/if_inet6 if getifaddrs() in glibc doesn't return any IPv6
  1982. # addresses.
  1983. #
  1984. case $want_getifaddrs in
  1985. glibc)
  1986. AC_MSG_WARN("--enable-getifaddrs=glibc is no longer required")
  1987. AC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAVE_GETIFADDRS))
  1988. ;;
  1989. yes)
  1990. AC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAVE_GETIFADDRS))
  1991. ;;
  1992. no)
  1993. ;;
  1994. esac
  1995. #
  1996. # Look for a sysctl call to get the list of network interfaces.
  1997. #
  1998. case $ac_cv_header_sys_sysctl_h in
  1999. yes)
  2000. AC_MSG_CHECKING(for interface list sysctl)
  2001. AC_EGREP_CPP(found_rt_iflist, [
  2002. #include <sys/param.h>
  2003. #include <sys/sysctl.h>
  2004. #include <sys/socket.h>
  2005. #ifdef NET_RT_IFLIST
  2006. found_rt_iflist
  2007. #endif
  2008. ],
  2009. [AC_MSG_RESULT(yes)
  2010. AC_DEFINE(HAVE_IFLIST_SYSCTL)],
  2011. [AC_MSG_RESULT(no)])
  2012. ;;
  2013. esac
  2014. #
  2015. # Check for some other useful functions that are not ever-present.
  2016. #
  2017. # We test for strsep() using AC_TRY_LINK instead of AC_CHECK_FUNC
  2018. # because AIX 4.3.3 with patches for bos.adt.include to version 4.3.3.77
  2019. # reportedly defines strsep() without declaring it in <string.h> when
  2020. # -D_LINUX_SOURCE_COMPAT is not defined [RT #2190], and
  2021. # AC_CHECK_FUNC() incorrectly succeeds because it declares
  2022. # the function itself.
  2023. AC_MSG_CHECKING(for correctly declared strsep())
  2024. AC_TRY_LINK([#include <string.h>], [char *sp; char *foo = strsep(&sp, ".");],
  2025. [AC_MSG_RESULT(yes); ISC_PLATFORM_NEEDSTRSEP="#undef ISC_PLATFORM_NEEDSTRSEP"],
  2026. [AC_MSG_RESULT(no); ISC_PLATFORM_NEEDSTRSEP="#define ISC_PLATFORM_NEEDSTRSEP 1"])
  2027. AC_SUBST(ISC_PLATFORM_NEEDSTRSEP)
  2028. AC_CHECK_FUNC(memmove,
  2029. [ISC_PLATFORM_NEEDMEMMOVE="#undef ISC_PLATFORM_NEEDMEMMOVE"],
  2030. [ISC_PLATFORM_NEEDMEMMOVE="#define ISC_PLATFORM_NEEDMEMMOVE 1"])
  2031. AC_SUBST(ISC_PLATFORM_NEEDMEMMOVE)
  2032. AC_CHECK_FUNC(strtoul,
  2033. [ISC_PLATFORM_NEEDSTRTOUL="#undef ISC_PLATFORM_NEEDSTRTOUL"
  2034. LWRES_PLATFORM_NEEDSTRTOUL="#undef LWRES_PLATFORM_NEEDSTRTOUL"
  2035. GENRANDOMLIB=""],
  2036. [ISC_PLATFORM_NEEDSTRTOUL="#define ISC_PLATFORM_NEEDSTRTOUL 1"
  2037. LWRES_PLATFORM_NEEDSTRTOUL="#define LWRES_PLATFORM_NEEDSTRTOUL 1"
  2038. GENRANDOMLIB='${ISCLIBS}'])
  2039. AC_SUBST(ISC_PLATFORM_NEEDSTRTOUL)
  2040. AC_SUBST(LWRES_PLATFORM_NEEDSTRTOUL)
  2041. AC_SUBST(GENRANDOMLIB)
  2042. AC_CHECK_FUNC(strlcpy,
  2043. [ISC_PLATFORM_NEEDSTRLCPY="#undef ISC_PLATFORM_NEEDSTRLCPY"],
  2044. [ISC_PLATFORM_NEEDSTRLCPY="#define ISC_PLATFORM_NEEDSTRLCPY 1"])
  2045. AC_SUBST(ISC_PLATFORM_NEEDSTRLCPY)
  2046. AC_CHECK_FUNC(strlcat,
  2047. [ISC_PLATFORM_NEEDSTRLCAT="#undef ISC_PLATFORM_NEEDSTRLCAT"],
  2048. [ISC_PLATFORM_NEEDSTRLCAT="#define ISC_PLATFORM_NEEDSTRLCAT 1"])
  2049. AC_SUBST(ISC_PLATFORM_NEEDSTRLCAT)
  2050. ISC_PRINT_OBJS=
  2051. ISC_PRINT_SRCS=
  2052. AC_MSG_CHECKING(sprintf)
  2053. AC_TRY_COMPILE([
  2054. #include <stdio.h>
  2055. ],
  2056. [ char buf[2]; return(*sprintf(buf,"x"));],
  2057. [
  2058. ISC_PRINT_OBJS="print.$O"
  2059. ISC_PRINT_SRCS="print.c"
  2060. ISC_PLATFORM_NEEDSPRINTF="#define ISC_PLATFORM_NEEDSPRINTF"
  2061. LWRES_PLATFORM_NEEDSPRINTF="#define LWRES_PLATFORM_NEEDSPRINTF"
  2062. ],
  2063. [ISC_PLATFORM_NEEDSPRINTF="#undef ISC_PLATFORM_NEEDSPRINTF"
  2064. LWRES_PLATFORM_NEEDSPRINTF="#undef LWRES_PLATFORM_NEEDSPRINTF"]
  2065. )
  2066. AC_SUBST(ISC_PLATFORM_NEEDSPRINTF)
  2067. AC_SUBST(LWRES_PLATFORM_NEEDSPRINTF)
  2068. AC_CHECK_FUNC(vsnprintf,
  2069. [ISC_PLATFORM_NEEDVSNPRINTF="#undef ISC_PLATFORM_NEEDVSNPRINTF"
  2070. LWRES_PLATFORM_NEEDVSNPRINTF="#undef LWRES_PLATFORM_NEEDVSNPRINTF"],
  2071. [ISC_PRINT_OBJS="print.$O"
  2072. ISC_PRINT_SRCS="print.c"
  2073. ISC_PLATFORM_NEEDVSNPRINTF="#define ISC_PLATFORM_NEEDVSNPRINTF 1"
  2074. LWRES_PLATFORM_NEEDVSNPRINTF="#define LWRES_PLATFORM_NEEDVSNPRINTF 1"])
  2075. AC_SUBST(ISC_PLATFORM_NEEDVSNPRINTF)
  2076. AC_SUBST(LWRES_PLATFORM_NEEDVSNPRINTF)
  2077. ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS $ISC_PRINT_OBJS"
  2078. ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS $ISC_PRINT_SRCS"
  2079. AC_CHECK_FUNC(strerror, AC_DEFINE(HAVE_STRERROR))
  2080. AC_SUBST(ISC_EXTRA_OBJS)
  2081. AC_SUBST(ISC_EXTRA_SRCS)
  2082. #
  2083. # Use our own SPNEGO implementation?
  2084. #
  2085. AC_ARG_ENABLE(isc-spnego,
  2086. [ --disable-isc-spnego use SPNEGO from GSSAPI library])
  2087. if test -n "$USE_GSSAPI"
  2088. then
  2089. case "$enable_isc_spnego" in
  2090. yes|'')
  2091. USE_ISC_SPNEGO='-DUSE_ISC_SPNEGO'
  2092. DST_EXTRA_OBJS="$DST_EXTRA_OBJS spnego.$O"
  2093. DST_EXTRA_SRCS="$DST_EXTRA_SRCS spnego.c"
  2094. AC_MSG_RESULT(using SPNEGO from lib/dns)
  2095. ;;
  2096. no)
  2097. AC_MSG_RESULT(using SPNEGO from GSSAPI library)
  2098. ;;
  2099. esac
  2100. fi
  2101. AC_SUBST(USE_ISC_SPNEGO)
  2102. AC_SUBST(DST_EXTRA_OBJS)
  2103. AC_SUBST(DST_EXTRA_SRCS)
  2104. # Determine the printf format characters to use when printing
  2105. # values of type isc_int64_t. This will normally be "ll", but where
  2106. # the compiler treats "long long" as a alias for "long" and printf
  2107. # doesn't know about "long long" use "l". Hopefully the sprintf
  2108. # will produce a inconsistent result in the later case. If the compiler
  2109. # fails due to seeing "%lld" we fall back to "l".
  2110. #
  2111. # Digital Unix 4.0 (gcc?) (long long) is 64 bits as is its long. It uses
  2112. # %ld even for (long long)/
  2113. #
  2114. # Win32 uses "%I64d", but that's defined elsewhere since we don't use
  2115. # configure on Win32.
  2116. #
  2117. AC_MSG_CHECKING(printf format modifier for 64-bit integers)
  2118. AC_TRY_RUN([
  2119. #include <stdio.h>
  2120. main() {
  2121. long long int j = 0;
  2122. char buf[100];
  2123. buf[0] = 0;
  2124. sprintf(buf, "%lld", j);
  2125. exit((sizeof(long long int) != sizeof(long int))? 0 :
  2126. (strcmp(buf, "0") != 0));
  2127. }
  2128. ],
  2129. [AC_MSG_RESULT(ll)
  2130. ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'
  2131. LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "ll"'],
  2132. [AC_MSG_RESULT(l)
  2133. ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "l"'
  2134. LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "l"'],
  2135. [AC_MSG_RESULT(assuming target platform uses ll)
  2136. ISC_PLATFORM_QUADFORMAT='#define ISC_PLATFORM_QUADFORMAT "ll"'
  2137. LWRES_PLATFORM_QUADFORMAT='#define LWRES_PLATFORM_QUADFORMAT "ll"'])
  2138. AC_SUBST(ISC_PLATFORM_QUADFORMAT)
  2139. AC_SUBST(LWRES_PLATFORM_QUADFORMAT)
  2140. #
  2141. # Security Stuff
  2142. #
  2143. # Note it is very recommended to *not* disable chroot(),
  2144. # this is only because chroot() was made obsolete by Posix.
  2145. AC_ARG_ENABLE(chroot,
  2146. [ --disable-chroot disable chroot])
  2147. case "$enable_chroot" in
  2148. yes|'')
  2149. AC_CHECK_FUNCS(chroot)
  2150. ;;
  2151. no)
  2152. ;;
  2153. esac
  2154. AC_ARG_ENABLE(linux-caps,
  2155. [ --disable-linux-caps disable linux capabilities])
  2156. case "$enable_linux_caps" in
  2157. yes|'')
  2158. AC_CHECK_HEADERS(linux/capability.h sys/capability.h)
  2159. AC_CHECK_LIB(cap, cap_set_proc)
  2160. ;;
  2161. no)
  2162. ;;
  2163. esac
  2164. AC_CHECK_HEADERS(sys/prctl.h)
  2165. AC_CHECK_HEADERS(sys/un.h,
  2166. ISC_PLATFORM_HAVESYSUNH="#define ISC_PLATFORM_HAVESYSUNH 1"
  2167. ,
  2168. ISC_PLATFORM_HAVESYSUNH="#undef ISC_PLATFORM_HAVESYSUNH"
  2169. )
  2170. AC_SUBST(ISC_PLATFORM_HAVESYSUNH)
  2171. case "$host" in
  2172. *-solaris*)
  2173. AC_DEFINE(NEED_SECURE_DIRECTORY, 1,
  2174. [Define if connect does not honour the permission on the UNIX domain socket.])
  2175. ;;
  2176. *-sunos*)
  2177. AC_DEFINE(NEED_SECURE_DIRECTORY, 1,
  2178. [Define if connect does not honour the permission on the UNIX domain socket.])
  2179. ;;
  2180. esac
  2181. #
  2182. # Time Zone Stuff
  2183. #
  2184. AC_CHECK_FUNC(tzset, AC_DEFINE(HAVE_TZSET))
  2185. AC_MSG_CHECKING(for optarg declaration)
  2186. AC_TRY_COMPILE([
  2187. #include <unistd.h>
  2188. ],
  2189. [optarg = 0;],
  2190. [AC_MSG_RESULT(yes)],
  2191. [AC_MSG_RESULT(no)
  2192. GEN_NEED_OPTARG="-DNEED_OPTARG=1"
  2193. AC_DEFINE(NEED_OPTARG, 1, [Defined if extern char *optarg is not declared.])])
  2194. #
  2195. # BSD/OS, and perhaps some others, don't define rlim_t.
  2196. #
  2197. AC_MSG_CHECKING(for type rlim_t)
  2198. AC_TRY_COMPILE([
  2199. #include <sys/types.h>
  2200. #include <sys/time.h>
  2201. #include <sys/resource.h>],
  2202. [rlim_t rl = 19671212; return (0);],
  2203. [AC_MSG_RESULT(yes)
  2204. ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE rlim_t"],
  2205. [AC_MSG_RESULT(no)
  2206. AC_MSG_CHECKING(type of rlim_cur)
  2207. AC_TRY_RUN([
  2208. #include <sys/types.h>
  2209. #include <sys/time.h>
  2210. #include <sys/resource.h>
  2211. main() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(int)));}],
  2212. [AC_MSG_RESULT(int)
  2213. ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE int"],
  2214. [
  2215. AC_TRY_RUN([
  2216. #include <sys/types.h>
  2217. #include <sys/time.h>
  2218. #include <sys/resource.h>
  2219. main() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(long int)));}],
  2220. [AC_MSG_RESULT(long int)
  2221. ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long int"],
  2222. [
  2223. AC_TRY_RUN([
  2224. #include <sys/types.h>
  2225. #include <sys/time.h>
  2226. #include <sys/resource.h>
  2227. main() { struct rlimit r; exit((!sizeof(r.rlim_cur) == sizeof(long long int)));}],
  2228. [AC_MSG_RESULT(long long int)
  2229. ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE long long int"],
  2230. [AC_MSG_ERROR([unable to determine sizeof rlim_cur])
  2231. ],[AC_MSG_ERROR(this cannot happen)])
  2232. ],[AC_MSG_ERROR(this cannot happen)])
  2233. ],[
  2234. AC_ARG_WITH(rlimtype, , rlimtype="$withval", rlimtype="long long int")
  2235. ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE $rlimtype"
  2236. AC_MSG_RESULT(cannot determine type of rlim_cur when cross compiling - assuming $rlimtype)])
  2237. ])
  2238. AC_SUBST(ISC_PLATFORM_RLIMITTYPE)
  2239. #
  2240. # Older HP-UX doesn't have gettune
  2241. #
  2242. case "$host" in
  2243. *-hp-hpux*)
  2244. AC_CHECK_HEADERS(sys/dyntune.h)
  2245. ;;
  2246. *)
  2247. ;;
  2248. esac
  2249. #
  2250. # Compaq TruCluster requires more code for handling cluster IP aliases
  2251. #
  2252. case "$host" in
  2253. *-dec-osf*)
  2254. AC_CHECK_LIB(clua, clua_getaliasaddress, LIBS="-lclua $LIBS")
  2255. AC_CHECK_FUNC(clua_getaliasaddress,
  2256. AC_DEFINE(HAVE_TRUCLUSTER, 1,
  2257. [Define if running under Compaq TruCluster]))
  2258. ;;
  2259. *)
  2260. ;;
  2261. esac
  2262. #
  2263. # Some hosts need msg_namelen to match the size of the socket structure.
  2264. # Some hosts don't set msg_namelen appropriately on return from recvmsg().
  2265. #
  2266. case $host in
  2267. *os2*|*hp-mpeix*)
  2268. AC_DEFINE(BROKEN_RECVMSG, 1,
  2269. [Define if recvmsg() does not meet all of the BSD socket API specifications.])
  2270. ;;
  2271. esac
  2272. #
  2273. # Microsoft has their own way of handling shared libraries that requires
  2274. # additional qualifiers on extern variables. Unix systems don't need it.
  2275. #
  2276. AC_SUBST(ISC_PLATFORM_USEDECLSPEC)
  2277. ISC_PLATFORM_USEDECLSPEC="#undef ISC_PLATFORM_USEDECLSPEC"
  2278. AC_SUBST(LWRES_PLATFORM_USEDECLSPEC)
  2279. LWRES_PLATFORM_USEDECLSPEC="#undef LWRES_PLATFORM_USEDECLSPEC"
  2280. AC_SUBST(IRS_PLATFORM_USEDECLSPEC)
  2281. IRS_PLATFORM_USEDECLSPEC="#undef IRS_PLATFORM_USEDECLSPEC"
  2282. #
  2283. # Random remaining OS-specific issues involving compiler warnings.
  2284. # XXXDCL print messages to indicate some compensation is being done?
  2285. #
  2286. AC_SUBST(ISC_PLATFORM_BRACEPTHREADONCEINIT)
  2287. ISC_PLATFORM_BRACEPTHREADONCEINIT="#undef ISC_PLATFORM_BRACEPTHREADONCEINIT"
  2288. case "$host" in
  2289. *-aix5.[[123]].*)
  2290. hack_shutup_pthreadonceinit=yes
  2291. ;;
  2292. *-bsdi3.1*)
  2293. hack_shutup_sputaux=yes
  2294. ;;
  2295. *-bsdi4.0*)
  2296. hack_shutup_sigwait=yes
  2297. hack_shutup_sputaux=yes
  2298. ;;
  2299. [*-bsdi4.[12]*])
  2300. hack_shutup_stdargcast=yes
  2301. ;;
  2302. [*-solaris2.[89]])
  2303. hack_shutup_pthreadonceinit=yes
  2304. ;;
  2305. *-solaris2.1[[0-9]])
  2306. AC_TRY_COMPILE([ #include <pthread.h> ], [ static pthread_once_t once_test = { PTHREAD_ONCE_INIT }; ], [hack_shutup_pthreadonceinit=yes], )
  2307. ;;
  2308. esac
  2309. case "$hack_shutup_pthreadonceinit" in
  2310. yes)
  2311. #
  2312. # Shut up PTHREAD_ONCE_INIT unbraced initializer warnings.
  2313. #
  2314. ISC_PLATFORM_BRACEPTHREADONCEINIT="#define ISC_PLATFORM_BRACEPTHREADONCEINIT 1"
  2315. ;;
  2316. esac
  2317. case "$hack_shutup_sigwait" in
  2318. yes)
  2319. #
  2320. # Shut up a -Wmissing-prototypes warning for sigwait().
  2321. #
  2322. AC_DEFINE(SHUTUP_SIGWAIT)
  2323. ;;
  2324. esac
  2325. case "$hack_shutup_sputaux" in
  2326. yes)
  2327. #
  2328. # Shut up a -Wmissing-prototypes warning from <stdio.h>.
  2329. #
  2330. AC_DEFINE(SHUTUP_SPUTAUX)
  2331. ;;
  2332. esac
  2333. case "$hack_shutup_stdargcast" in
  2334. yes)
  2335. #
  2336. # Shut up a -Wcast-qual warning from va_start().
  2337. #
  2338. AC_DEFINE(SHUTUP_STDARG_CAST)
  2339. ;;
  2340. esac
  2341. AC_CHECK_HEADERS(strings.h,
  2342. ISC_PLATFORM_HAVESTRINGSH="#define ISC_PLATFORM_HAVESTRINGSH 1"
  2343. ,
  2344. ISC_PLATFORM_HAVESTRINGSH="#undef ISC_PLATFORM_HAVESTRINGSH"
  2345. )
  2346. AC_SUBST(ISC_PLATFORM_HAVESTRINGSH)
  2347. #
  2348. # Check for if_nametoindex() for IPv6 scoped addresses support
  2349. #
  2350. AC_CHECK_FUNC(if_nametoindex, ac_cv_have_if_nametoindex=yes,
  2351. ac_cv_have_if_nametoindex=no)
  2352. case $ac_cv_have_if_nametoindex in
  2353. no)
  2354. case "$host" in
  2355. *-hp-hpux*)
  2356. AC_CHECK_LIB(ipv6, if_nametoindex,
  2357. ac_cv_have_if_nametoindex=yes
  2358. LIBS="-lipv6 $LIBS",)
  2359. ;;
  2360. esac
  2361. esac
  2362. case $ac_cv_have_if_nametoindex in
  2363. yes)
  2364. ISC_PLATFORM_HAVEIFNAMETOINDEX="#define ISC_PLATFORM_HAVEIFNAMETOINDEX 1"
  2365. ;;
  2366. *)
  2367. ISC_PLATFORM_HAVEIFNAMETOINDEX="#undef ISC_PLATFORM_HAVEIFNAMETOINDEX"
  2368. ;;
  2369. esac
  2370. AC_SUBST(ISC_PLATFORM_HAVEIFNAMETOINDEX)
  2371. AC_CHECK_FUNCS(nanosleep)
  2372. #
  2373. # Machine architecture dependent features
  2374. #
  2375. AC_ARG_ENABLE(atomic,
  2376. [ --enable-atomic enable machine specific atomic operations
  2377. [[default=autodetect]]],
  2378. enable_atomic="$enableval",
  2379. enable_atomic="autodetect")
  2380. case "$enable_atomic" in
  2381. yes|''|autodetect)
  2382. case "$host" in
  2383. powerpc-ibm-aix*)
  2384. if test "X$GCC" = "Xyes"; then
  2385. AC_MSG_CHECKING([if asm("isc"); works])
  2386. AC_TRY_COMPILE(,[
  2387. main() { asm("ics"); exit(0); }
  2388. ],
  2389. [AC_MSG_RESULT(yes)
  2390. use_atomic=yes],
  2391. [
  2392. saved_cflags="$CFLAGS"
  2393. CFLAGS="$CFLAGS -Wa,-many"
  2394. AC_TRY_RUN([
  2395. main() { asm("ics"); exit(0); }
  2396. ],
  2397. [AC_MSG_RESULT([yes, required -Wa,-many])
  2398. use_atomic=yes],
  2399. [AC_MSG_RESULT([no, use_atomic disabled])
  2400. CFLAGS="$saved_cflags"
  2401. use_atomic=no],
  2402. [AC_MSG_RESULT([cross compile, assume yes])
  2403. CFLAGS="$saved_cflags"
  2404. use_atomic=yes])
  2405. ]
  2406. )
  2407. else
  2408. use_atomic=yes
  2409. fi
  2410. ;;
  2411. *)
  2412. use_atomic=yes
  2413. ;;
  2414. esac
  2415. ;;
  2416. no)
  2417. use_atomic=no
  2418. arch=noatomic
  2419. ;;
  2420. esac
  2421. ISC_PLATFORM_USEOSFASM="#undef ISC_PLATFORM_USEOSFASM"
  2422. if test "$use_atomic" = "yes"; then
  2423. AC_MSG_CHECKING([architecture type for atomic operations])
  2424. have_atomic=yes # set default
  2425. case "$host" in
  2426. [i[3456]86-*])
  2427. # XXX: some old x86 architectures actually do not support
  2428. # (some of) these operations. Do we need stricter checks?
  2429. AC_CHECK_SIZEOF([void *])
  2430. if test $ac_cv_sizeof_void_p = 8; then
  2431. arch=x86_64
  2432. have_xaddq=yes
  2433. else
  2434. arch=x86_32
  2435. fi
  2436. ;;
  2437. x86_64-*|amd64-*)
  2438. AC_CHECK_SIZEOF([void *])
  2439. if test $ac_cv_sizeof_void_p = 8; then
  2440. arch=x86_64
  2441. have_xaddq=yes
  2442. else
  2443. arch=x86_32
  2444. fi
  2445. ;;
  2446. alpha*-*)
  2447. arch=alpha
  2448. ;;
  2449. powerpc-*|powerpc64-*)
  2450. arch=powerpc
  2451. ;;
  2452. mips-*|mipsel-*|mips64-*|mips64el-*)
  2453. arch=mips
  2454. ;;
  2455. ia64-*)
  2456. arch=ia64
  2457. ;;
  2458. *)
  2459. have_atomic=no
  2460. arch=noatomic
  2461. ;;
  2462. esac
  2463. AC_MSG_RESULT($arch)
  2464. fi
  2465. if test "$have_atomic" = "yes"; then
  2466. AC_MSG_CHECKING([compiler support for inline assembly code])
  2467. compiler=generic
  2468. # Check whether the compiler supports the assembly syntax we provide.
  2469. if test "X$GCC" = "Xyes"; then
  2470. # GCC's ASM extension always works
  2471. compiler=gcc
  2472. if test $arch = "x86_64"; then
  2473. # We can share the same code for gcc with x86_32
  2474. arch=x86_32
  2475. fi
  2476. if test $arch = "powerpc"; then
  2477. #
  2478. # The MacOS (and maybe others) uses "r0" for register
  2479. # zero. Under linux/ibm it is "0" for register 0.
  2480. # Probe to see if we have a MacOS style assembler.
  2481. #
  2482. AC_MSG_CHECKING([Checking for MacOS style assembler syntax])
  2483. AC_TRY_COMPILE(, [
  2484. __asm__ volatile ("li r0, 0x0\n"::);
  2485. ], [
  2486. AC_MSG_RESULT(yes)
  2487. compiler="mac"
  2488. ISC_PLATFORM_USEMACASM="#define ISC_PLATFORM_USEMACASM 1"
  2489. ], [AC_MSG_RESULT(no)])
  2490. fi
  2491. else
  2492. case "$host" in
  2493. alpha*-dec-osf*)
  2494. # Tru64 compiler has its own syntax for inline
  2495. # assembly.
  2496. AC_TRY_COMPILE(, [
  2497. #ifndef __DECC
  2498. #error "unexpected compiler"
  2499. #endif
  2500. return (0);],
  2501. [compiler=osf],)
  2502. ;;
  2503. powerpc-ibm-aix*)
  2504. compiler=aix
  2505. ;;
  2506. esac
  2507. fi
  2508. case "$compiler" in
  2509. gcc)
  2510. ISC_PLATFORM_USEGCCASM="#define ISC_PLATFORM_USEGCCASM 1"
  2511. ;;
  2512. osf)
  2513. ISC_PLATFORM_USEOSFASM="#define ISC_PLATFORM_USEOSFASM 1"
  2514. ;;
  2515. aix)
  2516. ;;
  2517. mac)
  2518. ;;
  2519. *)
  2520. # See if the generic __asm function works. If not,
  2521. # we need to disable the atomic operations.
  2522. AC_TRY_LINK(, [
  2523. __asm("nop")
  2524. ],
  2525. [compiler="standard"
  2526. ISC_PLATFORM_USESTDASM="#define ISC_PLATFORM_USESTDASM 1"],
  2527. [compiler="not supported (atomic operations disabled)"
  2528. have_atomic=no
  2529. arch=noatomic ]);
  2530. ;;
  2531. esac
  2532. AC_MSG_RESULT($compiler)
  2533. fi
  2534. if test "$have_atomic" = "yes"; then
  2535. ISC_PLATFORM_HAVEXADD="#define ISC_PLATFORM_HAVEXADD 1"
  2536. ISC_PLATFORM_HAVECMPXCHG="#define ISC_PLATFORM_HAVECMPXCHG 1"
  2537. ISC_PLATFORM_HAVEATOMICSTORE="#define ISC_PLATFORM_HAVEATOMICSTORE 1"
  2538. else
  2539. ISC_PLATFORM_HAVEXADD="#undef ISC_PLATFORM_HAVEXADD"
  2540. ISC_PLATFORM_HAVECMPXCHG="#undef ISC_PLATFORM_HAVECMPXCHG"
  2541. ISC_PLATFORM_HAVEATOMICSTORE="#undef ISC_PLATFORM_HAVEATOMICSTORE"
  2542. fi
  2543. if test "$have_xaddq" = "yes"; then
  2544. ISC_PLATFORM_HAVEXADDQ="#define ISC_PLATFORM_HAVEXADDQ 1"
  2545. else
  2546. ISC_PLATFORM_HAVEXADDQ="#undef ISC_PLATFORM_HAVEXADDQ"
  2547. fi
  2548. AC_SUBST(ISC_PLATFORM_HAVEXADD)
  2549. AC_SUBST(ISC_PLATFORM_HAVEXADDQ)
  2550. AC_SUBST(ISC_PLATFORM_HAVECMPXCHG)
  2551. AC_SUBST(ISC_PLATFORM_HAVEATOMICSTORE)
  2552. AC_SUBST(ISC_PLATFORM_USEGCCASM)
  2553. AC_SUBST(ISC_PLATFORM_USEOSFASM)
  2554. AC_SUBST(ISC_PLATFORM_USESTDASM)
  2555. AC_SUBST(ISC_PLATFORM_USEMACASM)
  2556. ISC_ARCH_DIR=$arch
  2557. AC_SUBST(ISC_ARCH_DIR)
  2558. #
  2559. # Activate "rrset-order fixed" or not?
  2560. #
  2561. AC_ARG_ENABLE(fixed-rrset,
  2562. [ --enable-fixed-rrset enable fixed rrset ordering
  2563. [[default=no]]],
  2564. enable_fixed="$enableval",
  2565. enable_fixed="no")
  2566. case "$enable_fixed" in
  2567. yes)
  2568. AC_DEFINE(DNS_RDATASET_FIXED, 1,
  2569. [Define to enable "rrset-order fixed" syntax.])
  2570. ;;
  2571. no)
  2572. ;;
  2573. *)
  2574. ;;
  2575. esac
  2576. #
  2577. # Enable response policy rewriting using NS IP addresses
  2578. #
  2579. AC_ARG_ENABLE(rpz-nsip,
  2580. [ --enable-rpz-nsip enable rpz-nsip rules [[default=no]]],
  2581. enable_nsip="$enableval",
  2582. enable_nsip="no")
  2583. case "$enable_nsip" in
  2584. yes)
  2585. AC_DEFINE(ENABLE_RPZ_NSIP, 1,
  2586. [Define to enable rpz-nsip rules.])
  2587. ;;
  2588. no)
  2589. ;;
  2590. *)
  2591. ;;
  2592. esac
  2593. #
  2594. # Enable response policy rewriting using NS name
  2595. #
  2596. AC_ARG_ENABLE(rpz-nsdname,
  2597. [ --enable-rpz-nsdname enable rpz-nsdname rules [[default=no]]],
  2598. enable_nsdname="$enableval",
  2599. enable_nsdname="no")
  2600. case "$enable_nsdname" in
  2601. yes)
  2602. AC_DEFINE(ENABLE_RPZ_NSDNAME, 1,
  2603. [Define to enable rpz-nsdname rules.])
  2604. ;;
  2605. no)
  2606. ;;
  2607. *)
  2608. ;;
  2609. esac
  2610. #
  2611. # Activate "filter-aaaa-on-v4" or not?
  2612. #
  2613. AC_ARG_ENABLE(filter-aaaa,
  2614. [ --enable-filter-aaaa enable filtering of AAAA records over IPv4
  2615. [[default=no]]],
  2616. enable_filter="$enableval",
  2617. enable_filter="no")
  2618. case "$enable_filter" in
  2619. yes)
  2620. AC_DEFINE(ALLOW_FILTER_AAAA_ON_V4, 1,
  2621. [Define to enable the "filter-aaaa-on-v4" option.])
  2622. ;;
  2623. no)
  2624. ;;
  2625. *)
  2626. ;;
  2627. esac
  2628. #
  2629. # The following sets up how non-blocking i/o is established.
  2630. # Sunos, cygwin and solaris 2.x (x<5) require special handling.
  2631. #
  2632. case "$host" in
  2633. *-sunos*) AC_DEFINE(PORT_NONBLOCK, O_NDELAY);;
  2634. *-cygwin*) AC_DEFINE(PORT_NONBLOCK, O_NDELAY);;
  2635. *-solaris2.[[01234]])
  2636. AC_DEFINE(PORT_NONBLOCK, O_NONBLOCK)
  2637. AC_DEFINE(USE_FIONBIO_IOCTL, 1,
  2638. [Defined if you need to use ioctl(FIONBIO) instead a fcntl call to make non-blocking.])
  2639. ;;
  2640. *) AC_DEFINE(PORT_NONBLOCK, O_NONBLOCK,
  2641. [Sets which flag to pass to open/fcntl to make non-blocking (O_NDELAY/O_NONBLOCK).])
  2642. ;;
  2643. esac
  2644. #
  2645. # Solaris 2.5.1 and earlier cannot bind() then connect() a TCP socket.
  2646. # This prevents the source address being set.
  2647. #
  2648. case "$host" in
  2649. *-solaris2.[[012345]]|*-solaris2.5.1)
  2650. AC_DEFINE(BROKEN_TCP_BIND_BEFORE_CONNECT, 1,
  2651. [Define if you cannot bind() before connect() for TCP sockets.])
  2652. ;;
  2653. esac
  2654. #
  2655. # The following sections deal with tools used for formatting
  2656. # the documentation. They are all optional, unless you are
  2657. # a developer editing the documentation source.
  2658. #
  2659. #
  2660. # Look for TeX.
  2661. #
  2662. AC_PATH_PROGS(LATEX, latex, latex)
  2663. AC_SUBST(LATEX)
  2664. AC_PATH_PROGS(PDFLATEX, pdflatex, pdflatex)
  2665. AC_SUBST(PDFLATEX)
  2666. #
  2667. # Look for w3m
  2668. #
  2669. AC_PATH_PROGS(W3M, w3m, w3m)
  2670. AC_SUBST(W3M)
  2671. #
  2672. # Look for xsltproc (libxslt)
  2673. #
  2674. AC_PATH_PROG(XSLTPROC, xsltproc, xsltproc)
  2675. AC_SUBST(XSLTPROC)
  2676. #
  2677. # Look for xmllint (libxml2)
  2678. #
  2679. AC_PATH_PROG(XMLLINT, xmllint, xmllint)
  2680. AC_SUBST(XMLLINT)
  2681. #
  2682. # Look for Doxygen
  2683. #
  2684. AC_PATH_PROG(DOXYGEN, doxygen, doxygen)
  2685. AC_SUBST(DOXYGEN)
  2686. #
  2687. # Subroutine for searching for an ordinary file (e.g., a stylesheet)
  2688. # in a number of directories:
  2689. #
  2690. # NOM_PATH_FILE(VARIABLE, FILENAME, DIRECTORIES)
  2691. #
  2692. # If the file FILENAME is found in one of the DIRECTORIES, the shell
  2693. # variable VARIABLE is defined to its absolute pathname. Otherwise,
  2694. # it is set to FILENAME, with no directory prefix (that's not terribly
  2695. # useful, but looks less confusing in substitutions than leaving it
  2696. # empty). The variable VARIABLE will be substituted into output files.
  2697. #
  2698. AC_DEFUN(NOM_PATH_FILE, [
  2699. $1=""
  2700. AC_MSG_CHECKING(for $2)
  2701. for d in $3
  2702. do
  2703. f=$d/$2
  2704. if test -f $f
  2705. then
  2706. $1=$f
  2707. AC_MSG_RESULT($f)
  2708. break
  2709. fi
  2710. done
  2711. if test "X[$]$1" = "X"
  2712. then
  2713. AC_MSG_RESULT("not found");
  2714. $1=$2
  2715. fi
  2716. AC_SUBST($1)
  2717. ])
  2718. #
  2719. # Look for Docbook-XSL stylesheets. Location probably varies by system.
  2720. # If it's not explicitly specified, guess where it might be found, based on
  2721. # where SGML stuff lives on some systems (FreeBSD is the only one we're sure
  2722. # of at the moment).
  2723. #
  2724. AC_MSG_CHECKING(for Docbook-XSL path)
  2725. AC_ARG_WITH(docbook-xsl,
  2726. [ --with-docbook-xsl=PATH Specify path for Docbook-XSL stylesheets],
  2727. docbook_path="$withval", docbook_path="auto")
  2728. case "$docbook_path" in
  2729. auto)
  2730. AC_MSG_RESULT(auto)
  2731. docbook_xsl_trees="/usr/pkg/share/xsl/docbook /usr/local/share/xsl/docbook /usr/share/xsl/docbook"
  2732. ;;
  2733. *)
  2734. docbook_xsl_trees="$withval"
  2735. AC_MSG_RESULT($docbook_xsl_trees)
  2736. ;;
  2737. esac
  2738. #
  2739. # Look for stylesheets we need.
  2740. #
  2741. NOM_PATH_FILE(XSLT_DOCBOOK_STYLE_HTML, html/docbook.xsl, $docbook_xsl_trees)
  2742. NOM_PATH_FILE(XSLT_DOCBOOK_STYLE_XHTML, xhtml/docbook.xsl, $docbook_xsl_trees)
  2743. NOM_PATH_FILE(XSLT_DOCBOOK_STYLE_MAN, manpages/docbook.xsl, $docbook_xsl_trees)
  2744. NOM_PATH_FILE(XSLT_DOCBOOK_CHUNK_HTML, html/chunk.xsl, $docbook_xsl_trees)
  2745. NOM_PATH_FILE(XSLT_DOCBOOK_CHUNK_XHTML, xhtml/chunk.xsl, $docbook_xsl_trees)
  2746. NOM_PATH_FILE(XSLT_DOCBOOK_CHUNKTOC_HTML, html/chunktoc.xsl, $docbook_xsl_trees)
  2747. NOM_PATH_FILE(XSLT_DOCBOOK_CHUNKTOC_XHTML, xhtml/chunktoc.xsl, $docbook_xsl_trees)
  2748. NOM_PATH_FILE(XSLT_DOCBOOK_MAKETOC_HTML, html/maketoc.xsl, $docbook_xsl_trees)
  2749. NOM_PATH_FILE(XSLT_DOCBOOK_MAKETOC_XHTML, xhtml/maketoc.xsl, $docbook_xsl_trees)
  2750. #
  2751. # Same dance for db2latex
  2752. #
  2753. # No idea where this lives except on FreeBSD.
  2754. #
  2755. db2latex_xsl_trees="/usr/local/share"
  2756. #
  2757. # Look for stylesheets we need.
  2758. #
  2759. NOM_PATH_FILE(XSLT_DB2LATEX_STYLE, db2latex/xsl/docbook.xsl, $db2latex_xsl_trees)
  2760. #
  2761. # Look for "admonition" image directory. Can't use NOM_PATH_FILE()
  2762. # because it's a directory, so just do the same things, inline.
  2763. #
  2764. AC_MSG_CHECKING(for db2latex/xsl/figures)
  2765. for d in $db2latex_xsl_trees
  2766. do
  2767. dd=$d/db2latex/xsl/figures
  2768. if test -d $dd
  2769. then
  2770. XSLT_DB2LATEX_ADMONITIONS=$dd
  2771. AC_MSG_RESULT($dd)
  2772. break
  2773. fi
  2774. done
  2775. if test "X$XSLT_DB2LATEX_ADMONITIONS" = "X"
  2776. then
  2777. AC_MSG_RESULT(not found)
  2778. XSLT_DB2LATEX_ADMONITIONS=db2latex/xsl/figures
  2779. fi
  2780. AC_SUBST(XSLT_DB2LATEX_ADMONITIONS)
  2781. #
  2782. # IDN support
  2783. #
  2784. AC_ARG_WITH(idn,
  2785. [ --with-idn[=MPREFIX] enable IDN support using idnkit [default PREFIX]],
  2786. use_idn="$withval", use_idn="no")
  2787. case "$use_idn" in
  2788. yes)
  2789. if test X$prefix = XNONE ; then
  2790. idn_path=/usr/local
  2791. else
  2792. idn_path=$prefix
  2793. fi
  2794. ;;
  2795. no)
  2796. ;;
  2797. *)
  2798. idn_path="$use_idn"
  2799. ;;
  2800. esac
  2801. iconvinc=
  2802. iconvlib=
  2803. AC_ARG_WITH(libiconv,
  2804. [ --with-libiconv[=IPREFIX] GNU libiconv are in IPREFIX [default PREFIX]],
  2805. use_libiconv="$withval", use_libiconv="no")
  2806. case "$use_libiconv" in
  2807. yes)
  2808. if test X$prefix = XNONE ; then
  2809. iconvlib="-L/usr/local/lib -R/usr/local/lib -liconv"
  2810. else
  2811. iconvlib="-L$prefix/lib -R$prefix/lib -liconv"
  2812. fi
  2813. ;;
  2814. no)
  2815. iconvlib=
  2816. ;;
  2817. *)
  2818. iconvlib="-L$use_libiconv/lib -R$use_libiconv/lib -liconv"
  2819. ;;
  2820. esac
  2821. AC_ARG_WITH(iconv,
  2822. [ --with-iconv[=LIBSPEC] specify iconv library [default -liconv]],
  2823. iconvlib="$withval")
  2824. case "$iconvlib" in
  2825. no)
  2826. iconvlib=
  2827. ;;
  2828. yes)
  2829. iconvlib=-liconv
  2830. ;;
  2831. esac
  2832. AC_ARG_WITH(idnlib,
  2833. [ --with-idnlib=ARG specify libidnkit],
  2834. idnlib="$withval", idnlib="no")
  2835. if test "$idnlib" = yes; then
  2836. AC_MSG_ERROR([You must specify ARG for --with-idnlib.])
  2837. fi
  2838. IDNLIBS=
  2839. if test "$use_idn" != no; then
  2840. AC_DEFINE(WITH_IDN, 1, [define if idnkit support is to be included.])
  2841. STD_CINCLUDES="$STD_CINCLUDES -I$idn_path/include"
  2842. if test "$idnlib" != no; then
  2843. IDNLIBS="$idnlib $iconvlib"
  2844. else
  2845. IDNLIBS="-L$idn_path/lib -lidnkit $iconvlib"
  2846. fi
  2847. fi
  2848. AC_SUBST(IDNLIBS)
  2849. #
  2850. # Check whether to build Automated Test Framework unit tests
  2851. #
  2852. AC_ARG_WITH(atf,
  2853. [ --with-atf=ARG Automated Test Framework support],
  2854. atf="$withval", atf="no")
  2855. if test "$atf" = yes; then
  2856. atf=`pwd`/unit/atf
  2857. ATFBUILD=atf-src
  2858. AC_SUBST(ATFBUILD)
  2859. AC_CONFIG_COMMANDS([atf-config],
  2860. [cd unit/atf-src; ${SHELL} ./configure MISSING=: --prefix $atfdir; cd ../..],
  2861. [atfdir=`pwd`/unit/atf])
  2862. AC_MSG_RESULT(building ATF from bind9/unit/atf-src)
  2863. fi
  2864. ATFLIBS=
  2865. if test "$atf" != no; then
  2866. AC_DEFINE(ATF_TEST, 1, [define if ATF unit tests are to be built.])
  2867. STD_CINCLUDES="$STD_CINCLUDES -I$atf/include"
  2868. ATFBIN="$atf/bin"
  2869. ATFLIBS="-L$atf/lib -latf-c"
  2870. UNITTESTS=tests
  2871. fi
  2872. AC_SUBST(ATFBIN)
  2873. AC_SUBST(ATFLIBS)
  2874. AC_SUBST(UNITTESTS)
  2875. AC_CHECK_HEADERS(locale.h)
  2876. AC_CHECK_FUNCS(setlocale)
  2877. #
  2878. # Substitutions
  2879. #
  2880. AC_SUBST(BIND9_TOP_BUILDDIR)
  2881. BIND9_TOP_BUILDDIR=`pwd`
  2882. AC_SUBST(BIND9_ISC_BUILDINCLUDE)
  2883. AC_SUBST(BIND9_ISCCC_BUILDINCLUDE)
  2884. AC_SUBST(BIND9_ISCCFG_BUILDINCLUDE)
  2885. AC_SUBST(BIND9_DNS_BUILDINCLUDE)
  2886. AC_SUBST(BIND9_LWRES_BUILDINCLUDE)
  2887. AC_SUBST(BIND9_BIND9_BUILDINCLUDE)
  2888. if test "X$srcdir" != "X"; then
  2889. BIND9_ISC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isc/include"
  2890. BIND9_ISCCC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isccc/include"
  2891. BIND9_ISCCFG_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isccfg/include"
  2892. BIND9_DNS_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/dns/include"
  2893. BIND9_LWRES_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/lwres/include"
  2894. BIND9_BIND9_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/bind9/include"
  2895. else
  2896. BIND9_ISC_BUILDINCLUDE=""
  2897. BIND9_ISCCC_BUILDINCLUDE=""
  2898. BIND9_ISCCFG_BUILDINCLUDE=""
  2899. BIND9_DNS_BUILDINCLUDE=""
  2900. BIND9_LWRES_BUILDINCLUDE=""
  2901. BIND9_BIND9_BUILDINCLUDE=""
  2902. fi
  2903. AC_SUBST_FILE(BIND9_MAKE_INCLUDES)
  2904. BIND9_MAKE_INCLUDES=$BIND9_TOP_BUILDDIR/make/includes
  2905. AC_SUBST_FILE(BIND9_MAKE_RULES)
  2906. BIND9_MAKE_RULES=$BIND9_TOP_BUILDDIR/make/rules
  2907. . $srcdir/version
  2908. BIND9_VERSION="VERSION=${MAJORVER}.${MINORVER}${PATCHVER:+.}${PATCHVER}${RELEASETYPE}${RELEASEVER}"
  2909. AC_SUBST(BIND9_VERSION)
  2910. if test -z "$ac_configure_args"; then
  2911. BIND9_CONFIGARGS="defaults"
  2912. else
  2913. for a in $ac_configure_args
  2914. do
  2915. BIND9_CONFIGARGS="$BIND9_CONFIGARGS $a"
  2916. done
  2917. fi
  2918. BIND9_CONFIGARGS="`echo $BIND9_CONFIGARGS | sed 's/^ //'`"
  2919. BIND9_CONFIGARGS="CONFIGARGS=${BIND9_CONFIGARGS}"
  2920. AC_SUBST(BIND9_CONFIGARGS)
  2921. AC_SUBST_FILE(LIBISC_API)
  2922. LIBISC_API=$srcdir/lib/isc/api
  2923. AC_SUBST_FILE(LIBISCCC_API)
  2924. LIBISCCC_API=$srcdir/lib/isccc/api
  2925. AC_SUBST_FILE(LIBISCCFG_API)
  2926. LIBISCCFG_API=$srcdir/lib/isccfg/api
  2927. AC_SUBST_FILE(LIBDNS_API)
  2928. LIBDNS_API=$srcdir/lib/dns/api
  2929. AC_SUBST_FILE(LIBBIND9_API)
  2930. LIBBIND9_API=$srcdir/lib/bind9/api
  2931. AC_SUBST_FILE(LIBLWRES_API)
  2932. LIBLWRES_API=$srcdir/lib/lwres/api
  2933. AC_SUBST_FILE(LIBIRS_API)
  2934. LIBIRS_API=$srcdir/lib/irs/api
  2935. #
  2936. # Configure any DLZ drivers.
  2937. #
  2938. # If config.dlz.in selects one or more DLZ drivers, it will set
  2939. # CONTRIB_DLZ to a non-empty value, which will be our clue to
  2940. # build DLZ drivers in contrib.
  2941. #
  2942. # This section has to come after the libtool stuff because it needs to
  2943. # know how to name the driver object files.
  2944. #
  2945. CONTRIB_DLZ=""
  2946. DLZ_DRIVER_INCLUDES=""
  2947. DLZ_DRIVER_LIBS=""
  2948. DLZ_DRIVER_SRCS=""
  2949. DLZ_DRIVER_OBJS=""
  2950. DLZ_SYSTEM_TEST=""
  2951. #
  2952. # Configure support for building a shared library object
  2953. #
  2954. # Even when libtool is available it can't always be relied upon
  2955. # to build an object that can be dlopen()'ed, but this is necessary
  2956. # for building the dlzexternal system test, so we'll try it the
  2957. # old-fashioned way.
  2958. #
  2959. SO="so"
  2960. SO_CFLAGS=""
  2961. SO_LD=""
  2962. SO_TARGETS=""
  2963. AC_ARG_WITH(dlopen,
  2964. [ --with-dlopen=ARG Support dynamically loadable DLZ drivers],
  2965. dlopen="$withval", dlopen="yes")
  2966. if test "$dlopen" = "yes"; then
  2967. AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
  2968. if test "$have_dl" = "yes"; then
  2969. LIBS="-ldl $LIBS"
  2970. fi
  2971. AC_CHECK_FUNCS(dlopen dlclose dlsym,,dlopen=no)
  2972. fi
  2973. if test "$dlopen" = "yes"; then
  2974. case $host in
  2975. *-linux*)
  2976. SO_CFLAGS="-fPIC"
  2977. if test "$have_dl" = "yes"
  2978. then
  2979. SO_LD="${CC} -shared"
  2980. else
  2981. SO_LD="ld -shared"
  2982. fi
  2983. ;;
  2984. *-freebsd*|*-openbsd*|*-netbsd*)
  2985. SO_CFLAGS="-fpic"
  2986. SO_LD="ld -Bshareable -x"
  2987. ;;
  2988. *-solaris*)
  2989. SO_CFLAGS="-KPIC"
  2990. SO_LD="ld -G -z text"
  2991. ;;
  2992. *-hp-hpux*)
  2993. SO=sl
  2994. SO_CFLAGS="+z"
  2995. SO_LD="ld -b"
  2996. ;;
  2997. *)
  2998. SO_CFLAGS="-fPIC"
  2999. ;;
  3000. esac
  3001. if test "X$GCC" = "Xyes"; then
  3002. SO_CFLAGS="-fPIC"
  3003. test -n "$SO_LD" || SO_LD="${CC} -shared"
  3004. fi
  3005. # If we still don't know how to make shared objects, don't make any.
  3006. if test -n "$SO_LD"; then
  3007. SO_TARGETS="\${SO_TARGETS}"
  3008. AC_DEFINE(ISC_DLZ_DLOPEN, 1,
  3009. [Define to allow building of objects for dlopen().])
  3010. fi
  3011. fi
  3012. AC_SUBST(SO)
  3013. AC_SUBST(SO_CFLAGS)
  3014. AC_SUBST(SO_LD)
  3015. AC_SUBST(SO_TARGETS)
  3016. sinclude(contrib/dlz/config.dlz.in)
  3017. AC_MSG_CHECKING(contributed DLZ drivers)
  3018. if test -n "$CONTRIB_DLZ"
  3019. then
  3020. AC_MSG_RESULT(yes)
  3021. DLZ_DRIVER_RULES=contrib/dlz/drivers/rules
  3022. AC_CONFIG_FILES([$DLZ_DRIVER_RULES])
  3023. else
  3024. AC_MSG_RESULT(no)
  3025. DLZ_DRIVER_RULES=/dev/null
  3026. fi
  3027. AC_SUBST(CONTRIB_DLZ)
  3028. AC_SUBST(DLZ_DRIVER_INCLUDES)
  3029. AC_SUBST(DLZ_DRIVER_LIBS)
  3030. AC_SUBST(DLZ_DRIVER_SRCS)
  3031. AC_SUBST(DLZ_DRIVER_OBJS)
  3032. AC_SUBST(DLZ_SYSTEM_TEST)
  3033. AC_SUBST_FILE(DLZ_DRIVER_RULES)
  3034. if test "$cross_compiling" = "yes"; then
  3035. if test -z "$BUILD_CC"; then
  3036. AC_ERROR([BUILD_CC not set])
  3037. fi
  3038. BUILD_CFLAGS="$BUILD_CFLAGS"
  3039. BUILD_CPPFLAGS="$BUILD_CPPFLAGS"
  3040. BUILD_LDFLAGS="$BUILD_LDFLAGS"
  3041. BUILD_LIBS="$BUILD_LIBS"
  3042. else
  3043. BUILD_CC="$CC"
  3044. BUILD_CFLAGS="$CFLAGS"
  3045. BUILD_CPPFLAGS="$CPPFLAGS $GEN_NEED_OPTARG"
  3046. BUILD_LDFLAGS="$LDFLAGS"
  3047. BUILD_LIBS="$LIBS"
  3048. fi
  3049. NEWFLAGS=""
  3050. for e in $BUILD_LDFLAGS ; do
  3051. case $e in
  3052. -L*)
  3053. case $host_os in
  3054. netbsd*)
  3055. ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
  3056. NEWFLAGS="$NEWFLAGS $e $ee"
  3057. ;;
  3058. freebsd*)
  3059. ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
  3060. NEWFLAGS="$NEWFLAGS $e $ee"
  3061. ;;
  3062. solaris*)
  3063. ee=`echo $e | sed -e 's%^-L%-R%'`
  3064. NEWFLAGS="$NEWFLAGS $e $ee"
  3065. ;;
  3066. *)
  3067. NEWFLAGS="$NEWFLAGS $e"
  3068. ;;
  3069. esac
  3070. ;;
  3071. *)
  3072. NEWFLAGS="$NEWFLAGS $e"
  3073. ;;
  3074. esac
  3075. done
  3076. BUILD_LDFLAGS="$NEWFLAGS"
  3077. NEWFLAGS=""
  3078. for e in $DNS_GSSAPI_LIBS ; do
  3079. case $e in
  3080. -L*)
  3081. case $host_os in
  3082. netbsd*)
  3083. ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
  3084. NEWFLAGS="$NEWFLAGS $e $ee"
  3085. ;;
  3086. freebsd*)
  3087. ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
  3088. NEWFLAGS="$NEWFLAGS $e $ee"
  3089. ;;
  3090. solaris*)
  3091. ee=`echo $e | sed -e 's%^-L%-R%'`
  3092. NEWFLAGS="$NEWFLAGS $e $ee"
  3093. ;;
  3094. *)
  3095. NEWFLAGS="$NEWFLAGS $e"
  3096. ;;
  3097. esac
  3098. ;;
  3099. *)
  3100. NEWFLAGS="$NEWFLAGS $e"
  3101. ;;
  3102. esac
  3103. done
  3104. DNS_GSSAPI_LIBS="$NEWFLAGS"
  3105. NEWFLAGS=""
  3106. for e in $DNS_CRYPTO_LIBS ; do
  3107. case $e in
  3108. -L*)
  3109. case $host_os in
  3110. netbsd*)
  3111. ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
  3112. NEWFLAGS="$NEWFLAGS $e $ee"
  3113. ;;
  3114. freebsd*)
  3115. ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'`
  3116. NEWFLAGS="$NEWFLAGS $e $ee"
  3117. ;;
  3118. solaris*)
  3119. ee=`echo $e | sed -e 's%^-L%-R%'`
  3120. NEWFLAGS="$NEWFLAGS $e $ee"
  3121. ;;
  3122. *)
  3123. NEWFLAGS="$NEWFLAGS $e"
  3124. ;;
  3125. esac
  3126. ;;
  3127. *)
  3128. NEWFLAGS="$NEWFLAGS $e"
  3129. ;;
  3130. esac
  3131. done
  3132. DNS_CRYPTO_LIBS="$NEWFLAGS"
  3133. AC_SUBST(BUILD_CC)
  3134. AC_SUBST(BUILD_CFLAGS)
  3135. AC_SUBST(BUILD_CPPFLAGS)
  3136. AC_SUBST(BUILD_LDFLAGS)
  3137. AC_SUBST(BUILD_LIBS)
  3138. #
  3139. # Commands to run at the end of config.status.
  3140. # Don't just put these into configure, it won't work right if somebody
  3141. # runs config.status directly (which autoconf allows).
  3142. #
  3143. AC_CONFIG_COMMANDS(
  3144. [chmod],
  3145. [chmod a+x isc-config.sh doc/doxygen/doxygen-input-filter])
  3146. #
  3147. # Files to configure. These are listed here because we used to
  3148. # specify them as arguments to AC_OUTPUT. It's (now) ok to move these
  3149. # elsewhere if there's a good reason for doing so.
  3150. #
  3151. AC_CONFIG_FILES([
  3152. make/Makefile
  3153. make/mkdep
  3154. Makefile
  3155. bin/Makefile
  3156. bin/check/Makefile
  3157. bin/confgen/Makefile
  3158. bin/confgen/unix/Makefile
  3159. bin/dig/Makefile
  3160. bin/dnssec/Makefile
  3161. bin/named/Makefile
  3162. bin/named/unix/Makefile
  3163. bin/nsupdate/Makefile
  3164. bin/pkcs11/Makefile
  3165. bin/rndc/Makefile
  3166. bin/tests/Makefile
  3167. bin/tests/atomic/Makefile
  3168. bin/tests/db/Makefile
  3169. bin/tests/dst/Makefile
  3170. bin/tests/hashes/Makefile
  3171. bin/tests/headerdep_test.sh
  3172. bin/tests/master/Makefile
  3173. bin/tests/mem/Makefile
  3174. bin/tests/names/Makefile
  3175. bin/tests/net/Makefile
  3176. bin/tests/rbt/Makefile
  3177. bin/tests/resolver/Makefile
  3178. bin/tests/sockaddr/Makefile
  3179. bin/tests/system/Makefile
  3180. bin/tests/system/conf.sh
  3181. bin/tests/system/dlz/prereq.sh
  3182. bin/tests/system/dlzexternal/Makefile
  3183. bin/tests/system/dlzexternal/ns1/named.conf
  3184. bin/tests/system/filter-aaaa/Makefile
  3185. bin/tests/system/gost/prereq.sh
  3186. bin/tests/system/lwresd/Makefile
  3187. bin/tests/system/rpz/Makefile
  3188. bin/tests/system/tkey/Makefile
  3189. bin/tests/system/tsiggss/Makefile
  3190. bin/tests/tasks/Makefile
  3191. bin/tests/timers/Makefile
  3192. bin/tests/virtual-time/Makefile
  3193. bin/tests/virtual-time/conf.sh
  3194. bin/tools/Makefile
  3195. contrib/check-secure-delegation.pl
  3196. contrib/zone-edit.sh
  3197. doc/Makefile
  3198. doc/arm/Makefile
  3199. doc/doxygen/Doxyfile
  3200. doc/doxygen/Makefile
  3201. doc/doxygen/doxygen-input-filter
  3202. doc/misc/Makefile
  3203. doc/xsl/Makefile
  3204. doc/xsl/isc-docbook-chunk.xsl
  3205. doc/xsl/isc-docbook-html.xsl
  3206. doc/xsl/isc-docbook-latex.xsl
  3207. doc/xsl/isc-manpage.xsl
  3208. isc-config.sh
  3209. lib/Makefile
  3210. lib/bind9/Makefile
  3211. lib/bind9/include/Makefile
  3212. lib/bind9/include/bind9/Makefile
  3213. lib/dns/Makefile
  3214. lib/dns/include/Makefile
  3215. lib/dns/include/dns/Makefile
  3216. lib/dns/include/dst/Makefile
  3217. lib/dns/tests/Makefile
  3218. lib/export/Makefile
  3219. lib/export/dns/Makefile
  3220. lib/export/dns/include/Makefile
  3221. lib/export/dns/include/dns/Makefile
  3222. lib/export/dns/include/dst/Makefile
  3223. lib/export/irs/Makefile
  3224. lib/export/irs/include/Makefile
  3225. lib/export/irs/include/irs/Makefile
  3226. lib/export/isc/$thread_dir/Makefile
  3227. lib/export/isc/$thread_dir/include/Makefile
  3228. lib/export/isc/$thread_dir/include/isc/Makefile
  3229. lib/export/isc/Makefile
  3230. lib/export/isc/include/Makefile
  3231. lib/export/isc/include/isc/Makefile
  3232. lib/export/isc/nls/Makefile
  3233. lib/export/isc/unix/Makefile
  3234. lib/export/isc/unix/include/Makefile
  3235. lib/export/isc/unix/include/isc/Makefile
  3236. lib/export/isccfg/Makefile
  3237. lib/export/isccfg/include/Makefile
  3238. lib/export/isccfg/include/isccfg/Makefile
  3239. lib/export/samples/Makefile
  3240. lib/export/samples/Makefile-postinstall
  3241. lib/irs/Makefile
  3242. lib/irs/include/Makefile
  3243. lib/irs/include/irs/Makefile
  3244. lib/irs/include/irs/netdb.h
  3245. lib/irs/include/irs/platform.h
  3246. lib/isc/$arch/Makefile
  3247. lib/isc/$arch/include/Makefile
  3248. lib/isc/$arch/include/isc/Makefile
  3249. lib/isc/$thread_dir/Makefile
  3250. lib/isc/$thread_dir/include/Makefile
  3251. lib/isc/$thread_dir/include/isc/Makefile
  3252. lib/isc/Makefile
  3253. lib/isc/include/Makefile
  3254. lib/isc/include/isc/Makefile
  3255. lib/isc/include/isc/platform.h
  3256. lib/isc/tests/Makefile
  3257. lib/isc/nls/Makefile
  3258. lib/isc/unix/Makefile
  3259. lib/isc/unix/include/Makefile
  3260. lib/isc/unix/include/isc/Makefile
  3261. lib/isccc/Makefile
  3262. lib/isccc/include/Makefile
  3263. lib/isccc/include/isccc/Makefile
  3264. lib/isccfg/Makefile
  3265. lib/isccfg/include/Makefile
  3266. lib/isccfg/include/isccfg/Makefile
  3267. lib/lwres/Makefile
  3268. lib/lwres/include/Makefile
  3269. lib/lwres/include/lwres/Makefile
  3270. lib/lwres/include/lwres/netdb.h
  3271. lib/lwres/include/lwres/platform.h
  3272. lib/lwres/man/Makefile
  3273. lib/lwres/unix/Makefile
  3274. lib/lwres/unix/include/Makefile
  3275. lib/lwres/unix/include/lwres/Makefile
  3276. lib/tests/Makefile
  3277. lib/tests/include/Makefile
  3278. lib/tests/include/tests/Makefile
  3279. unit/Makefile
  3280. unit/unittest.sh
  3281. ])
  3282. #
  3283. # Do it
  3284. #
  3285. AC_OUTPUT
  3286. #
  3287. # Now that the Makefiles exist we can ensure that everything is rebuilt.
  3288. #
  3289. AC_ARG_WITH(make-clean,
  3290. [ --with-make-clean Run "make clean" at end of configure [[yes|no]].],
  3291. make_clean="$withval", make_clean="yes")
  3292. case "$make_clean" in
  3293. yes)
  3294. make clean
  3295. ;;
  3296. esac
  3297. if test "X$USE_OPENSSL" = "X"; then
  3298. cat << \EOF
  3299. BIND is being built without OpenSSL. This means it will not have DNSSEC support.
  3300. EOF
  3301. fi
  3302. if test "X$OPENSSL_WARNING" != "X"; then
  3303. cat << \EOF
  3304. WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
  3305. WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
  3306. WARNING WARNING
  3307. WARNING Your OpenSSL crypto library may be vulnerable to WARNING
  3308. WARNING one or more of the the following known security WARNING
  3309. WARNING flaws: WARNING
  3310. WARNING WARNING
  3311. WARNING CAN-2002-0659, CAN-2006-4339, CVE-2006-2937 and WARNING
  3312. WARNING CVE-2006-2940. WARNING
  3313. WARNING WARNING
  3314. WARNING It is recommended that you upgrade to OpenSSL WARNING
  3315. WARNING version 0.9.8d/0.9.7l (or greater). WARNING
  3316. WARNING WARNING
  3317. WARNING You can disable this warning by specifying: WARNING
  3318. WARNING WARNING
  3319. WARNING --disable-openssl-version-check WARNING
  3320. WARNING WARNING
  3321. WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
  3322. WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
  3323. EOF
  3324. fi
  3325. # Tell Emacs to edit this file in shell mode.
  3326. # Local Variables:
  3327. # mode: sh
  3328. # End: