1 AC_INIT([DHCP],[4.4.0a1],[dhcp-users@isc.org])
5 AC_CONFIG_MACRO_DIR([m4])
8 # we specify "foreign" to avoid having to have the GNU mandated files,
9 # like AUTHORS, COPYING, and such
10 AM_INIT_AUTOMAKE([foreign])
12 # we specify AM_MAINTAINER_MODE to avoid problems with rebuilding
13 # the configure and makefiles. Without it users doing things that
14 # change the timestamps on the code, like checking it into a cvs
15 # tree, could trigger a rebuild of the infrastructure files which
16 # might fail if they don't have the correct tools.
21 # We want to turn on warnings if we are using gcc and the user did
22 # not specify CFLAGS. The autoconf check for the C compiler sets the
23 # CFLAGS if gcc is used, so we will save it before we run that check.
26 # Now find our C compiler.
29 # Suppress warnings about --datarootdir
30 AC_DEFUN([AC_DATAROOTDIR_CHECKED])
32 # If we have gcc, and AC_PROG_CC changed the flags, then we know the
33 # user did not specify any flags. Add warnings in this case.
34 if test "$GCC" = "yes"; then
35 if test "$CFLAGS" != "$SAVE_CFLAGS"; then
36 STD_CWARNINGS="$STD_CWARNINGS -Wall -Werror -fno-strict-aliasing"
40 # We can have some flags to pass to bind configure
42 if test "$cross_compiling" = "yes"; then
43 BINDCONFIG="--host=$host"
45 # Pass CFLAGS and co. $ac_configure_args looks like "'arg1' 'arg2' ..."
46 # and as there can be a space inside an argument some magic is required.
47 # This sets $1 ... $N to my_configure_args, arg1 ... argN
48 eval "set my_configure_args $ac_configure_args"
49 # remove my_configure_args, i.e., the guard against empty $ac_configure_args
51 # iterate on arguments and copying 'arg' when it begins by an upper case
55 [[A-Z]]*) BINDCONFIG="$BINDCONFIG '$a'" ;;
60 # POSIX doesn't include the IPv6 Advanced Socket API and glibc hides
61 # parts of the IPv6 Advanced Socket API as a result. This is stupid
62 # as it breaks how the two halves (Basic and Advanced) of the IPv6
63 # Socket API were designed to be used but we have to live with it.
64 # Use this to define _GNU_SOURCE to pull in the IPv6 Advanced Socket API.
65 AC_USE_SYSTEM_EXTENSIONS
67 @BEGIN WITHOUT LIBTOOL
74 if test "X$AR" = "X"; then
76 ar program not found. Please fix your PATH to include the directory in
77 which ar resides, or set AR in the environment with the full path to ar.])
80 AC_CONFIG_HEADERS([includes/config.h])
82 # we sometimes need to know byte order for building packets
83 AC_C_BIGENDIAN(AC_SUBST(byte_order, BIG_ENDIAN),
84 AC_SUBST(byte_order, LITTLE_ENDIAN))
85 AC_DEFINE_UNQUOTED([DHCP_BYTE_ORDER], [$byte_order],
86 [Define to BIG_ENDIAN for MSB (Motorola or SPARC CPUs)
87 or LITTLE_ENDIAN for LSB (Intel CPUs).])
89 # Optional compile-time DEBUGging.
91 AS_HELP_STRING([--enable-debug],[create a debug-only version of the software (default is no).]),
92 [case "${enableval}" in
94 AC_DEFINE([DEBUG], [1],
95 [Define to compile debug-only DHCP software.])
96 # Just override CFLAGS totally to remove optimization.
98 no) enable_debug=no ;;
99 *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
100 esac],[enable_debug=no])
102 # XXX: there are actually quite a lot more DEBUG_ features we could enable,
103 # but I don't want to pollute the --help space.
105 #/* #define DEBUG_TOKENS */
106 #/* #define DEBUG_PACKET */
107 #/* #define DEBUG_EXPRESSIONS */
108 #/* #define DEBUG_FIND_LEASE */
109 #/* #define DEBUG_EXPRESSION_PARSE */
110 #/* #define DEBUG_CLASS_MATCHING */
111 #/* #define DEBUG_MEMORY_LEAKAGE */
112 #/* #define DEBUG_MALLOC_POOL */
113 #/* #define DEBUG_LEASE_STATE_TRANSITIONS */
114 #/* #define DEBUG_RC_HISTORY */
115 #/* #define DEBUG_RC_HISTORY_EXHAUSTIVELY */
116 #/* #define RC_HISTORY_MAX 10240 */
117 #/* #define POINTER_DEBUG */
118 #/* #define DEBUG_FAILOVER_MESSAGES */
119 #/* #define DEBUG_FAILOVER_TIMING */
120 #/* #define DEBUG_DUMP_ALL_LEASES */
122 # Failover optional compile-time feature.
123 AC_ARG_ENABLE(failover,
124 AS_HELP_STRING([--enable-failover],[enable support for failover (default is yes)]))
125 # Failover is on by default, so define if it is not explicitly disabled.
126 if test "$enable_failover" != "no"; then
127 enable_failover="yes"
128 AC_DEFINE([FAILOVER_PROTOCOL], [1],
129 [Define to include Failover Protocol support.])
133 AC_ARG_ENABLE(execute,
134 AS_HELP_STRING([--enable-execute],[enable support for execute() in config (default is yes)]))
135 # execute() is on by default, so define if it is not explicitly disabled.
136 if test "$enable_execute" != "no" ; then
138 AC_DEFINE([ENABLE_EXECUTE], [1],
139 [Define to include execute() config language support.])
142 # Server tracing support.
143 AC_ARG_ENABLE(tracing,
144 AS_HELP_STRING([--enable-tracing],[enable support for server activity tracing (default is yes)]))
145 # tracing is on by default, so define if it is not explicitly disabled.
146 if test "$enable_tracing" != "no" ; then
147 AC_DEFINE([TRACING], [1],
148 [Define to include server activity tracing support.])
151 # Delayed-ack feature support.
152 AC_ARG_ENABLE(delayed_ack,
153 AS_HELP_STRING([--enable-delayed-ack],[queues multiple DHCPACK replies (default is yes)]))
154 if test "$enable_delayed_ack" != "no"; then
155 enable_delayed_ack="yes"
156 AC_DEFINE([DELAYED_ACK], [1],
157 [Define to queue multiple DHCPACK replies per fsync.])
160 # DHCPv6 optional compile-time feature.
161 AC_ARG_ENABLE(dhcpv6,
162 AS_HELP_STRING([--enable-dhcpv6],[enable support for DHCPv6 (default is yes)]))
163 # DHCPv6 is on by default, so define if it is not explicitly disabled.
164 if test "$enable_dhcpv6" != "no"; then
166 AC_DEFINE([DHCPv6], [1],
167 [Define to 1 to include DHCPv6 support.])
170 # DHCPv4o6 optional compile-time feature.
171 AC_ARG_ENABLE(dhcpv4o6,
172 AS_HELP_STRING([--enable-dhcpv4o6],[enable support for DHCPv4-over-DHCPv6 (default is no)]))
173 # DHCPv4o6 is off by default, so define if it is explicitly enabled.
174 if test "$enable_dhcpv4o6" = "yes"; then
175 # DHCPv4o6 requires DHCPv6
176 if test "$enable_dhcpv6" = "no"; then
177 AC_MSG_ERROR([dhcpv4o6 requires dhcpv6])
179 AC_DEFINE([DHCP4o6], [1],
180 [Define to 1 to include DHCPv4 over DHCPv6 support.])
182 # so we can report below
186 # PARANOIA is off by default (until we can test it with all features)
187 AC_ARG_ENABLE(paranoia,
188 AS_HELP_STRING([--enable-paranoia],[enable support for chroot/setuid (default is no)]))
189 AC_ARG_ENABLE(early_chroot,
190 AS_HELP_STRING([--enable-early-chroot],[enable chrooting prior to configuration (default is no)]))
191 # If someone enables early chroot, but does not enable paranoia, do so for
193 if test "$enable_paranoia" != "yes" && \
194 test "$enable_early_chroot" = "yes" ; then
195 enable_paranoia="yes"
198 if test "$enable_paranoia" = "yes" ; then
199 AC_DEFINE([PARANOIA], [1],
200 [Define to any value to include Ari's PARANOIA patch.])
202 if test "$enable_early_chroot" = "yes" ; then
203 AC_DEFINE([EARLY_CHROOT], [1],
204 [Define to any value to chroot() prior to loading config.])
207 AC_ARG_ENABLE(ipv4_pktinfo,
208 AS_HELP_STRING([--enable-ipv4-pktinfo],[enable use of pktinfo on IPv4 sockets (default is no)]))
210 if test "$enable_ipv4_pktinfo" = "yes"; then
211 AC_DEFINE([USE_V4_PKTINFO], [1],
212 [Define to 1 to enable IPv4 packet info support.])
215 AC_ARG_ENABLE(use_sockets,
216 AS_HELP_STRING([--enable-use-sockets],[use the standard BSD socket API (default is no)]))
218 if test "$enable_use_sockets" = "yes"; then
219 AC_DEFINE([USE_SOCKETS], [1],
220 [Define to 1 to use the standard BSD socket API.])
223 # Include the PID in the log messages. This is useful when there may
224 # be multiple instances of a program.
225 # This is off by default
226 AC_ARG_ENABLE(log_pid,
227 AS_HELP_STRING([--enable-log-pid],[Include PIDs in syslog messages (default is no).]))
228 if test "$enable_log_pid" = "yes" ; then
229 AC_DEFINE([USE_LOG_PID], [1],
230 [Define to include PIDs in syslog messages.])
233 # Allow for binary search when inserting v4 leases into queues
234 AC_ARG_ENABLE(binary_leases,
235 AS_HELP_STRING([--enable-binary-leases],[enable support for binary insertion of leases (default is no)]))
236 # binary_leases is off by default.
237 if test "$enable_binary_leases" = "yes"; then
238 AC_DEFINE([BINARY_LEASES], [1],
239 [Define to support binary insertion of leases into queues.])
241 enable_binary_leases="no"
246 DISTCHECK_ATF_CONFIGURE_FLAG=
249 AS_HELP_STRING([--with-atf=PATH],[specify location where atf was installed (or "bind")]),
250 [atf_path="$withval"])
251 AM_CONDITIONAL(BIND_ATF, test "$atf_path" = "bind")
252 if test "$atf_path" = "bind" ; then
253 DISTCHECK_ATF_CONFIGURE_FLAG="--with-atf=bind"
255 atf_path="\${top_srcdir}/bind/atf"
256 ATF_CFLAGS="-I$atf_path/include -DUNIT_TEST"
257 ATF_LDFLAGS="-L$atf_path/lib -latf-c"
258 ATF_BIN=`cd $srcdir; pwd`/bind/atf/bin
260 AC_SUBST(ATF_LDFLAGS)
262 BINDCONFIG="$BINDCONFIG --with-atf"
263 elif test "$atf_path" != "no" ; then
264 DISTCHECK_ATF_CONFIGURE_FLAG="--with-atf=$atf_path"
265 # Config path for pkg-config
267 if test "$atf_path" != "yes" ; then
268 if test -f $atf_path/lib/pkgconfig/atf-c.pc ; then
269 atf_pcp=$atf_path/lib/pkgconfig
270 elif test -f $atf_path/lib64/pkgconfig/atf-c.pc ; then
271 atf_pcp=$atf_path/lib64/pkgconfig
274 # Not specified, try some common paths
275 atf_dirs="/usr /usr/local /usr/pkg /opt /opt/local"
278 if test -f $d/lib/pkgconfig/atf-c.pc ; then
279 atf_pcp=$d/lib/pkgconfig
281 elif test -f $d/lib64/pkgconfig/atf-c.pc ; then
282 atf_pcp=$d/lib64/pkgconfig
288 if test "$atf_pcp" = "" ; then
289 AC_MSG_ERROR([Unable to find atf files in location specified])
291 AC_CHECK_PROG([pkgcfg_found],[pkg-config],[pkg-config],[])
292 if test "$pkgcfg_found" = ""; then
293 AC_MSG_ERROR([Could not locate ATF, pkg-config not installed])
295 ATF_CFLAGS="`PKG_CONFIG_PATH=$atf_pcp pkg-config --cflags atf-c` -DUNIT_TEST"
296 ATF_LDFLAGS="`PKG_CONFIG_PATH=$atf_pcp pkg-config --libs atf-c`"
297 if test -f $atf_pcp/atf-sh.pc ; then
298 ATF_BIN="`PKG_CONFIG_PATH=$atf_pcp pkg-config --variable=exec_prefix atf-sh`/bin"
300 # older versions don't have atf-sh, try usual place
301 ATF_BIN=$atf_path/bin
304 if test ! -x $ATF_BIN/atf-run -o ! -x $ATF_BIN/atf-report ; then
305 AC_MSG_WARN([atf-run/atf-report not found, assuming they are in your path])
309 AC_SUBST(ATF_LDFLAGS)
314 AM_CONDITIONAL(HAVE_ATF, test "$atf_pcp" != "")
315 AM_COND_IF([HAVE_ATF], [AC_DEFINE([HAVE_ATF], [1], [ATF framework specified?])])
316 AC_SUBST(DISTCHECK_ATF_CONFIGURE_FLAG)
319 ### Path fun. Older versions of DHCP were installed in /usr/sbin, so we
320 ### need to look there and potentially overwrite by default (but not if
321 ### the user configures an alternate value). LOCALSTATEDIR is totally
322 ### braindead. No one uses /usr/local/var/db/ nor /usr/local/var/run, and
323 ### they would be insane for suggesting it. We need to look in /var/for
324 ### 'db' and 'state/dhcp' for db files, and /var/run for pid files by
327 AC_PREFIX_PROGRAM(dhcpd)
329 # XXX - isn't there SOME WAY to default autoconf to /var instead of
330 # /usr/local/var/no/one/has/this/please/stop/trying?
331 case "$localstatedir" in
337 # Default server configuration file.
338 AC_ARG_WITH(srv-conf-file,
339 AS_HELP_STRING([--with-srv-conf-file=PATH],[Default file containing dhcpd configuration
340 (default is typically /etc/dhcpd.conf)]),
341 AC_DEFINE_UNQUOTED([_PATH_DHCPD_CONF], ["$withval"],
342 [Default file containing dhcpd configuration.]))
344 # Allow specification of alternate state files
345 AC_ARG_WITH(srv-lease-file,
346 AS_HELP_STRING([--with-srv-lease-file=PATH],[File for dhcpd leases
347 (default is LOCALSTATEDIR/db/dhcpd.leases)]),
348 AC_DEFINE_UNQUOTED([_PATH_DHCPD_DB], ["$withval"],
349 [File for dhcpd leases.]))
351 AC_MSG_CHECKING([for dhcpd.leases location])
352 if [[ "x$with_srv_lease_file" = "x" ]] ; then
353 if [[ -d "${localstatedir}/db" ]] ; then
354 with_srv_lease_file="${localstatedir}/db/dhcpd.leases"
355 elif [[ -d "${localstatedir}/state" ]] ; then
356 if [[ -d "${localstatedir}/state/dhcp" ]] ; then
357 with_srv_lease_file="${localstatedir}/state/dhcp/dhcpd.leases"
359 with_srv_lease_file="${localstatedir}/state/dhcpd.leases"
361 elif [[ -d "${localstatedir}/lib" ]] ; then
362 if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
363 with_srv_lease_file="${localstatedir}/lib/dhcp/dhcpd.leases"
365 with_srv_lease_file="${localstatedir}/lib/dhcpd.leases"
367 elif [[ -d "${localstatedir}/etc" ]] ; then
368 with_srv_lease_file="${localstatedir}/etc/dhcpd.leases"
370 with_srv_lease_file="/etc/dhcpd.leases"
373 AC_MSG_RESULT($with_srv_lease_file)
375 AC_ARG_WITH(srv6-lease-file,
376 AS_HELP_STRING([--with-srv6-lease-file=PATH],[File for dhcpd6 leases
377 (default is LOCALSTATEDIR/db/dhcpd6.leases)]),
378 AC_DEFINE_UNQUOTED([_PATH_DHCPD6_DB], ["$withval"],
379 [File for dhcpd6 leases.]))
381 AC_MSG_CHECKING([for dhcpd6.leases location])
382 if [[ "x$with_srv6_lease_file" = "x" ]] ; then
383 if [[ -d "${localstatedir}/db" ]] ; then
384 with_srv6_lease_file="${localstatedir}/db/dhcpd6.leases"
385 elif [[ -d "${localstatedir}/state" ]] ; then
386 if [[ -d "${localstatedir}/state/dhcp" ]] ; then
387 with_srv6_lease_file="${localstatedir}/state/dhcp/dhcpd6.leases"
389 with_srv6_lease_file="${localstatedir}/state/dhcpd6.leases"
391 elif [[ -d "${localstatedir}/lib" ]] ; then
392 if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
393 with_srv6_lease_file="${localstatedir}/lib/dhcp/dhcpd6.leases"
395 with_srv6_lease_file="${localstatedir}/lib/dhcpd6.leases"
397 elif [[ -d "${localstatedir}/etc" ]] ; then
398 with_srv6_lease_file="${localstatedir}/etc/dhcpd6.leases"
400 with_srv6_lease_file="/etc/dhcpd6.leases"
403 AC_MSG_RESULT($with_srv6_lease_file)
405 AC_ARG_WITH(cli-lease-file,
406 AS_HELP_STRING([--with-cli-lease-file=PATH],[File for dhclient leases
407 (default is LOCALSTATEDIR/db/dhclient.leases)]),
408 AC_DEFINE_UNQUOTED([_PATH_DHCLIENT_DB], ["$withval"],
409 [File for dhclient leases.]))
411 AC_MSG_CHECKING([for dhclient.leases location])
412 if [[ "x$with_cli_lease_file" = "x" ]] ; then
413 if [[ -d "${localstatedir}/db" ]] ; then
414 with_cli_lease_file="${localstatedir}/db/dhclient.leases"
415 elif [[ -d "${localstatedir}/state" ]] ; then
416 if [[ -d "${localstatedir}/state/dhcp" ]] ; then
417 with_cli_lease_file="${localstatedir}/state/dhcp/dhclient.leases"
419 with_cli_lease_file="${localstatedir}/state/dhclient.leases"
421 elif [[ -d "${localstatedir}/lib" ]] ; then
422 if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
423 with_cli_lease_file="${localstatedir}/lib/dhcp/dhclient.leases"
425 with_cli_lease_file="${localstatedir}/lib/dhclient.leases"
427 elif [[ -d "${localstatedir}/etc" ]] ; then
428 with_cli_lease_file="${localstatedir}/etc/dhclient.leases"
430 with_cli_lease_file="/etc/dhclient.leases"
433 AC_MSG_RESULT($with_cli_lease_file)
435 AC_ARG_WITH(cli6-lease-file,
436 AS_HELP_STRING([--with-cli6-lease-file=PATH],[File for dhclient6 leases
437 (default is LOCALSTATEDIR/db/dhclient6.leases)]),
438 AC_DEFINE_UNQUOTED([_PATH_DHCLIENT6_DB], ["$withval"],
439 [File for dhclient6 leases.]))
441 AC_MSG_CHECKING([for dhclient6.leases location])
442 if [[ "x$with_cli6_lease_file" = "x" ]] ; then
443 if [[ -d "${localstatedir}/db" ]] ; then
444 with_cli6_lease_file="${localstatedir}/db/dhclient6.leases"
445 elif [[ -d "${localstatedir}/state" ]] ; then
446 if [[ -d "${localstatedir}/state/dhcp" ]] ; then
447 with_cli6_lease_file="${localstatedir}/state/dhcp/dhclient6.leases"
449 with_cli6_lease_file="${localstatedir}/state/dhclient6.leases"
451 elif [[ -d "${localstatedir}/lib" ]] ; then
452 if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
453 with_cli6_lease_file="${localstatedir}/lib/dhcp/dhclient6.leases"
455 with_cli6_lease_file="${localstatedir}/lib/dhclient6.leases"
457 elif [[ -d "${localstatedir}/etc" ]] ; then
458 with_cli6_lease_file="${localstatedir}/etc/dhclient6.leases"
460 with_cli6_lease_file="/etc/dhclient6.leases"
463 AC_MSG_RESULT($with_cli6_lease_file)
465 AC_ARG_WITH(srv-pid-file,
466 AS_HELP_STRING([--with-srv-pid-file=PATH],[File for dhcpd process information
467 (default is LOCALSTATEDIR/run/dhcpd.pid)]),
468 AC_DEFINE_UNQUOTED([_PATH_DHCPD_PID], ["$withval"],
469 [File for dhcpd process information.]))
470 AC_ARG_WITH(srv6-pid-file,
471 AS_HELP_STRING([--with-srv6-pid-file=PATH],[File for dhcpd6 process information
472 (default is LOCALSTATEDIR/run/dhcpd6.pid)]),
473 AC_DEFINE_UNQUOTED([_PATH_DHCPD6_PID], ["$withval"],
474 [File for dhcpd6 process information.]))
475 AC_ARG_WITH(cli-pid-file,
476 AS_HELP_STRING([--with-cli-pid-file=PATH],[File for dhclient process information
477 (default is LOCALSTATEDIR/run/dhclient.pid)]),
478 AC_DEFINE_UNQUOTED([_PATH_DHCLIENT_PID], ["$withval"],
479 [File for dhclient process information.]))
480 AC_ARG_WITH(cli6-pid-file,
481 AS_HELP_STRING([--with-cli6-pid-file=PATH],[File for dhclient6 process information
482 (default is LOCALSTATEDIR/run/dhclient6.pid)]),
483 AC_DEFINE_UNQUOTED([_PATH_DHCLIENT6_PID], ["$withval"],
484 [File for dhclient6 process information.]))
485 AC_ARG_WITH(relay-pid-file,
486 AS_HELP_STRING([--with-relay-pid-file=PATH],[File for dhcrelay process information
487 (default is LOCALSTATEDIR/run/dhcrelay.pid)]),
488 AC_DEFINE_UNQUOTED([_PATH_DHCRELAY_PID], ["$withval"],
489 [File for dhcrelay process information.]))
490 AC_ARG_WITH(relay6-pid-file,
491 AS_HELP_STRING([--with-relay6-pid-file=PATH],[File for dhcrelay6 process information
492 (default is LOCALSTATEDIR/run/dhcrelay6.pid)]),
493 AC_DEFINE_UNQUOTED([_PATH_DHCRELAY6_PID], ["$withval"],
494 [File for dhcrelay6 process information.]))
502 # Some systems need the u_intX_t types defined across.
503 AC_CHECK_TYPE([u_int8_t], [], [
505 AC_DEFINE(u_int8_t, [uint8_t], [Define a type for 8-bit unsigned
508 AC_CHECK_TYPE([u_int16_t], [], [
510 AC_DEFINE(u_int16_t, [uint16_t], [Define a type for 16-bit unsigned
513 AC_CHECK_TYPE([u_int32_t], [], [
515 AC_DEFINE(u_int32_t, [uint32_t], [Define a type for 32-bit unsigned
518 AC_CHECK_TYPE([u_int64_t], [], [
520 AC_DEFINE(u_int64_t, [uint64_t], [Define a type for 64-bit unsigned
524 # see if ifaddrs.h is available
525 AC_CHECK_HEADERS(ifaddrs.h)
527 # figure out what IPv4 interface code to use
528 AC_CHECK_HEADERS(linux/types.h) # needed for linux/filter.h on old systems
530 AC_CHECK_HEADER(linux/filter.h, DO_LPF=1, ,
532 #ifdef HAVE_LINUX_TYPES_H
533 #include <linux/types.h>
538 AC_DEFINE([HAVE_LPF], [1],
539 [Define to 1 to use the Linux Packet Filter interface code.])
541 AC_CHECK_HEADER(sys/dlpi.h, DO_DLPI=1)
542 if test -n "$DO_DLPI"
544 AC_DEFINE([HAVE_DLPI], [1],
545 [Define to 1 to use DLPI interface code.])
547 AC_CHECK_HEADER(net/bpf.h, DO_BPF=1)
550 AC_DEFINE([HAVE_BPF], [1],
551 [Define to 1 to use the
552 Berkeley Packet Filter interface code.])
557 # SIOCGLIFCONF uses some transport structures. Trick is not all platforms
558 # use the same structures. We like to use 'struct lifconf' and 'struct
559 # lifreq', but we'll use these other structures if they're present. HPUX
560 # does not define 'struct lifnum', but does use SIOCGLIFNUM - they use an
563 AC_MSG_CHECKING([for struct lifnum])
564 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h>
565 #include <sys/socket.h>
567 ]], [[ struct lifnum a;
568 ]])],[AC_MSG_RESULT(yes)
569 AC_DEFINE([ISC_PLATFORM_HAVELIFNUM], [1],
570 [Define to 1 if the system has 'struct lifnum'.])],[AC_MSG_RESULT(no)])
572 AC_MSG_CHECKING([for struct if_laddrconf])
573 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h>
575 ]], [[ struct if_laddrconf a;
576 ]])],[AC_MSG_RESULT(yes)
577 AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRCONF], [1],
578 [Define to 1 if the system has 'struct if_laddrconf'.])],[AC_MSG_RESULT(no)])
580 AC_MSG_CHECKING([for struct if_laddrreq])
581 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
583 ]], [[ struct if_laddrreq a;
584 ]])],[AC_MSG_RESULT(yes)
585 AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRREQ], [1],
586 [Define to 1 if the system has 'struct if_laddrreq'.])],[AC_MSG_RESULT(no)])
589 # check for GCC noreturn attribute
591 AC_MSG_CHECKING(for GCC noreturn attribute)
592 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[void foo() __attribute__((noreturn));]])],[AC_MSG_RESULT(yes)
593 AC_DEFINE([ISC_DHCP_NORETURN], [__attribute__((noreturn))],
594 [Define to the string for a noreturn attribute.])],[AC_MSG_RESULT(no)
595 AC_DEFINE([ISC_DHCP_NORETURN], [],
596 [Define to the string for a noreturn attribute.])])
598 # Look for optional headers.
599 AC_CHECK_HEADERS(sys/socket.h net/if_dl.h net/if6.h regex.h)
601 # Solaris needs some libraries for functions
602 AC_SEARCH_LIBS(socket, [socket])
603 AC_SEARCH_LIBS(inet_ntoa, [nsl])
605 AC_SEARCH_LIBS(inet_aton, [socket nsl], ,
606 AC_DEFINE([NEED_INET_ATON], [1],
607 [Define to 1 if the inet_aton() function is missing.]))
609 # Check for a standalone regex library.
610 AC_SEARCH_LIBS(regcomp, [regex])
612 AC_CHECK_FUNCS(strlcat)
614 # For HP/UX we need -lipv6 for if_nametoindex, perhaps others.
615 AC_SEARCH_LIBS(if_nametoindex, [ipv6])
617 # For some Solaris nanosleep is found by BIND in librt
619 AC_CHECK_FUNC(nanosleep, have_nanosleep="yes")
620 if test "$have_nanosleep" = "no"; then
621 AC_CHECK_LIB(rt, nanosleep, have_nanosleep="rt")
623 if test "$have_nanosleep" = "rt"; then
627 # check for /dev/random (declares HAVE_DEV_RANDOM)
628 AC_MSG_CHECKING(for random device)
629 AC_ARG_WITH(randomdev,
630 AS_HELP_STRING([--with-randomdev=PATH],[Path for random device
631 (default is /dev/random)]),
632 use_randomdev="$withval", use_randomdev="unspec")
633 if test "$use_randomdev" = "unspec"; then
634 if test "$cross_compiling" = "yes"; then
635 AC_MSG_RESULT(unspecified)
636 AC_MSG_ERROR([ need --with-randomdev=PATH or --with-randomdev=no])
638 use_randomdev="/dev/random"
639 elif test "$use_randomdev" = "yes"; then
640 use_randomdev="/dev/random"
642 if test "$use_randomdev" = "no"; then
643 AC_MSG_RESULT(disabled)
644 BINDCONFIG="$BINDCONFIG --with-randomdev=no"
646 if test "$cross_compiling" = "yes"; then
647 AC_MSG_RESULT($use_randomdev (unchecked))
649 AC_MSG_RESULT($use_randomdev)
650 AC_CHECK_FILE($use_randomdev,
651 AC_DEFINE([HAVE_DEV_RANDOM], [1],
652 [Define to 1 if you have the /dev/random or other configured file.]),
653 AC_MSG_ERROR(cannot find $use_randomdev))
655 BINDCONFIG="$BINDCONFIG --with-randomdev=$use_randomdev"
658 BINDIOMUX="--disable-kqueue --disable-epoll --disable-devpoll"
659 # check kqueue/epoll/devpoll alternative to select
660 AC_ARG_ENABLE(kqueue,
661 AS_HELP_STRING([--enable-kqueue],[use BSD kqueue (default is no)]),
662 want_kqueue="$enableval", want_kqueue="no")
663 if test "$want_kqueue" = "yes"; then
664 BINDIOMUX="--enable-kqueue"
665 AC_MSG_WARN([--enable-kqueue is not supported: it may lead to issues such as server looping])
668 AS_HELP_STRING([--enable-epoll],[use Linux epoll (default is no)]),
669 want_epoll="$enableval", want_epoll="no")
670 if test "$want_epoll" = "yes"; then
671 BINDIOMUX="--enable-epoll"
672 AC_MSG_WARN([--enable-epoll is not supported: it may lead to issues such as server looping])
674 AC_ARG_ENABLE(devpoll,
675 AS_HELP_STRING([--enable-devpoll],[use /dev/poll (default is no)]),
676 want_devpoll="$enableval", want_devpoll="no")
677 if test "$want_devpoll" = "yes"; then
678 BINDIOMUX="--enable-devpoll"
679 AC_MSG_WARN([--enable-devpoll is not supported: it may lead to issues such as server looping])
683 # general extra bind configure arguments
684 AC_ARG_WITH(bind-extra-config,
685 AS_HELP_STRING([--with-bind-extra-config],[configure bind librairies
686 with some extra options (default is none)]),
687 use_xbindconfig="$withval", use_xbindconfig="")
688 case "$use_xbindconfig" in
692 BINDCONFIG="$BINDCONFIG $use_xbindconfig"
693 AC_MSG_WARN([Most options to bind configure are not supported when used by ISC DHCP])
697 # see if there is a "sa_len" field in our interface information structure
698 AC_CHECK_MEMBER(struct sockaddr.sa_len,
699 AC_DEFINE([HAVE_SA_LEN], [],
700 [Define to 1 if the sockaddr structure has a length field.]),
702 [#include <sys/socket.h>])
704 # figure out pointer size
705 SAVE_CFLAGS="$CFLAGS"
706 CFLAGS="$CFLAGS -I$srcdir"
707 AC_CHECK_SIZEOF(struct iaddr *, , [
708 #include "includes/inet.h"
711 CFLAGS="$SAVE_CFLAGS"
713 # Solaris does not have the msg_control or msg_controlen members
714 # in the msghdr structure unless you define:
716 # _XOPEN_SOURCE, _XOPEN_SOURCE_EXTENDED, and __EXTENSIONS__
718 # See the "standards" man page for details.
720 # We check for the msg_control member, and if it is not found, we check
721 # again with the appropriate defines added to the CFLAGS. (In order to
722 # do this we have to remove the check from the cache, which is what the
724 AC_CHECK_MEMBER(struct msghdr.msg_control,,
725 [CFLAGS="$CFLAGS -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
726 CFLAGS="$CFLAGS -D__EXTENSIONS__"
727 unset ac_cv_member_struct_msghdr_msg_control
728 AC_CHECK_MEMBER(struct msghdr.msg_control,,
729 [AC_MSG_ERROR([Missing msg_control member in
730 msg_control structure.])],
732 #include <sys/types.h>
733 #include <sys/socket.h>
737 #include <sys/types.h>
738 #include <sys/socket.h>
741 AC_CHECK_MEMBER(struct tpacket_auxdata.tp_vlan_tci,
742 [AC_DEFINE([VLAN_TCI_PRESENT], [1], [tpacket_auxdata.tp_vlan_tci present])]
743 ,, [#include <linux/if_packet.h>])
745 # bind/Makefile.in is not from automake so we need 2 variables for bind dir
753 DISTCHECK_LIBBIND_CONFIGURE_FLAG=
755 AS_HELP_STRING([--with-libbind=PATH],[bind includes and libraries are in PATH]),
756 use_libbind="$withval", use_libbind="no")
757 case "$use_libbind" in
759 AC_MSG_ERROR([PATH is required in --with-libbind=PATH])
762 BINDSUBDIR="\${top_srcdir}/bind"
763 my_abs_srcdir=`cd $srcdir && pwd`
764 BINDDIR="${my_abs_srcdir}/bind"
765 if test ! -d "$srcdir/bind"; then
766 AC_MSG_ERROR([Where to find or build bind includes and libraries must be specified])
768 if test -d "$srcdir/bind/bind9"; then
769 BINDSRCDIR="${my_abs_srcdir}/bind/bind9"
771 if test ! -f "$srcdir/bind/version.tmp"; then
772 AC_MSG_ERROR([Cannot find $srcdir/bind/version.tmp])
774 . "$srcdir/bind/version.tmp"
775 bindversion=${MAJORVER}.${MINORVER}.${PATCHVER}${RELEASETYPE}${RELEASEVER}
776 BINDSRCDIR="${my_abs_srcdir}/bind/bind-$bindversion"
778 AC_CONFIG_FILES([$srcdir/bind/Makefile])
780 BINDLIBIRSDIR="$BINDSRCDIR/lib/irs"
781 BINDLIBDNSDIR="$BINDSRCDIR/lib/dns"
782 BINDLIBISCCFGDIR="$BINDSRCDIR/lib/isccfg"
783 BINDLIBISCDIR="$BINDSRCDIR/lib/isc"
786 if test ! -d "$use_libbind"; then
787 AC_MSG_ERROR([Cannot find bind directory at $use_libbind])
789 if test ! -d "$use_libbind/include" -o \
790 ! -f "$use_libbind/include/isc/buffer.h"
792 AC_MSG_ERROR([Cannot find bind includes at $use_libbind/include])
794 if test ! -d "$use_libbind/lib" -o \
795 \( ! -f "$use_libbind/lib/libisc.a" -a \
796 ! -f "$use_libbind/lib/libisc.la" \)
798 AC_MSG_ERROR([Cannot find bind libraries at $use_libbind/lib])
800 BINDDIR="$use_libbind"
801 BINDLIBIRSDIR="$BINDDIR/lib"
802 BINDLIBDNSDIR="$BINDDIR/lib"
803 BINDLIBISCCFGDIR="$BINDDIR/lib"
804 BINDLIBISCDIR="$BINDDIR/lib"
805 DISTCHECK_LIBBIND_CONFIGURE_FLAG="--with-libbind=$use_libbind"
811 AC_SUBST(BINDLIBIRSDIR)
812 AC_SUBST(BINDLIBDNSDIR)
813 AC_SUBST(BINDLIBISCCFGDIR)
814 AC_SUBST(BINDLIBISCDIR)
815 AC_SUBST(DISTCHECK_LIBBIND_CONFIGURE_FLAG)
816 AM_CONDITIONAL(HAVE_BINDDIR, test "$use_libbind" = "no")
819 # GNU libtool support
823 # Just set the maximum command line length for sunos
824 # as it otherwise takes a exceptionally long time to
825 # work it out. Required for libtool.
827 lt_cv_sys_max_cmd_len=4096
838 DISTCHECK_LIBTOOL_CONFIGURE_FLAG=
839 AC_ARG_ENABLE(libtool,
840 AS_HELP_STRING([--enable-libtool],
842 [use GNU libtool for dynamic shared libraries (default is yes).]),
844 @BEGIN WITHOUT LIBTOOL
845 [use GNU libtool for dynamic shared libraries (default is no).]),
847 want_libtool="$enableval")
849 if test "$use_libbind" != "no"; then
850 if test "$want_libtool" = "yes" -a \
851 ! -f "$use_libbind/lib/libisc.la"
853 AC_MSG_ERROR([Cannot find dynamic libraries at $use_libbind/lib])
855 if test "$want_libtool" = "no" -a \
856 ! -f "$use_libbind/lib/libisc.a"
858 AC_MSG_ERROR([Cannot find static libraries at $use_libbind/lib])
863 if test "$want_libtool" = "no"; then
864 AC_MSG_ERROR([libtool configure is used but libtool is disabled?])
869 BINDLT="--with-libtool --disable-symtable"
870 # BIND does not provide uninstall
871 DISTCHECK_LIBTOOL_CONFIGURE_FLAG="--enable-libtool --disable-bind-install"
874 @BEGIN WITHOUT LIBTOOL
875 if test "$want_libtool" = "yes"; then
876 AC_MSG_WARN([legacy configure is used but libtool is enabled. Trying to recover...])
877 # expand $ac_configure_args
878 eval "set my_configure_args $ac_configure_args"
880 cd $srcdir; exec ./config+lt "$@"
881 AC_MSG_ERROR([Recovering failed])
891 AC_SUBST(DISTCHECK_LIBTOOL_CONFIGURE_FLAG)
893 # quoting in Makefile.am.in
897 # install bind includes and libraries
899 want_install_bind="no"
901 want_install_bind="yes"
903 if test "$want_libtool" = "yes"; then
904 want_install_bind="yes"
906 if test "$use_libbind" != "no"; then
907 want_install_bind="no"
909 AC_ARG_ENABLE(bind_install,
910 AS_HELP_STRING([--enable-bind-install],
912 [install bind includes and libraries.]),
914 @BEGIN WITHOUT LIBTOOL
915 [install bind includes and libraries (default is no).]),
917 want_install_bind="$enableval")
918 if test "$want_install_bind" = "yes"; then
919 if test "$use_libbind" != "no"; then
920 AC_MSG_WARN([--enable-bind-install does nothing when --with-libbind is set])
922 elif test "$want_libtool" = "yes" -a "$use_libbind" = "no"; then
923 AC_MSG_WARN([embedded dynamic bind libraries must be installed])
925 AM_CONDITIONAL(INSTALL_BIND, test "$want_install_bind" = "yes")
929 AS_HELP_STRING([--with-ldap],[enable OpenLDAP support in dhcpd (default is no)]),
933 # OpenLDAP with SSL support.
934 AC_ARG_WITH(ldapcrypto,
935 AS_HELP_STRING([--with-ldapcrypto],[enable OpenLDAP crypto support in dhcpd (default is no)]),
936 [ldapcrypto=$withval],
939 # Gssapi to allow LDAP to authenticate with a keytab
940 AC_ARG_WITH(ldap-gssapi,
941 AC_HELP_STRING([--with-ldap-gssapi],
942 [enable krb5/gssapi authentication for OpenLDAP in dhcpd (default is no)]),
943 [ldap_gssapi=$withval],
947 # LDAP CASA auth support.
948 AC_ARG_WITH(ldapcasa,
949 AC_HELP_STRING([--with-ldapcasa],
950 [enable LDAP CASA auth support in dhcpd (default is no)]),
954 # OpenLDAP support is disabled by default, if enabled then SSL support is an
955 # extra optional that is also disabled by default. Enabling LDAP SSL support
956 # implies enabling LDAP support. Similarly, KRB5 support implies LDAP support,
957 # but doesn't include SSL. The two are not dependant.
958 if test x$ldap = xyes || test x$ldapcrypto = xyes || test x$ldap_gssapi = xyes; then
961 AC_SEARCH_LIBS(ldap_initialize, [ldap], ,
962 AC_MSG_FAILURE([*** Cannot find ldap_initialize with -lldap - do you need to install an OpenLDAP2 Devel package?]))
963 AC_SEARCH_LIBS(ber_pvt_opt_on, [lber], ,
964 AC_MSG_FAILURE([*** Cannot find ber_pvt_opt_on with -llber - do you need to install an OpenLDAP2 Devel package?]))
965 if test x$ldap_gssapi = xyes ; then
966 AC_SEARCH_LIBS(krb5_init_context, [krb5], ,
967 AC_MSG_FAILURE([*** Cannot find krb5_init_context with -lkrb5 - do you need to install a Kerberos Devel package?]))
970 # Create LDAP_LIBS which we specify them explicitly rather than lumping them in with LIBS
971 AC_SUBST(LDAP_LIBS, [$LIBS])
975 AC_CHECK_HEADERS([ldap.h])
976 AC_CHECK_FUNCS([inet_pton inet_ntop])
979 LDAP_CFLAGS="-DLDAP_CONFIGURATION"
981 if test x$ldapcasa = xyes ; then
982 AC_CHECK_HEADERS([micasa_mgmd.h],[
983 LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_CASA_AUTH"
984 ], AC_MSG_FAILURE([*** Cannot find micasa_mgmd.h for ldap casa auth support]))
987 if test x$ldapcrypto = xyes ; then
988 LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_USE_SSL"
991 if test x$ldap_gssapi = xyes; then
992 LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_USE_GSSAPI"
995 AC_SUBST(LDAP_CFLAGS, [$LDAP_CFLAGS])
998 # Append selected warning levels to CFLAGS before substitution (but after
999 # AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[]) & etc).
1000 CFLAGS="$CFLAGS $STD_CWARNINGS"
1002 # Try to add the bind and dhcp include directories
1003 CFLAGS="$CFLAGS -I\$(top_srcdir)/includes -I$BINDDIR/include"
1007 CFLAGS="$CFLAGS -D__APPLE_USE_RFC_3542";;
1009 # As of Solaris 11, ethernet dev files are in /dev/net
1010 AC_CHECK_FILE(/dev/net,
1011 [AC_DEFINE([USE_DEV_NET], [1],
1012 [Define to 1 if ethernet devices are in /dev/net])])
1016 AC_C_FLEXIBLE_ARRAY_MEMBER
1021 client/tests/Makefile
1024 common/tests/Makefile
1035 server/tests/Makefile
1041 AC_MSG_NOTICE([postconfig: run automake in $srcdir])
1042 (cd $srcdir; automake)
1043 AC_MSG_NOTICE([postconfig: rerun config.status])
1047 if test "$enable_dhcpv4o6" = "yes"; then
1048 DHCP_VERSIONS="DHCPv4, DHCPv6 and DHCPv4-over-DHCPv6"
1049 elif test "$enable_dhcpv6" != "no"; then
1050 DHCP_VERSIONS="DHCPv4 and DHCPv6"
1052 DHCP_VERSIONS="DHCPv4"
1055 cat > config.report << END
1057 ISC DHCP source configure results:
1058 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1062 Version: $PACKAGE_VERSION
1070 DHCP versions: $DHCP_VERSIONS
1073 debug: $enable_debug
1074 failover: $enable_failover
1075 execute: $enable_execute
1076 binary-leases: $enable_binary_leases
1077 dhcpv6: $enable_dhcpv6
1078 delayed-ack: $enable_delayed_ack
1079 dhcpv4o6: $enable_dhcpv4o6
1082 ATF unittests : $atf_path
1085 # TODO: Add Perl system tests
1087 if test "$atf_path" != "no"
1089 echo "ATF_CFLAGS : $ATF_CFLAGS" >> config.report
1090 echo "ATF_LDFLAGS : $ATF_LDFLAGS" >> config.report
1091 echo "ATF_BIN : $ATF_BIN" >> config.report
1098 echo Now you can type "make" to build ISC DHCP