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