]> git.ipfire.org Git - thirdparty/dhcp.git/blame - configure.ac-base
Libtoolize build chain (unfinished)
[thirdparty/dhcp.git] / configure.ac-base
CommitLineData
13e5cc6c
FD
1AC_INIT([DHCP],[4.4.0-dev],[dhcp-users@isc.org])
2
3@BEGIN WITH LIBTOOL
4# for libtool
5AC_CONFIG_MACRO_DIR([m4])
6@END WITH LIBTOOL
7
8# we specify "foreign" to avoid having to have the GNU mandated files,
9# like AUTHORS, COPYING, and such
10AM_INIT_AUTOMAKE([foreign subdir-objects])
11
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.
17AM_MAINTAINER_MODE
18
19AC_CANONICAL_HOST
20
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.
24SAVE_CFLAGS="$CFLAGS"
25
26# Now find our C compiler.
27AC_PROG_CC
28
29# Suppress warnings about --datarootdir
30AC_DEFUN([AC_DATAROOTDIR_CHECKED])
31
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.
34if test "$GCC" = "yes"; then
35 if test "$CFLAGS" != "$SAVE_CFLAGS"; then
36 STD_CWARNINGS="$STD_CWARNINGS -Wall -Werror -fno-strict-aliasing"
37 fi
38fi
39
40# We can have some flags to pass to bind configure
41BINDCONFIG=
42if test "$cross_compiling" = "yes"; then
43 BINDCONFIG="--host=$host"
44fi
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
48eval "set my_configure_args $ac_configure_args"
49# remove my_configure_args, i.e., the guard against empty $ac_configure_args
50shift
51# iterate on arguments and copying 'arg' when it begins by an upper case
52for a
53do
54 case $a in
55 [[A-Z]]*) BINDCONFIG="$BINDCONFIG '$a'" ;;
56 esac
57done
58AC_SUBST(BINDCONFIG)
59
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.
65AC_USE_SYSTEM_EXTENSIONS
66
67AC_PROG_RANLIB
68
69AC_PATH_PROG(AR, ar)
70AC_SUBST(AR)
71
72if test "X$AR" = "X"; then
73 AC_MSG_ERROR([
74ar program not found. Please fix your PATH to include the directory in
75which ar resides, or set AR in the environment with the full path to ar.])
76fi
77
78AC_CONFIG_HEADERS([includes/config.h])
79
80# we sometimes need to know byte order for building packets
81AC_C_BIGENDIAN(AC_SUBST(byte_order, BIG_ENDIAN),
82 AC_SUBST(byte_order, LITTLE_ENDIAN))
83AC_DEFINE_UNQUOTED([DHCP_BYTE_ORDER], [$byte_order],
84 [Define to BIG_ENDIAN for MSB (Motorola or SPARC CPUs)
85 or LITTLE_ENDIAN for LSB (Intel CPUs).])
86
87# Optional compile-time DEBUGging.
88AC_ARG_ENABLE(debug,
89 AS_HELP_STRING([--enable-debug],[create a debug-only version of the software (default is no).]),
90 [case "${enableval}" in
91 yes) enable_debug=yes
92 AC_DEFINE([DEBUG], [1],
93 [Define to compile debug-only DHCP software.])
94 # Just override CFLAGS totally to remove optimization.
95 CFLAGS="-g";;
96 no) enable_debug=no ;;
97 *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
98 esac],[enable_debug=no])
99
100# XXX: there are actually quite a lot more DEBUG_ features we could enable,
101# but I don't want to pollute the --help space.
102#
103#/* #define DEBUG_TOKENS */
104#/* #define DEBUG_PACKET */
105#/* #define DEBUG_EXPRESSIONS */
106#/* #define DEBUG_FIND_LEASE */
107#/* #define DEBUG_EXPRESSION_PARSE */
108#/* #define DEBUG_CLASS_MATCHING */
109#/* #define DEBUG_MEMORY_LEAKAGE */
110#/* #define DEBUG_MALLOC_POOL */
111#/* #define DEBUG_LEASE_STATE_TRANSITIONS */
112#/* #define DEBUG_RC_HISTORY */
113#/* #define DEBUG_RC_HISTORY_EXHAUSTIVELY */
114#/* #define RC_HISTORY_MAX 10240 */
115#/* #define POINTER_DEBUG */
116#/* #define DEBUG_FAILOVER_MESSAGES */
117#/* #define DEBUG_FAILOVER_TIMING */
118#/* #define DEBUG_DUMP_ALL_LEASES */
119
120# Failover optional compile-time feature.
121AC_ARG_ENABLE(failover,
122 AS_HELP_STRING([--enable-failover],[enable support for failover (default is yes)]))
123# Failover is on by default, so define if it is not explicitly disabled.
124if test "$enable_failover" != "no"; then
125 enable_failover="yes"
126 AC_DEFINE([FAILOVER_PROTOCOL], [1],
127 [Define to include Failover Protocol support.])
128fi
129
130# execute() support.
131AC_ARG_ENABLE(execute,
132 AS_HELP_STRING([--enable-execute],[enable support for execute() in config (default is yes)]))
133# execute() is on by default, so define if it is not explicitly disabled.
134if test "$enable_execute" != "no" ; then
135 enable_execute="yes"
136 AC_DEFINE([ENABLE_EXECUTE], [1],
137 [Define to include execute() config language support.])
138fi
139
140# Server tracing support.
141AC_ARG_ENABLE(tracing,
142 AS_HELP_STRING([--enable-tracing],[enable support for server activity tracing (default is yes)]))
143# tracing is on by default, so define if it is not explicitly disabled.
144if test "$enable_tracing" != "no" ; then
145 AC_DEFINE([TRACING], [1],
146 [Define to include server activity tracing support.])
147fi
148
149# Delayed-ack feature support (experimental).
150AC_ARG_ENABLE(delayed_ack,
151 AS_HELP_STRING([--enable-delayed-ack],[queues multiple DHCPACK replies (default is no)]))
152if test "$enable_delayed_ack" = "yes"; then
153 AC_DEFINE([DELAYED_ACK], [1],
154 [Define to queue multiple DHCPACK replies per fsync.])
155else
156 enable_delayed_ack="no"
157fi
158
159# DHCPv6 optional compile-time feature.
160AC_ARG_ENABLE(dhcpv6,
161 AS_HELP_STRING([--enable-dhcpv6],[enable support for DHCPv6 (default is yes)]))
162# DHCPv6 is on by default, so define if it is not explicitly disabled.
163if test "$enable_dhcpv6" != "no"; then
164 enable_dhcpv6="yes"
165 AC_DEFINE([DHCPv6], [1],
166 [Define to 1 to include DHCPv6 support.])
167fi
168
169# DHCPv4o6 optional compile-time feature.
170AC_ARG_ENABLE(dhcpv4o6,
171 AS_HELP_STRING([--enable-dhcpv4o6],[enable support for DHCPv4-over-DHCPv6 (default is no)]))
172# DHCPv4o6 is off by default, so define if it is explicitly enabled.
173if test "$enable_dhcpv4o6" = "yes"; then
174 # DHCPv4o6 requires DHCPv6
175 if test "$enable_dhcpv6" = "no"; then
176 AC_MSG_ERROR([dhcpv4o6 requires dhcpv6])
177 fi
178 # DHCPv4o6 is not yet compatible with delayed-ack
179 if test "$enable_delayed_ack" = "yes"; then
180 AC_MSG_ERROR([dhcpv4o6 is not compatible with delayed-ack])
181 fi
182 AC_DEFINE([DHCP4o6], [1],
183 [Define to 1 to include DHCPv4 over DHCPv6 support.])
184fi
185
186# PARANOIA is off by default (until we can test it with all features)
187AC_ARG_ENABLE(paranoia,
188 AS_HELP_STRING([--enable-paranoia],[enable support for chroot/setuid (default is no)]))
189AC_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
192# them.
193if test "$enable_paranoia" != "yes" && \
194 test "$enable_early_chroot" = "yes" ; then
195 enable_paranoia="yes"
196fi
197
198if test "$enable_paranoia" = "yes" ; then
199 AC_DEFINE([PARANOIA], [1],
200 [Define to any value to include Ari's PARANOIA patch.])
201fi
202if test "$enable_early_chroot" = "yes" ; then
203 AC_DEFINE([EARLY_CHROOT], [1],
204 [Define to any value to chroot() prior to loading config.])
205fi
206
207AC_ARG_ENABLE(ipv4_pktinfo,
208 AS_HELP_STRING([--enable-ipv4-pktinfo],[enable use of pktinfo on IPv4 sockets (default is no)]))
209
210if test "$enable_ipv4_pktinfo" = "yes"; then
211 AC_DEFINE([USE_V4_PKTINFO], [1],
212 [Define to 1 to enable IPv4 packet info support.])
213fi
214
215AC_ARG_ENABLE(use_sockets,
216 AS_HELP_STRING([--enable-use-sockets],[use the standard BSD socket API (default is no)]))
217
218if test "$enable_use_sockets" = "yes"; then
219 AC_DEFINE([USE_SOCKETS], [1],
220 [Define to 1 to use the standard BSD socket API.])
221fi
222
223# Try to hnadle incorrect byte order for secs field
224# This is off by default
225AC_ARG_ENABLE(secs_byteorder,
226 AS_HELP_STRING([--enable-secs-byteorder],[Correct bad byteorders in the secs field (default is no).]))
227
228if test "$enable_secs_byteorder" = "yes" ; then
229 AC_DEFINE([SECS_BYTEORDER], [1],
230 [Define to correct bad byteorders in secs field.])
231fi
232
233# Include the PID in the log messages. This is useful when there may
234# be multiple instances of a program.
235# This is off by default
236AC_ARG_ENABLE(log_pid,
237 AS_HELP_STRING([--enable-log-pid],[Include PIDs in syslog messages (default is no).]))
238if test "$enable_log_pid" = "yes" ; then
239 AC_DEFINE([USE_LOG_PID], [1],
240 [Define to include PIDs in syslog messages.])
241fi
242
243# Allow for binary search when inserting v4 leases into queues
244AC_ARG_ENABLE(binary_leases,
245 AS_HELP_STRING([--enable-binary-leases],[enable support for binary insertion of leases (default is no)]))
246# binary_leases is off by default.
247if test "$enable_binary_leases" = "yes"; then
248 AC_DEFINE([BINARY_LEASES], [1],
249 [Define to support binary insertion of leases into queues.])
250else
251 enable_binary_leases="no"
252fi
253
254# Testing section
255
256DISTCHECK_ATF_CONFIGURE_FLAG=
257atf_path="no"
258AC_ARG_WITH([atf],
259 AS_HELP_STRING([--with-atf=PATH],[specify location where atf was installed (or "bind")]),
260 [atf_path="$withval"])
261AM_CONDITIONAL(BIND_ATF, test "$atf_path" = "bind")
262if test "$atf_path" = "bind" ; then
263 DISTCHECK_ATF_CONFIGURE_FLAG="--with-atf=bind"
264 atf_pcp="bind"
265 atf_path="\${top_srcdir}/bind/atf"
266 ATF_CFLAGS="-I$atf_path/include -DUNIT_TEST"
267 ATF_LDFLAGS="-L$atf_path/lib -latf-c"
268 ATF_BIN=`cd $srcdir; pwd`/bind/atf/bin
269 AC_SUBST(ATF_CFLAGS)
270 AC_SUBST(ATF_LDFLAGS)
271 AC_SUBST(ATF_BIN)
272 BINDCONFIG="$BINDCONFIG --with-atf"
273elif test "$atf_path" != "no" ; then
274 DISTCHECK_ATF_CONFIGURE_FLAG="--with-atf=$atf_path"
275 # Config path for pkg-config
276 atf_pcp=""
277 if test "$atf_path" != "yes" ; then
278 if test -f $atf_path/lib/pkgconfig/atf-c.pc ; then
279 atf_pcp=$atf_path/lib/pkgconfig
280 elif test -f $atf_path/lib64/pkgconfig/atf-c.pc ; then
281 atf_pcp=$atf_path/lib64/pkgconfig
282 fi
283 else
284 # Not specified, try some common paths
285 atf_dirs="/usr /usr/local /usr/pkg /opt /opt/local"
286 for d in $atf_dirs
287 do
288 if test -f $d/lib/pkgconfig/atf-c.pc ; then
289 atf_pcp=$d/lib/pkgconfig
290 atf_path=$d
291 elif test -f $d/lib64/pkgconfig/atf-c.pc ; then
292 atf_pcp=$d/lib64/pkgconfig
293 atf_path=$d
294 fi
295 done
296 fi
297
298 if test "$atf_pcp" = "" ; then
299 AC_MSG_ERROR([Unable to find atf files in location specified])
300 else
301 AC_CHECK_PROG([pkgcfg_found],[pkg-config],[pkg-config],[])
302 if test "$pkgcfg_found" = ""; then
303 AC_MSG_ERROR([Could not locate ATF, pkg-config not installed])
304 fi
305 ATF_CFLAGS="`PKG_CONFIG_PATH=$atf_pcp pkg-config --cflags atf-c` -DUNIT_TEST"
306 ATF_LDFLAGS="`PKG_CONFIG_PATH=$atf_pcp pkg-config --libs atf-c`"
307 if test -f $atf_pcp/atf-sh.pc ; then
308 ATF_BIN="`PKG_CONFIG_PATH=$atf_pcp pkg-config --variable=exec_prefix atf-sh`/bin"
309 else
310 # older versions don't have atf-sh, try usual place
311 ATF_BIN=$atf_path/bin
312 fi
313
314 if test ! -x $ATF_BIN/atf-run -o ! -x $ATF_BIN/atf-report ; then
315 AC_MSG_WARN([atf-run/atf-report not found, assuming they are in your path])
316 fi
317
318 AC_SUBST(ATF_CFLAGS)
319 AC_SUBST(ATF_LDFLAGS)
320 AC_SUBST(ATF_BIN)
321 fi
322fi
323
324AM_CONDITIONAL(HAVE_ATF, test "$atf_pcp" != "")
325AM_COND_IF([HAVE_ATF], [AC_DEFINE([HAVE_ATF], [1], [ATF framework specified?])])
326AC_SUBST(DISTCHECK_ATF_CONFIGURE_FLAG)
327
328###
329### Path fun. Older versions of DHCP were installed in /usr/sbin, so we
330### need to look there and potentially overwrite by default (but not if
331### the user configures an alternate value). LOCALSTATEDIR is totally
332### braindead. No one uses /usr/local/var/db/ nor /usr/local/var/run, and
333### they would be insane for suggesting it. We need to look in /var/for
334### 'db' and 'state/dhcp' for db files, and /var/run for pid files by
335### default.
336###
337AC_PREFIX_PROGRAM(dhcpd)
338
339# XXX - isn't there SOME WAY to default autoconf to /var instead of
340# /usr/local/var/no/one/has/this/please/stop/trying?
341case "$localstatedir" in
342 '${prefix}/var')
343 localstatedir=/var
344 ;;
345esac
346
347# Allow specification of alternate state files
348AC_ARG_WITH(srv-lease-file,
349 AS_HELP_STRING([--with-srv-lease-file=PATH],[File for dhcpd leases
350 (default is LOCALSTATEDIR/db/dhcpd.leases)]),
351 AC_DEFINE_UNQUOTED([_PATH_DHCPD_DB], ["$withval"],
352 [File for dhcpd leases.]))
353
354AC_MSG_CHECKING([for dhcpd.leases location])
355if [[ "x$with_srv_lease_file" = "x" ]] ; then
356 if [[ -d "${localstatedir}/db" ]] ; then
357 with_srv_lease_file="${localstatedir}/db/dhcpd.leases"
358 elif [[ -d "${localstatedir}/state" ]] ; then
359 if [[ -d "${localstatedir}/state/dhcp" ]] ; then
360 with_srv_lease_file="${localstatedir}/state/dhcp/dhcpd.leases"
361 else
362 with_srv_lease_file="${localstatedir}/state/dhcpd.leases"
363 fi
364 elif [[ -d "${localstatedir}/lib" ]] ; then
365 if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
366 with_srv_lease_file="${localstatedir}/lib/dhcp/dhcpd.leases"
367 else
368 with_srv_lease_file="${localstatedir}/lib/dhcpd.leases"
369 fi
370 elif [[ -d "${localstatedir}/etc" ]] ; then
371 with_srv_lease_file="${localstatedir}/etc/dhcpd.leases"
372 else
373 with_srv_lease_file="/etc/dhcpd.leases"
374 fi
375fi
376AC_MSG_RESULT($with_srv_lease_file)
377
378AC_ARG_WITH(srv6-lease-file,
379 AS_HELP_STRING([--with-srv6-lease-file=PATH],[File for dhcpd6 leases
380 (default is LOCALSTATEDIR/db/dhcpd6.leases)]),
381 AC_DEFINE_UNQUOTED([_PATH_DHCPD6_DB], ["$withval"],
382 [File for dhcpd6 leases.]))
383
384AC_MSG_CHECKING([for dhcpd6.leases location])
385if [[ "x$with_srv6_lease_file" = "x" ]] ; then
386 if [[ -d "${localstatedir}/db" ]] ; then
387 with_srv6_lease_file="${localstatedir}/db/dhcpd6.leases"
388 elif [[ -d "${localstatedir}/state" ]] ; then
389 if [[ -d "${localstatedir}/state/dhcp" ]] ; then
390 with_srv6_lease_file="${localstatedir}/state/dhcp/dhcpd6.leases"
391 else
392 with_srv6_lease_file="${localstatedir}/state/dhcpd6.leases"
393 fi
394 elif [[ -d "${localstatedir}/lib" ]] ; then
395 if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
396 with_srv6_lease_file="${localstatedir}/lib/dhcp/dhcpd6.leases"
397 else
398 with_srv6_lease_file="${localstatedir}/lib/dhcpd6.leases"
399 fi
400 elif [[ -d "${localstatedir}/etc" ]] ; then
401 with_srv6_lease_file="${localstatedir}/etc/dhcpd6.leases"
402 else
403 with_srv6_lease_file="/etc/dhcpd6.leases"
404 fi
405fi
406AC_MSG_RESULT($with_srv6_lease_file)
407
408AC_ARG_WITH(cli-lease-file,
409 AS_HELP_STRING([--with-cli-lease-file=PATH],[File for dhclient leases
410 (default is LOCALSTATEDIR/db/dhclient.leases)]),
411 AC_DEFINE_UNQUOTED([_PATH_DHCLIENT_DB], ["$withval"],
412 [File for dhclient leases.]))
413
414AC_MSG_CHECKING([for dhclient.leases location])
415if [[ "x$with_cli_lease_file" = "x" ]] ; then
416 if [[ -d "${localstatedir}/db" ]] ; then
417 with_cli_lease_file="${localstatedir}/db/dhclient.leases"
418 elif [[ -d "${localstatedir}/state" ]] ; then
419 if [[ -d "${localstatedir}/state/dhcp" ]] ; then
420 with_cli_lease_file="${localstatedir}/state/dhcp/dhclient.leases"
421 else
422 with_cli_lease_file="${localstatedir}/state/dhclient.leases"
423 fi
424 elif [[ -d "${localstatedir}/lib" ]] ; then
425 if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
426 with_cli_lease_file="${localstatedir}/lib/dhcp/dhclient.leases"
427 else
428 with_cli_lease_file="${localstatedir}/lib/dhclient.leases"
429 fi
430 elif [[ -d "${localstatedir}/etc" ]] ; then
431 with_cli_lease_file="${localstatedir}/etc/dhclient.leases"
432 else
433 with_cli_lease_file="/etc/dhclient.leases"
434 fi
435fi
436AC_MSG_RESULT($with_cli_lease_file)
437
438AC_ARG_WITH(cli6-lease-file,
439 AS_HELP_STRING([--with-cli6-lease-file=PATH],[File for dhclient6 leases
440 (default is LOCALSTATEDIR/db/dhclient6.leases)]),
441 AC_DEFINE_UNQUOTED([_PATH_DHCLIENT6_DB], ["$withval"],
442 [File for dhclient6 leases.]))
443
444AC_MSG_CHECKING([for dhclient6.leases location])
445if [[ "x$with_cli6_lease_file" = "x" ]] ; then
446 if [[ -d "${localstatedir}/db" ]] ; then
447 with_cli6_lease_file="${localstatedir}/db/dhclient6.leases"
448 elif [[ -d "${localstatedir}/state" ]] ; then
449 if [[ -d "${localstatedir}/state/dhcp" ]] ; then
450 with_cli6_lease_file="${localstatedir}/state/dhcp/dhclient6.leases"
451 else
452 with_cli6_lease_file="${localstatedir}/state/dhclient6.leases"
453 fi
454 elif [[ -d "${localstatedir}/lib" ]] ; then
455 if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
456 with_cli6_lease_file="${localstatedir}/lib/dhcp/dhclient6.leases"
457 else
458 with_cli6_lease_file="${localstatedir}/lib/dhclient6.leases"
459 fi
460 elif [[ -d "${localstatedir}/etc" ]] ; then
461 with_cli6_lease_file="${localstatedir}/etc/dhclient6.leases"
462 else
463 with_cli6_lease_file="/etc/dhclient6.leases"
464 fi
465fi
466AC_MSG_RESULT($with_cli6_lease_file)
467
468AC_ARG_WITH(srv-pid-file,
469 AS_HELP_STRING([--with-srv-pid-file=PATH],[File for dhcpd process information
470 (default is LOCALSTATEDIR/run/dhcpd.pid)]),
471 AC_DEFINE_UNQUOTED([_PATH_DHCPD_PID], ["$withval"],
472 [File for dhcpd process information.]))
473AC_ARG_WITH(srv6-pid-file,
474 AS_HELP_STRING([--with-srv6-pid-file=PATH],[File for dhcpd6 process information
475 (default is LOCALSTATEDIR/run/dhcpd6.pid)]),
476 AC_DEFINE_UNQUOTED([_PATH_DHCPD6_PID], ["$withval"],
477 [File for dhcpd6 process information.]))
478AC_ARG_WITH(cli-pid-file,
479 AS_HELP_STRING([--with-cli-pid-file=PATH],[File for dhclient process information
480 (default is LOCALSTATEDIR/run/dhclient.pid)]),
481 AC_DEFINE_UNQUOTED([_PATH_DHCLIENT_PID], ["$withval"],
482 [File for dhclient process information.]))
483AC_ARG_WITH(cli6-pid-file,
484 AS_HELP_STRING([--with-cli6-pid-file=PATH],[File for dhclient6 process information
485 (default is LOCALSTATEDIR/run/dhclient6.pid)]),
486 AC_DEFINE_UNQUOTED([_PATH_DHCLIENT6_PID], ["$withval"],
487 [File for dhclient6 process information.]))
488AC_ARG_WITH(relay-pid-file,
489 AS_HELP_STRING([--with-relay-pid-file=PATH],[File for dhcrelay process information
490 (default is LOCALSTATEDIR/run/dhcrelay.pid)]),
491 AC_DEFINE_UNQUOTED([_PATH_DHCRELAY_PID], ["$withval"],
492 [File for dhcrelay process information.]))
493AC_ARG_WITH(relay6-pid-file,
494 AS_HELP_STRING([--with-relay6-pid-file=PATH],[File for dhcrelay6 process information
495 (default is LOCALSTATEDIR/run/dhcrelay6.pid)]),
496 AC_DEFINE_UNQUOTED([_PATH_DHCRELAY6_PID], ["$withval"],
497 [File for dhcrelay6 process information.]))
498
499# Check basic types.
500AC_TYPE_INT8_T
501AC_TYPE_INT16_T
502AC_TYPE_INT32_T
503AC_TYPE_INT64_T
504
505# Some systems need the u_intX_t types defined across.
506AC_CHECK_TYPE([u_int8_t], [], [
507 AC_TYPE_UINT8_T
508 AC_DEFINE(u_int8_t, [uint8_t], [Define a type for 8-bit unsigned
509 integers.])
510])
511AC_CHECK_TYPE([u_int16_t], [], [
512 AC_TYPE_UINT16_T
513 AC_DEFINE(u_int16_t, [uint16_t], [Define a type for 16-bit unsigned
514 integers.])
515])
516AC_CHECK_TYPE([u_int32_t], [], [
517 AC_TYPE_UINT32_T
518 AC_DEFINE(u_int32_t, [uint32_t], [Define a type for 32-bit unsigned
519 integers.])
520])
521AC_CHECK_TYPE([u_int64_t], [], [
522 AC_TYPE_UINT64_T
523 AC_DEFINE(u_int64_t, [uint64_t], [Define a type for 64-bit unsigned
524 integers.])
525])
526
527# see if ifaddrs.h is available
528AC_CHECK_HEADERS(ifaddrs.h)
529
530# figure out what IPv4 interface code to use
531AC_CHECK_HEADERS(linux/types.h) # needed for linux/filter.h on old systems
532
533AC_CHECK_HEADER(linux/filter.h, DO_LPF=1, ,
534[
535#ifdef HAVE_LINUX_TYPES_H
536#include <linux/types.h>
537#endif
538])
539if test -n "$DO_LPF"
540then
541 AC_DEFINE([HAVE_LPF], [1],
542 [Define to 1 to use the Linux Packet Filter interface code.])
543else
544 AC_CHECK_HEADER(sys/dlpi.h, DO_DLPI=1)
545 if test -n "$DO_DLPI"
546 then
547 AC_DEFINE([HAVE_DLPI], [1],
548 [Define to 1 to use DLPI interface code.])
549 else
550 AC_CHECK_HEADER(net/bpf.h, DO_BPF=1)
551 if test -n "$DO_BPF"
552 then
553 AC_DEFINE([HAVE_BPF], [1],
554 [Define to 1 to use the
555 Berkeley Packet Filter interface code.])
556 fi
557 fi
558fi
559
560# SIOCGLIFCONF uses some transport structures. Trick is not all platforms
561# use the same structures. We like to use 'struct lifconf' and 'struct
562# lifreq', but we'll use these other structures if they're present. HPUX
563# does not define 'struct lifnum', but does use SIOCGLIFNUM - they use an
564# int value.
565#
566AC_MSG_CHECKING([for struct lifnum])
567AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h>
568 #include <sys/socket.h>
569 #include <net/if.h>
570]], [[ struct lifnum a;
571]])],[AC_MSG_RESULT(yes)
572 AC_DEFINE([ISC_PLATFORM_HAVELIFNUM], [1],
573 [Define to 1 if the system has 'struct lifnum'.])],[AC_MSG_RESULT(no)])
574
575AC_MSG_CHECKING([for struct if_laddrconf])
576AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h>
577 #include <net/if6.h>
578]], [[ struct if_laddrconf a;
579]])],[AC_MSG_RESULT(yes)
580 AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRCONF], [1],
581 [Define to 1 if the system has 'struct if_laddrconf'.])],[AC_MSG_RESULT(no)])
582
583AC_MSG_CHECKING([for struct if_laddrreq])
584AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
585 #include <net/if6.h>
586]], [[ struct if_laddrreq a;
587]])],[AC_MSG_RESULT(yes)
588 AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRREQ], [1],
589 [Define to 1 if the system has 'struct if_laddrreq'.])],[AC_MSG_RESULT(no)])
590
591#
592# check for GCC noreturn attribute
593#
594AC_MSG_CHECKING(for GCC noreturn attribute)
595AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[void foo() __attribute__((noreturn));]])],[AC_MSG_RESULT(yes)
596 AC_DEFINE([ISC_DHCP_NORETURN], [__attribute__((noreturn))],
597 [Define to the string for a noreturn attribute.])],[AC_MSG_RESULT(no)
598 AC_DEFINE([ISC_DHCP_NORETURN], [],
599 [Define to the string for a noreturn attribute.])])
600
601# Look for optional headers.
602AC_CHECK_HEADERS(sys/socket.h net/if_dl.h net/if6.h regex.h)
603
604# Solaris needs some libraries for functions
605AC_SEARCH_LIBS(socket, [socket])
606AC_SEARCH_LIBS(inet_ntoa, [nsl])
607
608AC_SEARCH_LIBS(inet_aton, [socket nsl], ,
609 AC_DEFINE([NEED_INET_ATON], [1],
610 [Define to 1 if the inet_aton() function is missing.]))
611
612# Check for a standalone regex library.
613AC_SEARCH_LIBS(regcomp, [regex])
614
615AC_CHECK_FUNCS(strlcat)
616
617# For HP/UX we need -lipv6 for if_nametoindex, perhaps others.
618AC_SEARCH_LIBS(if_nametoindex, [ipv6])
619
620# check for /dev/random (declares HAVE_DEV_RANDOM)
621AC_MSG_CHECKING(for random device)
622AC_ARG_WITH(randomdev,
623 AS_HELP_STRING([--with-randomdev=PATH],[Path for random device
624 (default is /dev/random)]),
625 use_randomdev="$withval", use_randomdev="unspec")
626if test "$use_randomdev" = "unspec"; then
627 if test "$cross_compiling" = "yes"; then
628 AC_MSG_RESULT(unspecified)
629 AC_MSG_ERROR([ need --with-randomdev=PATH or --with-randomdev=no])
630 fi
631 use_randomdev="/dev/random"
632elif test "$use_randomdev" = "yes"; then
633 use_randomdev="/dev/random"
634fi
635if test "$use_randomdev" = "no"; then
636 AC_MSG_RESULT(disabled)
637 BINDCONFIG="$BINDCONFIG --with-randomdev=no"
638else
639 if test "$cross_compiling" = "yes"; then
640 AC_MSG_RESULT($use_randomdev (unchecked))
641 else
642 AC_MSG_RESULT($use_randomdev)
643 AC_CHECK_FILE($use_randomdev,
644 AC_DEFINE([HAVE_DEV_RANDOM], [1],
645 [Define to 1 if you have the /dev/random or other configured file.]),
646 AC_MSG_ERROR(cannot find $use_randomdev))
647 fi
648 BINDCONFIG="$BINDCONFIG --with-randomdev=$use_randomdev"
649fi
650
651BINDIOMUX="--disable-kqueue --disable-epoll --disable-devpoll"
652# check kqueue/epoll/devpoll alternative to select
653AC_ARG_ENABLE(kqueue,
654 AS_HELP_STRING([--enable-kqueue],[use BSD kqueue (default is no)]),
655 want_kqueue="$enableval", want_kqueue="no")
656if test "$want_kqueue" = "yes"; then
657 BINDIOMUX="--enable-kqueue"
658 AC_MSG_WARN([--enable-kqueue is not supported: it may lead to issues such as server looping])
659fi
660AC_ARG_ENABLE(epoll,
661 AS_HELP_STRING([--enable-epoll],[use Linux epoll (default is no)]),
662 want_epoll="$enableval", want_epoll="no")
663if test "$want_epoll" = "yes"; then
664 BINDIOMUX="--enable-epoll"
665 AC_MSG_WARN([--enable-epoll is not supported: it may lead to issues such as server looping])
666fi
667AC_ARG_ENABLE(devpoll,
668 AS_HELP_STRING([--enable-devpoll],[use /dev/poll (default is no)]),
669 want_devpoll="$enableval", want_devpoll="no")
670if test "$want_devpoll" = "yes"; then
671 BINDIOMUX="--enable-devpoll"
672 AC_MSG_WARN([--enable-devpoll is not supported: it may lead to issues such as server looping])
673fi
674AC_SUBST(BINDIOMUX)
675
676# general extra bind configure arguments
677AC_ARG_WITH(bind-extra-config,
678 AS_HELP_STRING([--with-bind-extra-config],[configure bind librairies
679 with some extra options (default is none)]),
680 use_xbindconfig="$withval", use_xbindconfig="")
681case "$use_xbindconfig" in
682yes|no|'')
683 ;;
684*)
685 BINDCONFIG="$BINDCONFIG $use_xbindconfig"
686 AC_MSG_WARN([Most options to bind configure are not supported when used by ISC DHCP])
687 ;;
688esac
689
690# see if there is a "sa_len" field in our interface information structure
691AC_CHECK_MEMBER(struct sockaddr.sa_len,
692 AC_DEFINE([HAVE_SA_LEN], [],
693 [Define to 1 if the sockaddr structure has a length field.]),
694 ,
695 [#include <sys/socket.h>])
696
697# figure out pointer size
698SAVE_CFLAGS="$CFLAGS"
699CFLAGS="$CFLAGS -I$srcdir"
700AC_CHECK_SIZEOF(struct iaddr *, , [
701#include "includes/inet.h"
702#include <stdio.h>
703])
704CFLAGS="$SAVE_CFLAGS"
705
706# Solaris does not have the msg_control or msg_controlen members
707# in the msghdr structure unless you define:
708#
709# _XOPEN_SOURCE, _XOPEN_SOURCE_EXTENDED, and __EXTENSIONS__
710#
711# See the "standards" man page for details.
712#
713# We check for the msg_control member, and if it is not found, we check
714# again with the appropriate defines added to the CFLAGS. (In order to
715# do this we have to remove the check from the cache, which is what the
716# "unset" is for.)
717AC_CHECK_MEMBER(struct msghdr.msg_control,,
718 [CFLAGS="$CFLAGS -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
719 CFLAGS="$CFLAGS -D__EXTENSIONS__"
720 unset ac_cv_member_struct_msghdr_msg_control
721 AC_CHECK_MEMBER(struct msghdr.msg_control,,
722 [AC_MSG_ERROR([Missing msg_control member in
723 msg_control structure.])],
724 [
725#include <sys/types.h>
726#include <sys/socket.h>
727 ])
728 ],
729 [
730#include <sys/types.h>
731#include <sys/socket.h>
732 ])
733
734AC_CHECK_MEMBER(struct tpacket_auxdata.tp_vlan_tci,
735 [AC_DEFINE([VLAN_TCI_PRESENT], [1], [tpacket_auxdata.tp_vlan_tci present])]
736 ,, [#include <linux/if_packet.h>])
737
738# bind/Makefile.in is not from automake so we need 2 variables for bind dir
739BINDSUBDIR=
740BINDDIR=
741BINDSRCDIR=
742BINDLIBIRSDIR=
743BINDLIBDNSDIR=
744BINDLIBISCCFGDIR=
745BINDLIBISCDIR=
746DISTCHECK_LIBBIND_CONFIGURE_FLAG=
747AC_ARG_WITH(libbind,
748 AS_HELP_STRING([--with-libbind=PATH],[bind includes and libraries are in PATH]),
749 use_libbind="$withval", use_libbind="no")
750case "$use_libbind" in
751yes)
752 AC_MSG_ERROR([PATH is required in --with-libbind=PATH])
753 ;;
754no)
755 BINDSUBDIR="\${top_srcdir}/bind"
756 my_abs_srcdir=`cd $srcdir && pwd`
757 BINDDIR="${my_abs_srcdir}/bind"
758 if test ! -d "$srcdir/bind"; then
759 AC_MSG_ERROR([Where to find or build bind includes and libraries must be specified])
760 fi
761 if test -d "$srcdir/bind/bind9"; then
762 BINDSRCDIR="${my_abs_srcdir}/bind/bind9"
763 else
764 if test ! -f "$srcdir/bind/version.tmp"; then
765 AC_MSG_ERROR([Cannot find $srcdir/bind/version.tmp])
766 fi
767 . "$srcdir/bind/version.tmp"
768 bindversion=${MAJORVER}.${MINORVER}.${PATCHVER}${RELEASETYPE}${RELEASEVER}
769 BINDSRCDIR="${my_abs_srcdir}/bind/bind-$bindversion"
770 fi
771 AC_CONFIG_FILES([$srcdir/bind/Makefile])
772
773 BINDLIBIRSDIR="$BINDSRCDIR/lib/irs"
774 BINDLIBDNSDIR="$BINDSRCDIR/lib/dns"
775 BINDLIBISCCFGDIR="$BINDSRCDIR/lib/isccfg"
776 BINDLIBISCDIR="$BINDSRCDIR/lib/isc"
777 ;;
778*)
779 if test ! -d "$use_libbind"; then
780 AC_MSG_ERROR([Cannot find bind directory at $use_libbind])
781 fi
782 if test ! -d "$use_libbind/include"; then
783 AC_MSG_ERROR([Cannot find bind includes at $use_libbind/include])
784 fi
785 if test ! -d "$use_libbind/lib"; then
786 AC_MSG_ERROR([Cannot find bind libraries at $use_libbind/lib])
787 fi
788 BINDDIR="$use_libbind"
789 BINDLIBIRSDIR="$BINDDIR/lib"
790 BINDLIBDNSDIR="$BINDDIR/lib"
791 BINDLIBISCCFGDIR="$BINDDIR/lib"
792 BINDLIBISCDIR="$BINDDIR/lib"
793 DISTCHECK_LIBBIND_CONFIGURE_FLAG="--with-libbind=$use_libbind"
794 ;;
795esac
796AC_SUBST(BINDSUBDIR)
797AC_SUBST(BINDDIR)
798AC_SUBST(BINDSRCDIR)
799AC_SUBST(BINDLIBIRSDIR)
800AC_SUBST(BINDLIBDNSDIR)
801AC_SUBST(BINDLIBISCCFGDIR)
802AC_SUBST(BINDLIBISCDIR)
803AC_SUBST(DISTCHECK_LIBBIND_CONFIGURE_FLAG)
804AM_CONDITIONAL(HAVE_BINDDIR, test "$use_libbind" = "no")
805
806AC_ARG_ENABLE(bind_install,
807 AS_HELP_STRING([--enable-bind-install],[install bind includes and libraries (default is no).]))
808if test "$enable_bind_install" = "yes" -a "$use_libbind" != "no"; then
809 AC_MSG_WARN([--enable-bind-install does nothing when --with-libbind is set])
810fi
811AM_CONDITIONAL(INSTALL_BIND, test "$enable_bind_install" = "yes")
812
813#
814# GNU libtool support
815#
816case "$build_os" in
817 sunos*)
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.
821
822 lt_cv_sys_max_cmd_len=4096
823 ;;
824esac
825
826want_libtool="no"
827@BEGIN WITH LIBTOOL
828LT_INIT
829want_libtool="yes"
830@END WITH LIBTOOL
831
832BINDLT=
833AC_ARG_ENABLE(libtool,
834 AS_HELP_STRING([--enable-libtool],[use GNU libtool for dynamic shared libraries (default is $default_libtool).]),
835 want_libtool="$enableval")
836@BEGIN WITH LIBTOOL
837if test "$want_libtool" = "no"; then
838 AC_MSG_ERROR([libtool configure is used but libtool is disabled?])
839fi
840A=la
841BINDLT=--with-libtool
842@END WITH LIBTOOL
843@BEGIN WITHOUT LIBTOOL
844if test "$want_libtool" = "yes"; then
845 AC_MSG_WARN([legacy configure is used but libtool is enabled. Trying to recover...])
846 cd $srcdir; exec ./re-conf $ac_configure_args
847 AC_MSG_ERROR([Recovering failed])
848fi
849A=a
850@END WITHOUT LIBTOOL
851AC_SUBST(A)
852AC_SUBST(BINDLT)
853
854# OpenLDAP support.
855AC_ARG_WITH(ldap,
856 AS_HELP_STRING([--with-ldap],[enable OpenLDAP support in dhcpd (default is no)]),
857 [ldap=$withval],
858 [ldap=no])
859
860# OpenLDAP with SSL support.
861AC_ARG_WITH(ldapcrypto,
862 AS_HELP_STRING([--with-ldapcrypto],[enable OpenLDAP crypto support in dhcpd (default is no)]),
863 [ldapcrypto=$withval],
864 [ldapcrypto=no])
865
866# Gssapi to allow LDAP to authenticate with a keytab
867AC_ARG_WITH(ldap-gssapi,
868 AC_HELP_STRING([--with-ldap-gssapi],
869 [enable krb5/gssapi authentication for OpenLDAP in dhcpd (default is no)]),
870 [ldap_gssapi=$withval],
871 [ldap_gssapi=no])
872
873
874# LDAP CASA auth support.
875AC_ARG_WITH(ldapcasa,
876 AC_HELP_STRING([--with-ldapcasa],
877 [enable LDAP CASA auth support in dhcpd (default is no)]),
878 [ldapcasa=$withval],
879 [ldapcasa=no])
880
881# OpenLDAP support is disabled by default, if enabled then SSL support is an
882# extra optional that is also disabled by default. Enabling LDAP SSL support
883# implies enabling LDAP support. Similarly, KRB5 support implies LDAP support,
884# but doesn't include SSL. The two are not dependant.
885if test x$ldap = xyes || test x$ldapcrypto = xyes || test x$ldap_gssapi = xyes; then
886 saved_LIBS="$LIBS"
887 LIBS=""
888 AC_SEARCH_LIBS(ldap_initialize, [ldap], ,
889 AC_MSG_FAILURE([*** Cannot find ldap_initialize with -lldap - do you need to install an OpenLDAP2 Devel package?]))
890 AC_SEARCH_LIBS(ber_pvt_opt_on, [lber], ,
891 AC_MSG_FAILURE([*** Cannot find ber_pvt_opt_on with -llber - do you need to install an OpenLDAP2 Devel package?]))
892 if test x$ldap_gssapi = xyes ; then
893 AC_SEARCH_LIBS(krb5_init_context, [krb5], ,
894 AC_MSG_FAILURE([*** Cannot find krb5_init_context with -lkrb5 - do you need to install a Kerberos Devel package?]))
895 fi
896
897 # Create LDAP_LIBS which we specify them explicitly rather than lumping them in with LIBS
898 AC_SUBST(LDAP_LIBS, [$LIBS])
899 LIBS="$saved_LIBS"
900
901
902 AC_CHECK_HEADERS([ldap.h])
903 AC_CHECK_FUNCS([inet_pton inet_ntop])
904
905
906 LDAP_CFLAGS="-DLDAP_CONFIGURATION"
907
908 if test x$ldapcasa = xyes ; then
909 AC_CHECK_HEADERS([micasa_mgmd.h],[
910 LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_CASA_AUTH"
911 ], AC_MSG_FAILURE([*** Cannot find micasa_mgmd.h for ldap casa auth support]))
912 fi
913
914 if test x$ldapcrypto = xyes ; then
915 LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_USE_SSL"
916 fi
917
918 if test x$ldap_gssapi = xyes; then
919 LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_USE_GSSAPI"
920 fi
921
922 AC_SUBST(LDAP_CFLAGS, [$LDAP_CFLAGS])
923fi
924
925# Append selected warning levels to CFLAGS before substitution (but after
926# AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[]) & etc).
927CFLAGS="$CFLAGS $STD_CWARNINGS"
928
929# Try to add the bind and dhcp include directories
930CFLAGS="$CFLAGS -I\$(top_srcdir)/includes -I$BINDDIR/include"
931
932case "$host" in
933*-darwin*)
934 CFLAGS="$CFLAGS -D__APPLE_USE_RFC_3542";;
935*-solaris*)
936 # As of Solaris 11, ethernet dev files are in /dev/net
937 AC_CHECK_FILE(/dev/net,
938 [AC_DEFINE([USE_DEV_NET], [1],
939 [Define to 1 if ethernet devices are in /dev/net])])
940 ;;
941esac
942
943AC_C_FLEXIBLE_ARRAY_MEMBER
944
945AC_CONFIG_FILES([
946 Makefile
947 client/Makefile
948 client/tests/Makefile
949 common/Makefile.am
950 common/Makefile
951 common/tests/Makefile
952 dhcpctl/Makefile.am
953 dhcpctl/Makefile
954 includes/Makefile
955 omapip/Makefile.am
956 omapip/Makefile
957 relay/Makefile
958 server/Makefile
959 tests/Makefile.am
960 tests/Makefile
961 tests/unittest.sh
962 server/tests/Makefile
963 doc/devel/doxyfile
964])
965AC_OUTPUT
966
967@BEGIN WITH LIBTOOL
968AC_MSG_NOTICE([postconfig: run automake in $srcdir])
969(cd $srcdir; automake)
970AC_MSG_NOTICE([postconfig: rerun config.status])
971sh ./config.status
972@END WITH LIBTOOL
973
974if test "$enable_dhcpv4o6" = "yes"; then
975 DHCP_VERSIONS="DHCPv4, DHCPv6 and DHCPv4-over-DHCPv6"
976elif test "$enable_dhcpv6" != "no"; then
977 DHCP_VERSIONS="DHCPv4 and DHCPv6"
978else
979 DHCP_VERSIONS="DHCPv4"
980fi
981
982cat > config.report << END
983
984 ISC DHCP source configure results:
985 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
986
987Package:
988 Name: $PACKAGE_NAME
989 Version: $PACKAGE_VERSION
990
991C Compiler: $CC
992
993Flags:
994 DEFS: $DEFS
995 CFLAGS: $CFLAGS
996
997DHCP versions: $DHCP_VERSIONS
998
999Features:
1000 debug: $enable_debug
1001 failover: $enable_failover
1002 execute: $enable_execute
1003 binary-leases: $enable_binary_leases
1004 dhcpv6: $enable_dhcpv6
1005 delayed-ack: $enable_delayed_ack
1006
1007Developer:
1008 ATF unittests : $atf_path
1009
1010END
1011# TODO: Add Perl system tests
1012
1013if test "$atf_path" != "no"
1014then
1015echo "ATF_CFLAGS : $ATF_CFLAGS" >> config.report
1016echo "ATF_LDFLAGS : $ATF_LDFLAGS" >> config.report
1017echo "ATF_BIN : $ATF_BIN" >> config.report
1018echo
1019fi
1020
1021cat config.report
1022
1023echo
1024echo Now you can type "make" to build ISC DHCP
1025echo