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