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