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