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