1 AC_INIT([DHCP],[4.4.0a1],[dhcp-users@isc.org])
4 AC_CONFIG_MACRO_DIR([m4])
6 # we specify "foreign" to avoid having to have the GNU mandated files,
7 # like AUTHORS, COPYING, and such
8 AM_INIT_AUTOMAKE([foreign])
10 # we specify AM_MAINTAINER_MODE to avoid problems with rebuilding
11 # the configure and makefiles. Without it users doing things that
12 # change the timestamps on the code, like checking it into a cvs
13 # tree, could trigger a rebuild of the infrastructure files which
14 # might fail if they don't have the correct tools.
19 # We want to turn on warnings if we are using gcc and the user did
20 # not specify CFLAGS. The autoconf check for the C compiler sets the
21 # CFLAGS if gcc is used, so we will save it before we run that check.
24 # Now find our C compiler.
27 # Suppress warnings about --datarootdir
28 AC_DEFUN([AC_DATAROOTDIR_CHECKED])
30 # If we have gcc, and AC_PROG_CC changed the flags, then we know the
31 # user did not specify any flags. Add warnings in this case.
32 if test "$GCC" = "yes"; then
33 if test "$CFLAGS" != "$SAVE_CFLAGS"; then
34 STD_CWARNINGS="$STD_CWARNINGS -Wall -Werror -fno-strict-aliasing"
38 # We can have some flags to pass to bind configure
40 if test "$cross_compiling" = "yes"; then
41 BINDCONFIG="--host=$host"
43 # Pass CFLAGS and co. $ac_configure_args looks like "'arg1' 'arg2' ..."
44 # and as there can be a space inside an argument some magic is required.
45 # This sets $1 ... $N to my_configure_args, arg1 ... argN
46 eval "set my_configure_args $ac_configure_args"
47 # remove my_configure_args, i.e., the guard against empty $ac_configure_args
49 # iterate on arguments and copying 'arg' when it begins by an upper case
53 [[A-Z]]*) BINDCONFIG="$BINDCONFIG '$a'" ;;
58 # POSIX doesn't include the IPv6 Advanced Socket API and glibc hides
59 # parts of the IPv6 Advanced Socket API as a result. This is stupid
60 # as it breaks how the two halves (Basic and Advanced) of the IPv6
61 # Socket API were designed to be used but we have to live with it.
62 # Use this to define _GNU_SOURCE to pull in the IPv6 Advanced Socket API.
63 AC_USE_SYSTEM_EXTENSIONS
69 if test "X$AR" = "X"; then
71 ar program not found. Please fix your PATH to include the directory in
72 which ar resides, or set AR in the environment with the full path to ar.])
75 AC_CONFIG_HEADERS([includes/config.h])
77 # we sometimes need to know byte order for building packets
78 AC_C_BIGENDIAN(AC_SUBST(byte_order, BIG_ENDIAN),
79 AC_SUBST(byte_order, LITTLE_ENDIAN))
80 AC_DEFINE_UNQUOTED([DHCP_BYTE_ORDER], [$byte_order],
81 [Define to BIG_ENDIAN for MSB (Motorola or SPARC CPUs)
82 or LITTLE_ENDIAN for LSB (Intel CPUs).])
84 # Optional compile-time DEBUGging.
86 AS_HELP_STRING([--enable-debug],[create a debug-only version of the software (default is no).]),
87 [case "${enableval}" in
89 AC_DEFINE([DEBUG], [1],
90 [Define to compile debug-only DHCP software.])
91 # Just override CFLAGS totally to remove optimization.
93 no) enable_debug=no ;;
94 *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
95 esac],[enable_debug=no])
97 # XXX: there are actually quite a lot more DEBUG_ features we could enable,
98 # but I don't want to pollute the --help space.
100 #/* #define DEBUG_TOKENS */
101 #/* #define DEBUG_PACKET */
102 #/* #define DEBUG_EXPRESSIONS */
103 #/* #define DEBUG_FIND_LEASE */
104 #/* #define DEBUG_EXPRESSION_PARSE */
105 #/* #define DEBUG_CLASS_MATCHING */
106 #/* #define DEBUG_MEMORY_LEAKAGE */
107 #/* #define DEBUG_MALLOC_POOL */
108 #/* #define DEBUG_LEASE_STATE_TRANSITIONS */
109 #/* #define DEBUG_RC_HISTORY */
110 #/* #define DEBUG_RC_HISTORY_EXHAUSTIVELY */
111 #/* #define RC_HISTORY_MAX 10240 */
112 #/* #define POINTER_DEBUG */
113 #/* #define DEBUG_FAILOVER_MESSAGES */
114 #/* #define DEBUG_FAILOVER_TIMING */
115 #/* #define DEBUG_DUMP_ALL_LEASES */
117 # Failover optional compile-time feature.
118 AC_ARG_ENABLE(failover,
119 AS_HELP_STRING([--enable-failover],[enable support for failover (default is yes)]))
120 # Failover is on by default, so define if it is not explicitly disabled.
121 if test "$enable_failover" != "no"; then
122 enable_failover="yes"
123 AC_DEFINE([FAILOVER_PROTOCOL], [1],
124 [Define to include Failover Protocol support.])
128 AC_ARG_ENABLE(execute,
129 AS_HELP_STRING([--enable-execute],[enable support for execute() in config (default is yes)]))
130 # execute() is on by default, so define if it is not explicitly disabled.
131 if test "$enable_execute" != "no" ; then
133 AC_DEFINE([ENABLE_EXECUTE], [1],
134 [Define to include execute() config language support.])
137 # Server tracing support.
138 AC_ARG_ENABLE(tracing,
139 AS_HELP_STRING([--enable-tracing],[enable support for server activity tracing (default is yes)]))
140 # tracing is on by default, so define if it is not explicitly disabled.
141 if test "$enable_tracing" != "no" ; then
142 AC_DEFINE([TRACING], [1],
143 [Define to include server activity tracing support.])
146 # Delayed-ack feature support.
147 AC_ARG_ENABLE(delayed_ack,
148 AS_HELP_STRING([--enable-delayed-ack],[queues multiple DHCPACK replies (default is yes)]))
149 if test "$enable_delayed_ack" != "no"; then
150 enable_delayed_ack="yes"
151 AC_DEFINE([DELAYED_ACK], [1],
152 [Define to queue multiple DHCPACK replies per fsync.])
155 # DHCPv6 optional compile-time feature.
156 AC_ARG_ENABLE(dhcpv6,
157 AS_HELP_STRING([--enable-dhcpv6],[enable support for DHCPv6 (default is yes)]))
158 # DHCPv6 is on by default, so define if it is not explicitly disabled.
159 if test "$enable_dhcpv6" != "no"; then
161 AC_DEFINE([DHCPv6], [1],
162 [Define to 1 to include DHCPv6 support.])
165 # DHCPv4o6 optional compile-time feature.
166 AC_ARG_ENABLE(dhcpv4o6,
167 AS_HELP_STRING([--enable-dhcpv4o6],[enable support for DHCPv4-over-DHCPv6 (default is no)]))
168 # DHCPv4o6 is off by default, so define if it is explicitly enabled.
169 if test "$enable_dhcpv4o6" = "yes"; then
170 # DHCPv4o6 requires DHCPv6
171 if test "$enable_dhcpv6" = "no"; then
172 AC_MSG_ERROR([dhcpv4o6 requires dhcpv6])
174 AC_DEFINE([DHCP4o6], [1],
175 [Define to 1 to include DHCPv4 over DHCPv6 support.])
177 # so we can report below
181 # PARANOIA is off by default (until we can test it with all features)
182 AC_ARG_ENABLE(paranoia,
183 AS_HELP_STRING([--enable-paranoia],[enable support for chroot/setuid (default is no)]))
184 AC_ARG_ENABLE(early_chroot,
185 AS_HELP_STRING([--enable-early-chroot],[enable chrooting prior to configuration (default is no)]))
186 # If someone enables early chroot, but does not enable paranoia, do so for
188 if test "$enable_paranoia" != "yes" && \
189 test "$enable_early_chroot" = "yes" ; then
190 enable_paranoia="yes"
193 if test "$enable_paranoia" = "yes" ; then
194 AC_DEFINE([PARANOIA], [1],
195 [Define to any value to include Ari's PARANOIA patch.])
197 if test "$enable_early_chroot" = "yes" ; then
198 AC_DEFINE([EARLY_CHROOT], [1],
199 [Define to any value to chroot() prior to loading config.])
202 AC_ARG_ENABLE(ipv4_pktinfo,
203 AS_HELP_STRING([--enable-ipv4-pktinfo],[enable use of pktinfo on IPv4 sockets (default is no)]))
205 if test "$enable_ipv4_pktinfo" = "yes"; then
206 AC_DEFINE([USE_V4_PKTINFO], [1],
207 [Define to 1 to enable IPv4 packet info support.])
210 AC_ARG_ENABLE(use_sockets,
211 AS_HELP_STRING([--enable-use-sockets],[use the standard BSD socket API (default is no)]))
213 if test "$enable_use_sockets" = "yes"; then
214 AC_DEFINE([USE_SOCKETS], [1],
215 [Define to 1 to use the standard BSD socket API.])
218 # Include the PID in the log messages. This is useful when there may
219 # be multiple instances of a program.
220 # This is off by default
221 AC_ARG_ENABLE(log_pid,
222 AS_HELP_STRING([--enable-log-pid],[Include PIDs in syslog messages (default is no).]))
223 if test "$enable_log_pid" = "yes" ; then
224 AC_DEFINE([USE_LOG_PID], [1],
225 [Define to include PIDs in syslog messages.])
228 # Allow for binary search when inserting v4 leases into queues
229 AC_ARG_ENABLE(binary_leases,
230 AS_HELP_STRING([--enable-binary-leases],[enable support for binary insertion of leases (default is no)]))
231 # binary_leases is off by default.
232 if test "$enable_binary_leases" = "yes"; then
233 AC_DEFINE([BINARY_LEASES], [1],
234 [Define to support binary insertion of leases into queues.])
236 enable_binary_leases="no"
241 DISTCHECK_ATF_CONFIGURE_FLAG=
244 AS_HELP_STRING([--with-atf=PATH],[specify location where atf was installed (or "bind")]),
245 [atf_path="$withval"])
246 AM_CONDITIONAL(BIND_ATF, test "$atf_path" = "bind")
247 if test "$atf_path" = "bind" ; then
248 DISTCHECK_ATF_CONFIGURE_FLAG="--with-atf=bind"
250 atf_path="\${top_srcdir}/bind/atf"
251 ATF_CFLAGS="-I$atf_path/include -DUNIT_TEST"
252 ATF_LDFLAGS="-L$atf_path/lib -latf-c"
253 ATF_BIN=`cd $srcdir; pwd`/bind/atf/bin
255 AC_SUBST(ATF_LDFLAGS)
257 BINDCONFIG="$BINDCONFIG --with-atf"
258 elif test "$atf_path" != "no" ; then
259 DISTCHECK_ATF_CONFIGURE_FLAG="--with-atf=$atf_path"
260 # Config path for pkg-config
262 if test "$atf_path" != "yes" ; then
263 if test -f $atf_path/lib/pkgconfig/atf-c.pc ; then
264 atf_pcp=$atf_path/lib/pkgconfig
265 elif test -f $atf_path/lib64/pkgconfig/atf-c.pc ; then
266 atf_pcp=$atf_path/lib64/pkgconfig
269 # Not specified, try some common paths
270 atf_dirs="/usr /usr/local /usr/pkg /opt /opt/local"
273 if test -f $d/lib/pkgconfig/atf-c.pc ; then
274 atf_pcp=$d/lib/pkgconfig
276 elif test -f $d/lib64/pkgconfig/atf-c.pc ; then
277 atf_pcp=$d/lib64/pkgconfig
283 if test "$atf_pcp" = "" ; then
284 AC_MSG_ERROR([Unable to find atf files in location specified])
286 AC_CHECK_PROG([pkgcfg_found],[pkg-config],[pkg-config],[])
287 if test "$pkgcfg_found" = ""; then
288 AC_MSG_ERROR([Could not locate ATF, pkg-config not installed])
290 ATF_CFLAGS="`PKG_CONFIG_PATH=$atf_pcp pkg-config --cflags atf-c` -DUNIT_TEST"
291 ATF_LDFLAGS="`PKG_CONFIG_PATH=$atf_pcp pkg-config --libs atf-c`"
292 if test -f $atf_pcp/atf-sh.pc ; then
293 ATF_BIN="`PKG_CONFIG_PATH=$atf_pcp pkg-config --variable=exec_prefix atf-sh`/bin"
295 # older versions don't have atf-sh, try usual place
296 ATF_BIN=$atf_path/bin
299 if test ! -x $ATF_BIN/atf-run -o ! -x $ATF_BIN/atf-report ; then
300 AC_MSG_WARN([atf-run/atf-report not found, assuming they are in your path])
304 AC_SUBST(ATF_LDFLAGS)
309 AM_CONDITIONAL(HAVE_ATF, test "$atf_pcp" != "")
310 AM_COND_IF([HAVE_ATF], [AC_DEFINE([HAVE_ATF], [1], [ATF framework specified?])])
311 AC_SUBST(DISTCHECK_ATF_CONFIGURE_FLAG)
314 ### Path fun. Older versions of DHCP were installed in /usr/sbin, so we
315 ### need to look there and potentially overwrite by default (but not if
316 ### the user configures an alternate value). LOCALSTATEDIR is totally
317 ### braindead. No one uses /usr/local/var/db/ nor /usr/local/var/run, and
318 ### they would be insane for suggesting it. We need to look in /var/for
319 ### 'db' and 'state/dhcp' for db files, and /var/run for pid files by
322 AC_PREFIX_PROGRAM(dhcpd)
324 # XXX - isn't there SOME WAY to default autoconf to /var instead of
325 # /usr/local/var/no/one/has/this/please/stop/trying?
326 case "$localstatedir" in
332 # Default server configuration file.
333 AC_ARG_WITH(srv-conf-file,
334 AS_HELP_STRING([--with-srv-conf-file=PATH],[Default file containing dhcpd configuration
335 (default is typically /etc/dhcpd.conf)]),
336 AC_DEFINE_UNQUOTED([_PATH_DHCPD_CONF], ["$withval"],
337 [Default file containing dhcpd configuration.]))
339 # Allow specification of alternate state files
340 AC_ARG_WITH(srv-lease-file,
341 AS_HELP_STRING([--with-srv-lease-file=PATH],[File for dhcpd leases
342 (default is LOCALSTATEDIR/db/dhcpd.leases)]),
343 AC_DEFINE_UNQUOTED([_PATH_DHCPD_DB], ["$withval"],
344 [File for dhcpd leases.]))
346 AC_MSG_CHECKING([for dhcpd.leases location])
347 if [[ "x$with_srv_lease_file" = "x" ]] ; then
348 if [[ -d "${localstatedir}/db" ]] ; then
349 with_srv_lease_file="${localstatedir}/db/dhcpd.leases"
350 elif [[ -d "${localstatedir}/state" ]] ; then
351 if [[ -d "${localstatedir}/state/dhcp" ]] ; then
352 with_srv_lease_file="${localstatedir}/state/dhcp/dhcpd.leases"
354 with_srv_lease_file="${localstatedir}/state/dhcpd.leases"
356 elif [[ -d "${localstatedir}/lib" ]] ; then
357 if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
358 with_srv_lease_file="${localstatedir}/lib/dhcp/dhcpd.leases"
360 with_srv_lease_file="${localstatedir}/lib/dhcpd.leases"
362 elif [[ -d "${localstatedir}/etc" ]] ; then
363 with_srv_lease_file="${localstatedir}/etc/dhcpd.leases"
365 with_srv_lease_file="/etc/dhcpd.leases"
368 AC_MSG_RESULT($with_srv_lease_file)
370 AC_ARG_WITH(srv6-lease-file,
371 AS_HELP_STRING([--with-srv6-lease-file=PATH],[File for dhcpd6 leases
372 (default is LOCALSTATEDIR/db/dhcpd6.leases)]),
373 AC_DEFINE_UNQUOTED([_PATH_DHCPD6_DB], ["$withval"],
374 [File for dhcpd6 leases.]))
376 AC_MSG_CHECKING([for dhcpd6.leases location])
377 if [[ "x$with_srv6_lease_file" = "x" ]] ; then
378 if [[ -d "${localstatedir}/db" ]] ; then
379 with_srv6_lease_file="${localstatedir}/db/dhcpd6.leases"
380 elif [[ -d "${localstatedir}/state" ]] ; then
381 if [[ -d "${localstatedir}/state/dhcp" ]] ; then
382 with_srv6_lease_file="${localstatedir}/state/dhcp/dhcpd6.leases"
384 with_srv6_lease_file="${localstatedir}/state/dhcpd6.leases"
386 elif [[ -d "${localstatedir}/lib" ]] ; then
387 if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
388 with_srv6_lease_file="${localstatedir}/lib/dhcp/dhcpd6.leases"
390 with_srv6_lease_file="${localstatedir}/lib/dhcpd6.leases"
392 elif [[ -d "${localstatedir}/etc" ]] ; then
393 with_srv6_lease_file="${localstatedir}/etc/dhcpd6.leases"
395 with_srv6_lease_file="/etc/dhcpd6.leases"
398 AC_MSG_RESULT($with_srv6_lease_file)
400 AC_ARG_WITH(cli-lease-file,
401 AS_HELP_STRING([--with-cli-lease-file=PATH],[File for dhclient leases
402 (default is LOCALSTATEDIR/db/dhclient.leases)]),
403 AC_DEFINE_UNQUOTED([_PATH_DHCLIENT_DB], ["$withval"],
404 [File for dhclient leases.]))
406 AC_MSG_CHECKING([for dhclient.leases location])
407 if [[ "x$with_cli_lease_file" = "x" ]] ; then
408 if [[ -d "${localstatedir}/db" ]] ; then
409 with_cli_lease_file="${localstatedir}/db/dhclient.leases"
410 elif [[ -d "${localstatedir}/state" ]] ; then
411 if [[ -d "${localstatedir}/state/dhcp" ]] ; then
412 with_cli_lease_file="${localstatedir}/state/dhcp/dhclient.leases"
414 with_cli_lease_file="${localstatedir}/state/dhclient.leases"
416 elif [[ -d "${localstatedir}/lib" ]] ; then
417 if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
418 with_cli_lease_file="${localstatedir}/lib/dhcp/dhclient.leases"
420 with_cli_lease_file="${localstatedir}/lib/dhclient.leases"
422 elif [[ -d "${localstatedir}/etc" ]] ; then
423 with_cli_lease_file="${localstatedir}/etc/dhclient.leases"
425 with_cli_lease_file="/etc/dhclient.leases"
428 AC_MSG_RESULT($with_cli_lease_file)
430 AC_ARG_WITH(cli6-lease-file,
431 AS_HELP_STRING([--with-cli6-lease-file=PATH],[File for dhclient6 leases
432 (default is LOCALSTATEDIR/db/dhclient6.leases)]),
433 AC_DEFINE_UNQUOTED([_PATH_DHCLIENT6_DB], ["$withval"],
434 [File for dhclient6 leases.]))
436 AC_MSG_CHECKING([for dhclient6.leases location])
437 if [[ "x$with_cli6_lease_file" = "x" ]] ; then
438 if [[ -d "${localstatedir}/db" ]] ; then
439 with_cli6_lease_file="${localstatedir}/db/dhclient6.leases"
440 elif [[ -d "${localstatedir}/state" ]] ; then
441 if [[ -d "${localstatedir}/state/dhcp" ]] ; then
442 with_cli6_lease_file="${localstatedir}/state/dhcp/dhclient6.leases"
444 with_cli6_lease_file="${localstatedir}/state/dhclient6.leases"
446 elif [[ -d "${localstatedir}/lib" ]] ; then
447 if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
448 with_cli6_lease_file="${localstatedir}/lib/dhcp/dhclient6.leases"
450 with_cli6_lease_file="${localstatedir}/lib/dhclient6.leases"
452 elif [[ -d "${localstatedir}/etc" ]] ; then
453 with_cli6_lease_file="${localstatedir}/etc/dhclient6.leases"
455 with_cli6_lease_file="/etc/dhclient6.leases"
458 AC_MSG_RESULT($with_cli6_lease_file)
460 AC_ARG_WITH(srv-pid-file,
461 AS_HELP_STRING([--with-srv-pid-file=PATH],[File for dhcpd process information
462 (default is LOCALSTATEDIR/run/dhcpd.pid)]),
463 AC_DEFINE_UNQUOTED([_PATH_DHCPD_PID], ["$withval"],
464 [File for dhcpd process information.]))
465 AC_ARG_WITH(srv6-pid-file,
466 AS_HELP_STRING([--with-srv6-pid-file=PATH],[File for dhcpd6 process information
467 (default is LOCALSTATEDIR/run/dhcpd6.pid)]),
468 AC_DEFINE_UNQUOTED([_PATH_DHCPD6_PID], ["$withval"],
469 [File for dhcpd6 process information.]))
470 AC_ARG_WITH(cli-pid-file,
471 AS_HELP_STRING([--with-cli-pid-file=PATH],[File for dhclient process information
472 (default is LOCALSTATEDIR/run/dhclient.pid)]),
473 AC_DEFINE_UNQUOTED([_PATH_DHCLIENT_PID], ["$withval"],
474 [File for dhclient process information.]))
475 AC_ARG_WITH(cli6-pid-file,
476 AS_HELP_STRING([--with-cli6-pid-file=PATH],[File for dhclient6 process information
477 (default is LOCALSTATEDIR/run/dhclient6.pid)]),
478 AC_DEFINE_UNQUOTED([_PATH_DHCLIENT6_PID], ["$withval"],
479 [File for dhclient6 process information.]))
480 AC_ARG_WITH(relay-pid-file,
481 AS_HELP_STRING([--with-relay-pid-file=PATH],[File for dhcrelay process information
482 (default is LOCALSTATEDIR/run/dhcrelay.pid)]),
483 AC_DEFINE_UNQUOTED([_PATH_DHCRELAY_PID], ["$withval"],
484 [File for dhcrelay process information.]))
485 AC_ARG_WITH(relay6-pid-file,
486 AS_HELP_STRING([--with-relay6-pid-file=PATH],[File for dhcrelay6 process information
487 (default is LOCALSTATEDIR/run/dhcrelay6.pid)]),
488 AC_DEFINE_UNQUOTED([_PATH_DHCRELAY6_PID], ["$withval"],
489 [File for dhcrelay6 process information.]))
497 # Some systems need the u_intX_t types defined across.
498 AC_CHECK_TYPE([u_int8_t], [], [
500 AC_DEFINE(u_int8_t, [uint8_t], [Define a type for 8-bit unsigned
503 AC_CHECK_TYPE([u_int16_t], [], [
505 AC_DEFINE(u_int16_t, [uint16_t], [Define a type for 16-bit unsigned
508 AC_CHECK_TYPE([u_int32_t], [], [
510 AC_DEFINE(u_int32_t, [uint32_t], [Define a type for 32-bit unsigned
513 AC_CHECK_TYPE([u_int64_t], [], [
515 AC_DEFINE(u_int64_t, [uint64_t], [Define a type for 64-bit unsigned
519 # see if ifaddrs.h is available
520 AC_CHECK_HEADERS(ifaddrs.h)
522 # figure out what IPv4 interface code to use
523 AC_CHECK_HEADERS(linux/types.h) # needed for linux/filter.h on old systems
525 AC_CHECK_HEADER(linux/filter.h, DO_LPF=1, ,
527 #ifdef HAVE_LINUX_TYPES_H
528 #include <linux/types.h>
533 AC_DEFINE([HAVE_LPF], [1],
534 [Define to 1 to use the Linux Packet Filter interface code.])
536 AC_CHECK_HEADER(sys/dlpi.h, DO_DLPI=1)
537 if test -n "$DO_DLPI"
539 AC_DEFINE([HAVE_DLPI], [1],
540 [Define to 1 to use DLPI interface code.])
542 AC_CHECK_HEADER(net/bpf.h, DO_BPF=1)
545 AC_DEFINE([HAVE_BPF], [1],
546 [Define to 1 to use the
547 Berkeley Packet Filter interface code.])
552 # SIOCGLIFCONF uses some transport structures. Trick is not all platforms
553 # use the same structures. We like to use 'struct lifconf' and 'struct
554 # lifreq', but we'll use these other structures if they're present. HPUX
555 # does not define 'struct lifnum', but does use SIOCGLIFNUM - they use an
558 AC_MSG_CHECKING([for struct lifnum])
559 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h>
560 #include <sys/socket.h>
562 ]], [[ struct lifnum a;
563 ]])],[AC_MSG_RESULT(yes)
564 AC_DEFINE([ISC_PLATFORM_HAVELIFNUM], [1],
565 [Define to 1 if the system has 'struct lifnum'.])],[AC_MSG_RESULT(no)])
567 AC_MSG_CHECKING([for struct if_laddrconf])
568 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h>
570 ]], [[ struct if_laddrconf a;
571 ]])],[AC_MSG_RESULT(yes)
572 AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRCONF], [1],
573 [Define to 1 if the system has 'struct if_laddrconf'.])],[AC_MSG_RESULT(no)])
575 AC_MSG_CHECKING([for struct if_laddrreq])
576 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
578 ]], [[ struct if_laddrreq a;
579 ]])],[AC_MSG_RESULT(yes)
580 AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRREQ], [1],
581 [Define to 1 if the system has 'struct if_laddrreq'.])],[AC_MSG_RESULT(no)])
584 # check for GCC noreturn attribute
586 AC_MSG_CHECKING(for GCC noreturn attribute)
587 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[void foo() __attribute__((noreturn));]])],[AC_MSG_RESULT(yes)
588 AC_DEFINE([ISC_DHCP_NORETURN], [__attribute__((noreturn))],
589 [Define to the string for a noreturn attribute.])],[AC_MSG_RESULT(no)
590 AC_DEFINE([ISC_DHCP_NORETURN], [],
591 [Define to the string for a noreturn attribute.])])
593 # Look for optional headers.
594 AC_CHECK_HEADERS(sys/socket.h net/if_dl.h net/if6.h regex.h)
596 # Solaris needs some libraries for functions
597 AC_SEARCH_LIBS(socket, [socket])
598 AC_SEARCH_LIBS(inet_ntoa, [nsl])
600 AC_SEARCH_LIBS(inet_aton, [socket nsl], ,
601 AC_DEFINE([NEED_INET_ATON], [1],
602 [Define to 1 if the inet_aton() function is missing.]))
604 # Check for a standalone regex library.
605 AC_SEARCH_LIBS(regcomp, [regex])
607 AC_CHECK_FUNCS(strlcat)
609 # For HP/UX we need -lipv6 for if_nametoindex, perhaps others.
610 AC_SEARCH_LIBS(if_nametoindex, [ipv6])
612 # For some Solaris nanosleep is found by BIND in librt
614 AC_CHECK_FUNC(nanosleep, have_nanosleep="yes")
615 if test "$have_nanosleep" = "no"; then
616 AC_CHECK_LIB(rt, nanosleep, have_nanosleep="rt")
618 if test "$have_nanosleep" = "rt"; then
622 # check for /dev/random (declares HAVE_DEV_RANDOM)
623 AC_MSG_CHECKING(for random device)
624 AC_ARG_WITH(randomdev,
625 AS_HELP_STRING([--with-randomdev=PATH],[Path for random device
626 (default is /dev/random)]),
627 use_randomdev="$withval", use_randomdev="unspec")
628 if test "$use_randomdev" = "unspec"; then
629 if test "$cross_compiling" = "yes"; then
630 AC_MSG_RESULT(unspecified)
631 AC_MSG_ERROR([ need --with-randomdev=PATH or --with-randomdev=no])
633 use_randomdev="/dev/random"
634 elif test "$use_randomdev" = "yes"; then
635 use_randomdev="/dev/random"
637 if test "$use_randomdev" = "no"; then
638 AC_MSG_RESULT(disabled)
639 BINDCONFIG="$BINDCONFIG --with-randomdev=no"
641 if test "$cross_compiling" = "yes"; then
642 AC_MSG_RESULT($use_randomdev (unchecked))
644 AC_MSG_RESULT($use_randomdev)
645 AC_CHECK_FILE($use_randomdev,
646 AC_DEFINE([HAVE_DEV_RANDOM], [1],
647 [Define to 1 if you have the /dev/random or other configured file.]),
648 AC_MSG_ERROR(cannot find $use_randomdev))
650 BINDCONFIG="$BINDCONFIG --with-randomdev=$use_randomdev"
653 BINDIOMUX="--disable-kqueue --disable-epoll --disable-devpoll"
654 # check kqueue/epoll/devpoll alternative to select
655 AC_ARG_ENABLE(kqueue,
656 AS_HELP_STRING([--enable-kqueue],[use BSD kqueue (default is no)]),
657 want_kqueue="$enableval", want_kqueue="no")
658 if test "$want_kqueue" = "yes"; then
659 BINDIOMUX="--enable-kqueue"
660 AC_MSG_WARN([--enable-kqueue is not supported: it may lead to issues such as server looping])
663 AS_HELP_STRING([--enable-epoll],[use Linux epoll (default is no)]),
664 want_epoll="$enableval", want_epoll="no")
665 if test "$want_epoll" = "yes"; then
666 BINDIOMUX="--enable-epoll"
667 AC_MSG_WARN([--enable-epoll is not supported: it may lead to issues such as server looping])
669 AC_ARG_ENABLE(devpoll,
670 AS_HELP_STRING([--enable-devpoll],[use /dev/poll (default is no)]),
671 want_devpoll="$enableval", want_devpoll="no")
672 if test "$want_devpoll" = "yes"; then
673 BINDIOMUX="--enable-devpoll"
674 AC_MSG_WARN([--enable-devpoll is not supported: it may lead to issues such as server looping])
678 # general extra bind configure arguments
679 AC_ARG_WITH(bind-extra-config,
680 AS_HELP_STRING([--with-bind-extra-config],[configure bind librairies
681 with some extra options (default is none)]),
682 use_xbindconfig="$withval", use_xbindconfig="")
683 case "$use_xbindconfig" in
687 BINDCONFIG="$BINDCONFIG $use_xbindconfig"
688 AC_MSG_WARN([Most options to bind configure are not supported when used by ISC DHCP])
692 # see if there is a "sa_len" field in our interface information structure
693 AC_CHECK_MEMBER(struct sockaddr.sa_len,
694 AC_DEFINE([HAVE_SA_LEN], [],
695 [Define to 1 if the sockaddr structure has a length field.]),
697 [#include <sys/socket.h>])
699 # figure out pointer size
700 SAVE_CFLAGS="$CFLAGS"
701 CFLAGS="$CFLAGS -I$srcdir"
702 AC_CHECK_SIZEOF(struct iaddr *, , [
703 #include "includes/inet.h"
706 CFLAGS="$SAVE_CFLAGS"
708 # Solaris does not have the msg_control or msg_controlen members
709 # in the msghdr structure unless you define:
711 # _XOPEN_SOURCE, _XOPEN_SOURCE_EXTENDED, and __EXTENSIONS__
713 # See the "standards" man page for details.
715 # We check for the msg_control member, and if it is not found, we check
716 # again with the appropriate defines added to the CFLAGS. (In order to
717 # do this we have to remove the check from the cache, which is what the
719 AC_CHECK_MEMBER(struct msghdr.msg_control,,
720 [CFLAGS="$CFLAGS -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
721 CFLAGS="$CFLAGS -D__EXTENSIONS__"
722 unset ac_cv_member_struct_msghdr_msg_control
723 AC_CHECK_MEMBER(struct msghdr.msg_control,,
724 [AC_MSG_ERROR([Missing msg_control member in
725 msg_control structure.])],
727 #include <sys/types.h>
728 #include <sys/socket.h>
732 #include <sys/types.h>
733 #include <sys/socket.h>
736 AC_CHECK_MEMBER(struct tpacket_auxdata.tp_vlan_tci,
737 [AC_DEFINE([VLAN_TCI_PRESENT], [1], [tpacket_auxdata.tp_vlan_tci present])]
738 ,, [#include <linux/if_packet.h>])
740 # bind/Makefile.in is not from automake so we need 2 variables for bind dir
748 DISTCHECK_LIBBIND_CONFIGURE_FLAG=
750 AS_HELP_STRING([--with-libbind=PATH],[bind includes and libraries are in PATH]),
751 use_libbind="$withval", use_libbind="no")
752 case "$use_libbind" in
754 AC_MSG_ERROR([PATH is required in --with-libbind=PATH])
757 BINDSUBDIR="\${top_srcdir}/bind"
758 my_abs_srcdir=`cd $srcdir && pwd`
759 BINDDIR="${my_abs_srcdir}/bind"
760 if test ! -d "$srcdir/bind"; then
761 AC_MSG_ERROR([Where to find or build bind includes and libraries must be specified])
763 if test -d "$srcdir/bind/bind9"; then
764 BINDSRCDIR="${my_abs_srcdir}/bind/bind9"
766 if test ! -f "$srcdir/bind/version.tmp"; then
767 AC_MSG_ERROR([Cannot find $srcdir/bind/version.tmp])
769 . "$srcdir/bind/version.tmp"
770 bindversion=${MAJORVER}.${MINORVER}.${PATCHVER}${RELEASETYPE}${RELEASEVER}
771 BINDSRCDIR="${my_abs_srcdir}/bind/bind-$bindversion"
773 AC_CONFIG_FILES([$srcdir/bind/Makefile])
775 BINDLIBIRSDIR="$BINDSRCDIR/lib/irs"
776 BINDLIBDNSDIR="$BINDSRCDIR/lib/dns"
777 BINDLIBISCCFGDIR="$BINDSRCDIR/lib/isccfg"
778 BINDLIBISCDIR="$BINDSRCDIR/lib/isc"
781 if test ! -d "$use_libbind"; then
782 AC_MSG_ERROR([Cannot find bind directory at $use_libbind])
784 if test ! -d "$use_libbind/include" -o \
785 ! -f "$use_libbind/include/isc/buffer.h"
787 AC_MSG_ERROR([Cannot find bind includes at $use_libbind/include])
789 if test ! -d "$use_libbind/lib" -o \
790 \( ! -f "$use_libbind/lib/libisc.a" -a \
791 ! -f "$use_libbind/lib/libisc.la" \)
793 AC_MSG_ERROR([Cannot find bind libraries at $use_libbind/lib])
795 BINDDIR="$use_libbind"
796 BINDLIBIRSDIR="$BINDDIR/lib"
797 BINDLIBDNSDIR="$BINDDIR/lib"
798 BINDLIBISCCFGDIR="$BINDDIR/lib"
799 BINDLIBISCDIR="$BINDDIR/lib"
800 DISTCHECK_LIBBIND_CONFIGURE_FLAG="--with-libbind=$use_libbind"
806 AC_SUBST(BINDLIBIRSDIR)
807 AC_SUBST(BINDLIBDNSDIR)
808 AC_SUBST(BINDLIBISCCFGDIR)
809 AC_SUBST(BINDLIBISCDIR)
810 AC_SUBST(DISTCHECK_LIBBIND_CONFIGURE_FLAG)
811 AM_CONDITIONAL(HAVE_BINDDIR, test "$use_libbind" = "no")
814 # GNU libtool support
818 # Just set the maximum command line length for sunos
819 # as it otherwise takes a exceptionally long time to
820 # work it out. Required for libtool.
822 lt_cv_sys_max_cmd_len=4096
831 DISTCHECK_LIBTOOL_CONFIGURE_FLAG=
832 AC_ARG_ENABLE(libtool,
833 AS_HELP_STRING([--enable-libtool],
834 [use GNU libtool for dynamic shared libraries (default is yes).]),
835 want_libtool="$enableval")
837 if test "$use_libbind" != "no"; then
838 if test "$want_libtool" = "yes" -a \
839 ! -f "$use_libbind/lib/libisc.la"
841 AC_MSG_ERROR([Cannot find dynamic libraries at $use_libbind/lib])
843 if test "$want_libtool" = "no" -a \
844 ! -f "$use_libbind/lib/libisc.a"
846 AC_MSG_ERROR([Cannot find static libraries at $use_libbind/lib])
850 if test "$want_libtool" = "no"; then
851 AC_MSG_ERROR([libtool configure is used but libtool is disabled?])
856 BINDLT="--with-libtool --disable-symtable"
857 # BIND does not provide uninstall
858 DISTCHECK_LIBTOOL_CONFIGURE_FLAG="--enable-libtool --disable-bind-install"
864 AC_SUBST(DISTCHECK_LIBTOOL_CONFIGURE_FLAG)
866 # quoting in Makefile.am.in
870 # install bind includes and libraries
872 want_install_bind="no"
873 want_install_bind="yes"
874 if test "$want_libtool" = "yes"; then
875 want_install_bind="yes"
877 if test "$use_libbind" != "no"; then
878 want_install_bind="no"
880 AC_ARG_ENABLE(bind_install,
881 AS_HELP_STRING([--enable-bind-install],
882 [install bind includes and libraries.]),
883 want_install_bind="$enableval")
884 if test "$want_install_bind" = "yes"; then
885 if test "$use_libbind" != "no"; then
886 AC_MSG_WARN([--enable-bind-install does nothing when --with-libbind is set])
888 elif test "$want_libtool" = "yes" -a "$use_libbind" = "no"; then
889 AC_MSG_WARN([embedded dynamic bind libraries must be installed])
891 AM_CONDITIONAL(INSTALL_BIND, test "$want_install_bind" = "yes")
895 AS_HELP_STRING([--with-ldap],[enable OpenLDAP support in dhcpd (default is no)]),
899 # OpenLDAP with SSL support.
900 AC_ARG_WITH(ldapcrypto,
901 AS_HELP_STRING([--with-ldapcrypto],[enable OpenLDAP crypto support in dhcpd (default is no)]),
902 [ldapcrypto=$withval],
905 # Gssapi to allow LDAP to authenticate with a keytab
906 AC_ARG_WITH(ldap-gssapi,
907 AC_HELP_STRING([--with-ldap-gssapi],
908 [enable krb5/gssapi authentication for OpenLDAP in dhcpd (default is no)]),
909 [ldap_gssapi=$withval],
913 # LDAP CASA auth support.
914 AC_ARG_WITH(ldapcasa,
915 AC_HELP_STRING([--with-ldapcasa],
916 [enable LDAP CASA auth support in dhcpd (default is no)]),
920 # OpenLDAP support is disabled by default, if enabled then SSL support is an
921 # extra optional that is also disabled by default. Enabling LDAP SSL support
922 # implies enabling LDAP support. Similarly, KRB5 support implies LDAP support,
923 # but doesn't include SSL. The two are not dependant.
924 if test x$ldap = xyes || test x$ldapcrypto = xyes || test x$ldap_gssapi = xyes; then
927 AC_SEARCH_LIBS(ldap_initialize, [ldap], ,
928 AC_MSG_FAILURE([*** Cannot find ldap_initialize with -lldap - do you need to install an OpenLDAP2 Devel package?]))
929 AC_SEARCH_LIBS(ber_pvt_opt_on, [lber], ,
930 AC_MSG_FAILURE([*** Cannot find ber_pvt_opt_on with -llber - do you need to install an OpenLDAP2 Devel package?]))
931 if test x$ldap_gssapi = xyes ; then
932 AC_SEARCH_LIBS(krb5_init_context, [krb5], ,
933 AC_MSG_FAILURE([*** Cannot find krb5_init_context with -lkrb5 - do you need to install a Kerberos Devel package?]))
936 # Create LDAP_LIBS which we specify them explicitly rather than lumping them in with LIBS
937 AC_SUBST(LDAP_LIBS, [$LIBS])
941 AC_CHECK_HEADERS([ldap.h])
942 AC_CHECK_FUNCS([inet_pton inet_ntop])
945 LDAP_CFLAGS="-DLDAP_CONFIGURATION"
947 if test x$ldapcasa = xyes ; then
948 AC_CHECK_HEADERS([micasa_mgmd.h],[
949 LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_CASA_AUTH"
950 ], AC_MSG_FAILURE([*** Cannot find micasa_mgmd.h for ldap casa auth support]))
953 if test x$ldapcrypto = xyes ; then
954 LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_USE_SSL"
957 if test x$ldap_gssapi = xyes; then
958 LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_USE_GSSAPI"
961 AC_SUBST(LDAP_CFLAGS, [$LDAP_CFLAGS])
964 # Append selected warning levels to CFLAGS before substitution (but after
965 # AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[]) & etc).
966 CFLAGS="$CFLAGS $STD_CWARNINGS"
968 # Try to add the bind and dhcp include directories
969 CFLAGS="$CFLAGS -I\$(top_srcdir)/includes -I$BINDDIR/include"
973 CFLAGS="$CFLAGS -D__APPLE_USE_RFC_3542";;
975 # As of Solaris 11, ethernet dev files are in /dev/net
976 AC_CHECK_FILE(/dev/net,
977 [AC_DEFINE([USE_DEV_NET], [1],
978 [Define to 1 if ethernet devices are in /dev/net])])
982 AC_C_FLEXIBLE_ARRAY_MEMBER
987 client/tests/Makefile
990 common/tests/Makefile
1001 server/tests/Makefile
1006 AC_MSG_NOTICE([postconfig: run automake in $srcdir])
1007 (cd $srcdir; automake)
1008 AC_MSG_NOTICE([postconfig: rerun config.status])
1011 if test "$enable_dhcpv4o6" = "yes"; then
1012 DHCP_VERSIONS="DHCPv4, DHCPv6 and DHCPv4-over-DHCPv6"
1013 elif test "$enable_dhcpv6" != "no"; then
1014 DHCP_VERSIONS="DHCPv4 and DHCPv6"
1016 DHCP_VERSIONS="DHCPv4"
1019 cat > config.report << END
1021 ISC DHCP source configure results:
1022 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1026 Version: $PACKAGE_VERSION
1034 DHCP versions: $DHCP_VERSIONS
1037 debug: $enable_debug
1038 failover: $enable_failover
1039 execute: $enable_execute
1040 binary-leases: $enable_binary_leases
1041 dhcpv6: $enable_dhcpv6
1042 delayed-ack: $enable_delayed_ack
1043 dhcpv4o6: $enable_dhcpv4o6
1046 ATF unittests : $atf_path
1049 # TODO: Add Perl system tests
1051 if test "$atf_path" != "no"
1053 echo "ATF_CFLAGS : $ATF_CFLAGS" >> config.report
1054 echo "ATF_LDFLAGS : $ATF_LDFLAGS" >> config.report
1055 echo "ATF_BIN : $ATF_BIN" >> config.report
1062 echo Now you can type "make" to build ISC DHCP