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