]> git.ipfire.org Git - thirdparty/dhcp.git/blob - configure.ac
[master] Added dhcpv6 and delayed_ack feature report to configure output
[thirdparty/dhcp.git] / configure.ac
1 AC_INIT([DHCP],[4.3.3],[dhcp-users@isc.org])
2
3 # we specify "foreign" to avoid having to have the GNU mandated files,
4 # like AUTHORS, COPYING, and such
5 AM_INIT_AUTOMAKE([foreign])
6
7 # we specify AM_MAINTAINER_MODE to avoid problems with rebuilding
8 # the configure and makefiles. Without it users doing things that
9 # change the timestamps on the code, like checking it into a cvs
10 # tree, could trigger a rebuild of the infrastructure files which
11 # might fail if they don't have the correct tools.
12 AM_MAINTAINER_MODE
13
14 AC_CANONICAL_HOST
15
16 # We want to turn on warnings if we are using gcc and the user did
17 # not specify CFLAGS. The autoconf check for the C compiler sets the
18 # CFLAGS if gcc is used, so we will save it before we run that check.
19 SAVE_CFLAGS="$CFLAGS"
20
21 # Now find our C compiler.
22 AC_PROG_CC
23
24 # Suppress warnings about --datarootdir
25 AC_DEFUN([AC_DATAROOTDIR_CHECKED])
26
27 # If we have gcc, and AC_PROG_CC changed the flags, then we know the
28 # user did not specify any flags. Add warnings in this case.
29 if test "$GCC" = "yes"; then
30 if test "$CFLAGS" != "$SAVE_CFLAGS"; then
31 STD_CWARNINGS="$STD_CWARNINGS -Wall -Werror -fno-strict-aliasing"
32 fi
33 fi
34
35 # We can have some flags to pass to bind configure
36 BINDCONFIG=
37 AC_SUBST(BINDCONFIG)
38
39 # POSIX doesn't include the IPv6 Advanced Socket API and glibc hides
40 # parts of the IPv6 Advanced Socket API as a result. This is stupid
41 # as it breaks how the two halves (Basic and Advanced) of the IPv6
42 # Socket API were designed to be used but we have to live with it.
43 # Use this to define _GNU_SOURCE to pull in the IPv6 Advanced Socket API.
44 AC_USE_SYSTEM_EXTENSIONS
45
46 AC_PROG_RANLIB
47 AC_CONFIG_HEADERS([includes/config.h])
48
49 # we sometimes need to know byte order for building packets
50 AC_C_BIGENDIAN(AC_SUBST(byte_order, BIG_ENDIAN),
51 AC_SUBST(byte_order, LITTLE_ENDIAN))
52 AC_DEFINE_UNQUOTED([DHCP_BYTE_ORDER], [$byte_order],
53 [Define to BIG_ENDIAN for MSB (Motorola or SPARC CPUs)
54 or LITTLE_ENDIAN for LSB (Intel CPUs).])
55
56 # Optional compile-time DEBUGging.
57 AC_ARG_ENABLE(debug,
58 AS_HELP_STRING([--enable-debug],[create a debug-only version of the software (default is no).]),
59 [case "${enableval}" in
60 yes) enable_debug=yes
61 AC_DEFINE([DEBUG], [1],
62 [Define to compile debug-only DHCP software.])
63 # Just override CFLAGS totally to remove optimization.
64 CFLAGS="-g";;
65 no) enable_debug=no ;;
66 *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
67 esac],[enable_debug=no])
68
69 # XXX: there are actually quite a lot more DEBUG_ features we could enable,
70 # but I don't want to pollute the --help space.
71 #
72 #/* #define DEBUG_TOKENS */
73 #/* #define DEBUG_PACKET */
74 #/* #define DEBUG_EXPRESSIONS */
75 #/* #define DEBUG_FIND_LEASE */
76 #/* #define DEBUG_EXPRESSION_PARSE */
77 #/* #define DEBUG_CLASS_MATCHING */
78 #/* #define DEBUG_MEMORY_LEAKAGE */
79 #/* #define DEBUG_MALLOC_POOL */
80 #/* #define DEBUG_LEASE_STATE_TRANSITIONS */
81 #/* #define DEBUG_RC_HISTORY */
82 #/* #define DEBUG_RC_HISTORY_EXHAUSTIVELY */
83 #/* #define RC_HISTORY_MAX 10240 */
84 #/* #define POINTER_DEBUG */
85 #/* #define DEBUG_FAILOVER_MESSAGES */
86 #/* #define DEBUG_FAILOVER_TIMING */
87 #/* #define DEBUG_DUMP_ALL_LEASES */
88
89 # Failover optional compile-time feature.
90 AC_ARG_ENABLE(failover,
91 AS_HELP_STRING([--enable-failover],[enable support for failover (default is yes)]))
92 # Failover is on by default, so define if it is not explicitly disabled.
93 if test "$enable_failover" != "no"; then
94 enable_failover="yes"
95 AC_DEFINE([FAILOVER_PROTOCOL], [1],
96 [Define to include Failover Protocol support.])
97 fi
98
99 # execute() support.
100 AC_ARG_ENABLE(execute,
101 AS_HELP_STRING([--enable-execute],[enable support for execute() in config (default is yes)]))
102 # execute() is on by default, so define if it is not explicitly disabled.
103 if test "$enable_execute" != "no" ; then
104 enable_execute="yes"
105 AC_DEFINE([ENABLE_EXECUTE], [1],
106 [Define to include execute() config language support.])
107 fi
108
109 # Server tracing support.
110 AC_ARG_ENABLE(tracing,
111 AS_HELP_STRING([--enable-tracing],[enable support for server activity tracing (default is yes)]))
112 # tracing is on by default, so define if it is not explicitly disabled.
113 if test "$enable_tracing" != "no" ; then
114 AC_DEFINE([TRACING], [1],
115 [Define to include server activity tracing support.])
116 fi
117
118 # Delayed-ack feature support (experimental).
119 AC_ARG_ENABLE(delayed_ack,
120 AS_HELP_STRING([--enable-delayed-ack],[queues multiple DHCPACK replies (default is no)]))
121 if test "$enable_delayed_ack" = "yes"; then
122 AC_DEFINE([DELAYED_ACK], [1],
123 [Define to queue multiple DHCPACK replies per fsync.])
124 else
125 enable_delayed_ack="no"
126 fi
127
128 # DHCPv6 optional compile-time feature.
129 AC_ARG_ENABLE(dhcpv6,
130 AS_HELP_STRING([--enable-dhcpv6],[enable support for DHCPv6 (default is yes)])),
131 # DHCPv6 is on by default, so define if it is not explicitly disabled.
132 if test "$enable_dhcpv6" != "no"; then
133 enable_dhcpv6="yes"
134 AC_DEFINE([DHCPv6], [1],
135 [Define to 1 to include DHCPv6 support.])
136 fi
137
138 # PARANOIA is off by default (until we can test it with all features)
139 AC_ARG_ENABLE(paranoia,
140 AS_HELP_STRING([--enable-paranoia],[enable support for chroot/setuid (default is no)]))
141 AC_ARG_ENABLE(early_chroot,
142 AS_HELP_STRING([--enable-early-chroot],[enable chrooting prior to configuration (default is no)]))
143 # If someone enables early chroot, but does not enable paranoia, do so for
144 # them.
145 if test "$enable_paranoia" != "yes" && \
146 test "$enable_early_chroot" = "yes" ; then
147 enable_paranoia="yes"
148 fi
149
150 if test "$enable_paranoia" = "yes" ; then
151 AC_DEFINE([PARANOIA], [1],
152 [Define to any value to include Ari's PARANOIA patch.])
153 fi
154 if test "$enable_early_chroot" = "yes" ; then
155 AC_DEFINE([EARLY_CHROOT], [1],
156 [Define to any value to chroot() prior to loading config.])
157 fi
158
159 AC_ARG_ENABLE(ipv4_pktinfo,
160 AS_HELP_STRING([--enable-ipv4-pktinfo],[enable use of pktinfo on IPv4 sockets (default is no)]))
161
162 if test "$enable_ipv4_pktinfo" = "yes"; then
163 AC_DEFINE([USE_V4_PKTINFO], [1],
164 [Define to 1 to enable IPv4 packet info support.])
165 fi
166
167 AC_ARG_ENABLE(use_sockets,
168 AS_HELP_STRING([--enable-use-sockets],[use the standard BSD socket API (default is no)]))
169
170 if test "$enable_use_sockets" = "yes"; then
171 AC_DEFINE([USE_SOCKETS], [1],
172 [Define to 1 to use the standard BSD socket API.])
173 fi
174
175 # Try to hnadle incorrect byte order for secs field
176 # This is off by default
177 AC_ARG_ENABLE(secs_byteorder,
178 AS_HELP_STRING([--enable-secs-byteorder],[Correct bad byteorders in the secs field (default is no).]))
179
180 if test "$enable_secs_byteorder" = "yes" ; then
181 AC_DEFINE([SECS_BYTEORDER], [1],
182 [Define to correct bad byteorders in secs field.])
183 fi
184
185 # Include the PID in the log messages. This is useful when there may
186 # be multiple instances of a program.
187 # This is off by default
188 AC_ARG_ENABLE(log_pid,
189 AS_HELP_STRING([--enable-log-pid],[Include PIDs in syslog messages (default is no).]))
190 if test "$enable_log_pid" = "yes" ; then
191 AC_DEFINE([USE_LOG_PID], [1],
192 [Define to include PIDs in syslog messages.])
193 fi
194
195 # Allow for binary search when inserting v4 leases into queues
196 AC_ARG_ENABLE(binary_leases,
197 AS_HELP_STRING([--enable-binary-leases],[enable support for binary insertion of leases (default is no)]))
198 # binary_leases is off by default.
199 if test "$enable_binary_leases" = "yes"; then
200 AC_DEFINE([BINARY_LEASES], [1],
201 [Define to support binary insertion of leases into queues.])
202 else
203 enable_binary_leases="no"
204 fi
205
206 # Testing section
207
208 atf_path="no"
209 AC_ARG_WITH([atf],
210 AS_HELP_STRING([--with-atf=PATH],[specify location where atf was installed (or "bind")]),
211 [atf_path="$withval"])
212 AM_CONDITIONAL(BIND_ATF, test "$atf_path" = "bind")
213 if test "$atf_path" = "bind" ; then
214 atf_pcp="bind"
215 atf_path="\${top_srcdir}/bind/atf"
216 ATF_CFLAGS="-I$atf_path/include -DUNIT_TEST"
217 ATF_LDFLAGS="-L$atf_path/lib -latf-c"
218 ATF_BIN=`pwd`/bind/atf/bin
219 AC_SUBST(ATF_CFLAGS)
220 AC_SUBST(ATF_LDFLAGS)
221 AC_SUBST(ATF_BIN)
222 BINDCONFIG="$BINDCONFIG --with-atf"
223 elif test "$atf_path" != "no" ; then
224 # Config path for pkg-config
225 atf_pcp=""
226 if test "$atf_path" != "yes" ; then
227 if test -f $atf_path/lib/pkgconfig/atf-c.pc ; then
228 atf_pcp=$atf_path/lib/pkgconfig
229 elif test -f $atf_path/lib64/pkgconfig/atf-c.pc ; then
230 atf_pcp=$atf_path/lib64/pkgconfig
231 fi
232 else
233 # Not specified, try some common paths
234 atf_dirs="/usr /usr/local /usr/pkg /opt /opt/local"
235 for d in $atf_dirs
236 do
237 if test -f $d/lib/pkgconfig/atf-c.pc ; then
238 atf_pcp=$d/lib/pkgconfig
239 atf_path=$d
240 elif test -f $d/lib64/pkgconfig/atf-c.pc ; then
241 atf_pcp=$d/lib64/pkgconfig
242 atf_path=$d
243 fi
244 done
245 fi
246
247 if test "$atf_pcp" = "" ; then
248 AC_MSG_ERROR([Unable to find atf files in location specified])
249 else
250 ATF_CFLAGS="`PKG_CONFIG_PATH=$atf_pcp pkg-config --cflags atf-c` -DUNIT_TEST"
251 ATF_LDFLAGS="`PKG_CONFIG_PATH=$atf_pcp pkg-config --libs atf-c`"
252 if test -f $atf_pcp/atf-sh.pc ; then
253 ATF_BIN="`PKG_CONFIG_PATH=$atf_pcp pkg-config --variable=exec_prefix atf-sh`/bin"
254 else
255 # older versions don't have atf-sh, try usual place
256 ATF_BIN=$atf_path/bin
257 fi
258
259 if test ! -x $ATF_BIN/atf-run -o ! -x $ATF_BIN/atf-report ; then
260 AC_MSG_WARN([atf-run,atf-report not found, assuming they are in your path])
261 fi
262
263 AC_SUBST(ATF_CFLAGS)
264 AC_SUBST(ATF_LDFLAGS)
265 AC_SUBST(ATF_BIN)
266 fi
267 fi
268
269 AM_CONDITIONAL(HAVE_ATF, test "$atf_pcp" != "")
270 AM_COND_IF([HAVE_ATF], [AC_DEFINE([HAVE_ATF], [1], [ATF framework specified?])])
271
272 ###
273 ### Path fun. Older versions of DHCP were installed in /usr/sbin, so we
274 ### need to look there and potentially overwrite by default (but not if
275 ### the user configures an alternate value). LOCALSTATEDIR is totally
276 ### braindead. No one uses /usr/local/var/db/ nor /usr/local/var/run, and
277 ### they would be insane for suggesting it. We need to look in /var/for
278 ### 'db' and 'state/dhcp' for db files, and /var/run for pid files by
279 ### default.
280 ###
281 AC_PREFIX_PROGRAM(dhcpd)
282
283 # XXX - isn't there SOME WAY to default autoconf to /var instead of
284 # /usr/local/var/no/one/has/this/please/stop/trying?
285 case "$localstatedir" in
286 '${prefix}/var')
287 localstatedir=/var
288 ;;
289 esac
290
291 # Allow specification of alternate state files
292 AC_ARG_WITH(srv-lease-file,
293 AS_HELP_STRING([--with-srv-lease-file=PATH],[File for dhcpd leases
294 (default is LOCALSTATEDIR/db/dhcpd.leases)]),
295 AC_DEFINE_UNQUOTED([_PATH_DHCPD_DB], ["$withval"],
296 [File for dhcpd leases.]))
297
298 AC_MSG_CHECKING([for dhcpd.leases location])
299 if [[ "x$with_srv_lease_file" = "x" ]] ; then
300 if [[ -d "${localstatedir}/db" ]] ; then
301 with_srv_lease_file="${localstatedir}/db/dhcpd.leases"
302 elif [[ -d "${localstatedir}/state" ]] ; then
303 if [[ -d "${localstatedir}/state/dhcp" ]] ; then
304 with_srv_lease_file="${localstatedir}/state/dhcp/dhcpd.leases"
305 else
306 with_srv_lease_file="${localstatedir}/state/dhcpd.leases"
307 fi
308 elif [[ -d "${localstatedir}/lib" ]] ; then
309 if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
310 with_srv_lease_file="${localstatedir}/lib/dhcp/dhcpd.leases"
311 else
312 with_srv_lease_file="${localstatedir}/lib/dhcpd.leases"
313 fi
314 elif [[ -d "${localstatedir}/etc" ]] ; then
315 with_srv_lease_file="${localstatedir}/etc/dhcpd.leases"
316 else
317 with_srv_lease_file="/etc/dhcpd.leases"
318 fi
319 fi
320 AC_MSG_RESULT($with_srv_lease_file)
321
322 AC_ARG_WITH(srv6-lease-file,
323 AS_HELP_STRING([--with-srv6-lease-file=PATH],[File for dhcpd6 leases
324 (default is LOCALSTATEDIR/db/dhcpd6.leases)]),
325 AC_DEFINE_UNQUOTED([_PATH_DHCPD6_DB], ["$withval"],
326 [File for dhcpd6 leases.]))
327
328 AC_MSG_CHECKING([for dhcpd6.leases location])
329 if [[ "x$with_srv6_lease_file" = "x" ]] ; then
330 if [[ -d "${localstatedir}/db" ]] ; then
331 with_srv6_lease_file="${localstatedir}/db/dhcpd6.leases"
332 elif [[ -d "${localstatedir}/state" ]] ; then
333 if [[ -d "${localstatedir}/state/dhcp" ]] ; then
334 with_srv6_lease_file="${localstatedir}/state/dhcp/dhcpd6.leases"
335 else
336 with_srv6_lease_file="${localstatedir}/state/dhcpd6.leases"
337 fi
338 elif [[ -d "${localstatedir}/lib" ]] ; then
339 if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
340 with_srv6_lease_file="${localstatedir}/lib/dhcp/dhcpd6.leases"
341 else
342 with_srv6_lease_file="${localstatedir}/lib/dhcpd6.leases"
343 fi
344 elif [[ -d "${localstatedir}/etc" ]] ; then
345 with_srv6_lease_file="${localstatedir}/etc/dhcpd6.leases"
346 else
347 with_srv6_lease_file="/etc/dhcpd6.leases"
348 fi
349 fi
350 AC_MSG_RESULT($with_srv6_lease_file)
351
352 AC_ARG_WITH(cli-lease-file,
353 AS_HELP_STRING([--with-cli-lease-file=PATH],[File for dhclient leases
354 (default is LOCALSTATEDIR/db/dhclient.leases)]),
355 AC_DEFINE_UNQUOTED([_PATH_DHCLIENT_DB], ["$withval"],
356 [File for dhclient leases.]))
357
358 AC_MSG_CHECKING([for dhclient.leases location])
359 if [[ "x$with_cli_lease_file" = "x" ]] ; then
360 if [[ -d "${localstatedir}/db" ]] ; then
361 with_cli_lease_file="${localstatedir}/db/dhclient.leases"
362 elif [[ -d "${localstatedir}/state" ]] ; then
363 if [[ -d "${localstatedir}/state/dhcp" ]] ; then
364 with_cli_lease_file="${localstatedir}/state/dhcp/dhclient.leases"
365 else
366 with_cli_lease_file="${localstatedir}/state/dhclient.leases"
367 fi
368 elif [[ -d "${localstatedir}/lib" ]] ; then
369 if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
370 with_cli_lease_file="${localstatedir}/lib/dhcp/dhclient.leases"
371 else
372 with_cli_lease_file="${localstatedir}/lib/dhclient.leases"
373 fi
374 elif [[ -d "${localstatedir}/etc" ]] ; then
375 with_cli_lease_file="${localstatedir}/etc/dhclient.leases"
376 else
377 with_cli_lease_file="/etc/dhclient.leases"
378 fi
379 fi
380 AC_MSG_RESULT($with_cli_lease_file)
381
382 AC_ARG_WITH(cli6-lease-file,
383 AS_HELP_STRING([--with-cli6-lease-file=PATH],[File for dhclient6 leases
384 (default is LOCALSTATEDIR/db/dhclient6.leases)]),
385 AC_DEFINE_UNQUOTED([_PATH_DHCLIENT6_DB], ["$withval"],
386 [File for dhclient6 leases.]))
387
388 AC_MSG_CHECKING([for dhclient6.leases location])
389 if [[ "x$with_cli6_lease_file" = "x" ]] ; then
390 if [[ -d "${localstatedir}/db" ]] ; then
391 with_cli6_lease_file="${localstatedir}/db/dhclient6.leases"
392 elif [[ -d "${localstatedir}/state" ]] ; then
393 if [[ -d "${localstatedir}/state/dhcp" ]] ; then
394 with_cli6_lease_file="${localstatedir}/state/dhcp/dhclient6.leases"
395 else
396 with_cli6_lease_file="${localstatedir}/state/dhclient6.leases"
397 fi
398 elif [[ -d "${localstatedir}/lib" ]] ; then
399 if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
400 with_cli6_lease_file="${localstatedir}/lib/dhcp/dhclient6.leases"
401 else
402 with_cli6_lease_file="${localstatedir}/lib/dhclient6.leases"
403 fi
404 elif [[ -d "${localstatedir}/etc" ]] ; then
405 with_cli6_lease_file="${localstatedir}/etc/dhclient6.leases"
406 else
407 with_cli6_lease_file="/etc/dhclient6.leases"
408 fi
409 fi
410 AC_MSG_RESULT($with_cli6_lease_file)
411
412 AC_ARG_WITH(srv-pid-file,
413 AS_HELP_STRING([--with-srv-pid-file=PATH],[File for dhcpd process information
414 (default is LOCALSTATEDIR/run/dhcpd.pid)]),
415 AC_DEFINE_UNQUOTED([_PATH_DHCPD_PID], ["$withval"],
416 [File for dhcpd process information.]))
417 AC_ARG_WITH(srv6-pid-file,
418 AS_HELP_STRING([--with-srv6-pid-file=PATH],[File for dhcpd6 process information
419 (default is LOCALSTATEDIR/run/dhcpd6.pid)]),
420 AC_DEFINE_UNQUOTED([_PATH_DHCPD6_PID], ["$withval"],
421 [File for dhcpd6 process information.]))
422 AC_ARG_WITH(cli-pid-file,
423 AS_HELP_STRING([--with-cli-pid-file=PATH],[File for dhclient process information
424 (default is LOCALSTATEDIR/run/dhclient.pid)]),
425 AC_DEFINE_UNQUOTED([_PATH_DHCLIENT_PID], ["$withval"],
426 [File for dhclient process information.]))
427 AC_ARG_WITH(cli6-pid-file,
428 AS_HELP_STRING([--with-cli6-pid-file=PATH],[File for dhclient6 process information
429 (default is LOCALSTATEDIR/run/dhclient6.pid)]),
430 AC_DEFINE_UNQUOTED([_PATH_DHCLIENT6_PID], ["$withval"],
431 [File for dhclient6 process information.]))
432 AC_ARG_WITH(relay-pid-file,
433 AS_HELP_STRING([--with-relay-pid-file=PATH],[File for dhcrelay process information
434 (default is LOCALSTATEDIR/run/dhcrelay.pid)]),
435 AC_DEFINE_UNQUOTED([_PATH_DHCRELAY_PID], ["$withval"],
436 [File for dhcrelay process information.]))
437 AC_ARG_WITH(relay6-pid-file,
438 AS_HELP_STRING([--with-relay6-pid-file=PATH],[File for dhcrelay6 process information
439 (default is LOCALSTATEDIR/run/dhcrelay6.pid)]),
440 AC_DEFINE_UNQUOTED([_PATH_DHCRELAY6_PID], ["$withval"],
441 [File for dhcrelay6 process information.]))
442
443 # Check basic types.
444 AC_TYPE_INT8_T
445 AC_TYPE_INT16_T
446 AC_TYPE_INT32_T
447 AC_TYPE_INT64_T
448
449 # Some systems need the u_intX_t types defined across.
450 AC_CHECK_TYPE([u_int8_t], [], [
451 AC_TYPE_UINT8_T
452 AC_DEFINE(u_int8_t, [uint8_t], [Define a type for 8-bit unsigned
453 integers.])
454 ])
455 AC_CHECK_TYPE([u_int16_t], [], [
456 AC_TYPE_UINT16_T
457 AC_DEFINE(u_int16_t, [uint16_t], [Define a type for 16-bit unsigned
458 integers.])
459 ])
460 AC_CHECK_TYPE([u_int32_t], [], [
461 AC_TYPE_UINT32_T
462 AC_DEFINE(u_int32_t, [uint32_t], [Define a type for 32-bit unsigned
463 integers.])
464 ])
465 AC_CHECK_TYPE([u_int64_t], [], [
466 AC_TYPE_UINT64_T
467 AC_DEFINE(u_int64_t, [uint64_t], [Define a type for 64-bit unsigned
468 integers.])
469 ])
470
471 # see if ifaddrs.h is available
472 AC_CHECK_HEADERS(ifaddrs.h)
473
474 # figure out what IPv4 interface code to use
475 AC_CHECK_HEADERS(linux/types.h) # needed for linux/filter.h on old systems
476
477 AC_CHECK_HEADER(linux/filter.h, DO_LPF=1, ,
478 [
479 #ifdef HAVE_LINUX_TYPES_H
480 #include <linux/types.h>
481 #endif
482 ])
483 if test -n "$DO_LPF"
484 then
485 AC_DEFINE([HAVE_LPF], [1],
486 [Define to 1 to use the Linux Packet Filter interface code.])
487 else
488 AC_CHECK_HEADER(sys/dlpi.h, DO_DLPI=1)
489 if test -n "$DO_DLPI"
490 then
491 AC_DEFINE([HAVE_DLPI], [1],
492 [Define to 1 to use DLPI interface code.])
493 else
494 AC_CHECK_HEADER(net/bpf.h, DO_BPF=1)
495 if test -n "$DO_BPF"
496 then
497 AC_DEFINE([HAVE_BPF], [1],
498 [Define to 1 to use the
499 Berkeley Packet Filter interface code.])
500 fi
501 fi
502 fi
503
504 # SIOCGLIFCONF uses some transport structures. Trick is not all platforms
505 # use the same structures. We like to use 'struct lifconf' and 'struct
506 # lifreq', but we'll use these other structures if they're present. HPUX
507 # does not define 'struct lifnum', but does use SIOCGLIFNUM - they use an
508 # int value.
509 #
510 AC_MSG_CHECKING([for struct lifnum])
511 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h>
512 #include <sys/socket.h>
513 #include <net/if.h>
514 ]], [[ struct lifnum a;
515 ]])],[AC_MSG_RESULT(yes)
516 AC_DEFINE([ISC_PLATFORM_HAVELIFNUM], [1],
517 [Define to 1 if the system has 'struct lifnum'.])],[AC_MSG_RESULT(no)])
518
519 AC_MSG_CHECKING([for struct if_laddrconf])
520 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h>
521 #include <net/if6.h>
522 ]], [[ struct if_laddrconf a;
523 ]])],[AC_MSG_RESULT(yes)
524 AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRCONF], [1],
525 [Define to 1 if the system has 'struct if_laddrconf'.])],[AC_MSG_RESULT(no)])
526
527 AC_MSG_CHECKING([for struct if_laddrreq])
528 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
529 #include <net/if6.h>
530 ]], [[ struct if_laddrreq a;
531 ]])],[AC_MSG_RESULT(yes)
532 AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRREQ], [1],
533 [Define to 1 if the system has 'struct if_laddrreq'.])],[AC_MSG_RESULT(no)])
534
535 #
536 # check for GCC noreturn attribute
537 #
538 AC_MSG_CHECKING(for GCC noreturn attribute)
539 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[void foo() __attribute__((noreturn));]])],[AC_MSG_RESULT(yes)
540 AC_DEFINE([ISC_DHCP_NORETURN], [__attribute__((noreturn))],
541 [Define to the string for a noreturn attribute.])],[AC_MSG_RESULT(no)
542 AC_DEFINE([ISC_DHCP_NORETURN], [],
543 [Define to the string for a noreturn attribute.])])
544
545 # Look for optional headers.
546 AC_CHECK_HEADERS(sys/socket.h net/if_dl.h net/if6.h regex.h)
547
548 # Solaris needs some libraries for functions
549 AC_SEARCH_LIBS(socket, [socket])
550 AC_SEARCH_LIBS(inet_ntoa, [nsl])
551
552 AC_SEARCH_LIBS(inet_aton, [socket nsl], ,
553 AC_DEFINE([NEED_INET_ATON], [1],
554 [Define to 1 if the inet_aton() function is missing.]))
555
556 # Check for a standalone regex library.
557 AC_SEARCH_LIBS(regcomp, [regex])
558
559 AC_CHECK_FUNCS(strlcat)
560
561 # For HP/UX we need -lipv6 for if_nametoindex, perhaps others.
562 AC_SEARCH_LIBS(if_nametoindex, [ipv6])
563
564 # check for /dev/random (declares HAVE_DEV_RANDOM)
565 AC_CHECK_FILE(/dev/random,
566 AC_DEFINE([HAVE_DEV_RANDOM], [1],
567 [Define to 1 if you have the /dev/random file.]))
568
569 # see if there is a "sa_len" field in our interface information structure
570 AC_CHECK_MEMBER(struct sockaddr.sa_len,
571 AC_DEFINE([HAVE_SA_LEN], [],
572 [Define to 1 if the sockaddr structure has a length field.]),
573 ,
574 [#include <sys/socket.h>])
575
576 # figure out pointer size
577 AC_CHECK_SIZEOF(struct iaddr *, , [
578 #include "includes/inet.h"
579 #include <stdio.h>
580 ])
581
582 # Solaris does not have the msg_control or msg_controlen members
583 # in the msghdr structure unless you define:
584 #
585 # _XOPEN_SOURCE, _XOPEN_SOURCE_EXTENDED, and __EXTENSIONS__
586 #
587 # See the "standards" man page for details.
588 #
589 # We check for the msg_control member, and if it is not found, we check
590 # again with the appropriate defines added to the CFLAGS. (In order to
591 # do this we have to remove the check from the cache, which is what the
592 # "unset" is for.)
593 AC_CHECK_MEMBER(struct msghdr.msg_control,,
594 [CFLAGS="$CFLAGS -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
595 CFLAGS="$CFLAGS -D__EXTENSIONS__"
596 unset ac_cv_member_struct_msghdr_msg_control
597 AC_CHECK_MEMBER(struct msghdr.msg_control,,
598 [AC_MSG_ERROR([Missing msg_control member in
599 msg_control structure.])],
600 [
601 #include <sys/types.h>
602 #include <sys/socket.h>
603 ])
604 ],
605 [
606 #include <sys/types.h>
607 #include <sys/socket.h>
608 ])
609
610 AC_CHECK_MEMBER(struct tpacket_auxdata.tp_vlan_tci,
611 [AC_DEFINE([VLAN_TCI_PRESENT], [1], [tpacket_auxdata.tp_vlan_tci present])]
612 ,, [#include <linux/if_packet.h>])
613
614 libbind=
615 AC_ARG_WITH(libbind,
616 AS_HELP_STRING([--with-libbind=PATH],[bind includes and libraries are in PATH
617 (default is ./bind)]),
618 use_libbind="$withval", use_libbind="no")
619 case "$use_libbind" in
620 yes)
621 libbind="\${top_srcdir}/bind"
622 ;;
623 no)
624 libbind="\${top_srcdir}/bind"
625 ;;
626 *)
627 libbind="$use_libbind"
628 if test ! -d "bind"; then
629 AC_MSG_WARN(empty bind directory)
630 fi
631 ;;
632 esac
633
634 # OpenLDAP support.
635 AC_ARG_WITH(ldap,
636 AS_HELP_STRING([--with-ldap],[enable OpenLDAP support in dhcpd (default is no)]),
637 [ldap=$withval],
638 [ldap=no])
639
640 # OpenLDAP with SSL support.
641 AC_ARG_WITH(ldapcrypto,
642 AS_HELP_STRING([--with-ldapcrypto],[enable OpenLDAP crypto support in dhcpd (default is no)]),
643 [ldapcrypto=$withval],
644 [ldapcrypto=no])
645
646 # Gssapi to allow LDAP to authenticate with a keytab
647 AC_ARG_WITH(ldap-gssapi,
648 AC_HELP_STRING([--with-ldap-gssapi],
649 [enable krb5/gssapi authentication for OpenLDAP in dhcpd (default is no)]),
650 [ldap_gssapi=$withval],
651 [ldap_gssapi=no])
652
653
654 # LDAP CASA auth support.
655 AC_ARG_WITH(ldapcasa,
656 AC_HELP_STRING([--with-ldapcasa],
657 [enable LDAP CASA auth support in dhcpd (default is no)]),
658 [ldapcasa=$withval],
659 [ldapcasa=no])
660
661 # OpenLDAP support is disabled by default, if enabled then SSL support is an
662 # extra optional that is also disabled by default. Enabling LDAP SSL support
663 # implies enabling LDAP support. Similarly, KRB5 support implies LDAP support,
664 # but doesn't include SSL. The two are not dependant.
665 if test x$ldap = xyes || test x$ldapcrypto = xyes || test x$ldap_gssapi = xyes; then
666 saved_LIBS="$LIBS"
667 LIBS=""
668 AC_SEARCH_LIBS(ldap_initialize, [ldap], ,
669 AC_MSG_FAILURE([*** Cannot find ldap_initialize with -lldap - do you need to install an OpenLDAP2 Devel package?]))
670 AC_SEARCH_LIBS(ber_pvt_opt_on, [lber], ,
671 AC_MSG_FAILURE([*** Cannot find ber_pvt_opt_on with -llber - do you need to install an OpenLDAP2 Devel package?]))
672 if test x$ldap_gssapi = xyes ; then
673 AC_SEARCH_LIBS(krb5_init_context, [krb5], ,
674 AC_MSG_FAILURE([*** Cannot find krb5_init_context with -lkrb5 - do you need to install a Kerberos Devel package?]))
675 fi
676
677 # Create LDAP_LIBS which we specify them explicitly rather than lumping them in with LIBS
678 AC_SUBST(LDAP_LIBS, [$LIBS])
679 LIBS="$saved_LIBS"
680
681
682 AC_CHECK_HEADERS([ldap.h])
683 AC_CHECK_FUNCS([inet_pton inet_ntop])
684
685
686 LDAP_CFLAGS="-DLDAP_CONFIGURATION"
687
688 if test x$ldapcasa = xyes ; then
689 AC_CHECK_HEADERS([micasa_mgmd.h],[
690 LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_CASA_AUTH"
691 ], AC_MSG_FAILURE([*** Cannot find micasa_mgmd.h for ldap casa auth support]))
692 fi
693
694 if test x$ldapcrypto = xyes ; then
695 LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_USE_SSL"
696 fi
697
698 if test x$ldap_gssapi = xyes; then
699 LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_USE_GSSAPI"
700 fi
701
702 AC_SUBST(LDAP_CFLAGS, [$LDAP_CFLAGS])
703 fi
704
705 # Append selected warning levels to CFLAGS before substitution (but after
706 # AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[]) & etc).
707 CFLAGS="$CFLAGS $STD_CWARNINGS"
708
709 # Try to add the bind include directory
710 CFLAGS="$CFLAGS -I$libbind/include"
711
712 case "$host" in
713 *-darwin*)
714 CFLAGS="$CFLAGS -D__APPLE_USE_RFC_3542" ;;
715 esac
716
717 AC_C_FLEXIBLE_ARRAY_MEMBER
718
719 AC_CONFIG_FILES([
720 Makefile
721 bind/Makefile
722 client/Makefile
723 client/tests/Makefile
724 common/Makefile
725 common/tests/Makefile
726 dhcpctl/Makefile
727 includes/Makefile
728 omapip/Makefile
729 relay/Makefile
730 server/Makefile
731 tests/Makefile
732 tests/unittest.sh
733 server/tests/Makefile
734 doc/devel/doxyfile
735 ])
736 AC_OUTPUT
737
738 sh util/bindvar.sh
739
740 cat > config.report << END
741
742 ISC DHCP source configure results:
743 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
744
745 Package:
746 Name: $PACKAGE_NAME
747 Version: $PACKAGE_VERSION
748
749 C Compiler: $CC
750
751 Flags:
752 DEFS: $DEFS
753 CFLAGS: $CFLAGS
754
755 Features:
756 debug: $enable_debug
757 failover: $enable_failover
758 execute: $enable_execute
759 binary-leases: $enable_binary_leases
760 dhcpv6: $enable_dhcpv6
761 delayed-ack: $enable_delayed_ack
762
763 Developer:
764 ATF unittests : $atf_path
765
766 END
767 # TODO: Add Perl system tests
768
769 if test "$atf_path" != "no"
770 then
771 echo "ATF_CFLAGS : $ATF_CFLAGS" >> config.report
772 echo "ATF_LDFLAGS : $ATF_LDFLAGS" >> config.report
773 echo "ATF_BIN : $ATF_BIN" >> config.report
774 echo
775 fi
776
777 cat config.report
778
779 echo
780 echo Now you can type "make" to build ISC DHCP
781 echo