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