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