]> git.ipfire.org Git - thirdparty/dhcp.git/blame - configure.ac
Reverting previous commit (changes should go to rt26273, not HEAD)
[thirdparty/dhcp.git] / configure.ac
CommitLineData
05ae2d15 1AC_INIT([DHCP], [4.2.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],
53 [create a debug-only version of the software (default is no).]))
54# This is very much off by default.
55if test "$enable_debug" = "yes" ; then
56 AC_DEFINE([DEBUG], [1],
57 [Define to compile debug-only DHCP software.])
58 # Just override CFLAGS to totally to remove optimization.
59 CFLAGS="-g"
60fi
61# XXX: there are actually quite a lot more DEBUG_ features we could enable,
62# but I don't want to pollute the --help space.
63#
64#/* #define DEBUG_TOKENS */
65#/* #define DEBUG_PACKET */
66#/* #define DEBUG_EXPRESSIONS */
67#/* #define DEBUG_FIND_LEASE */
68#/* #define DEBUG_EXPRESSION_PARSE */
69#/* #define DEBUG_CLASS_MATCHING */
70#/* #define DEBUG_MEMORY_LEAKAGE */
71#/* #define DEBUG_MALLOC_POOL */
72#/* #define DEBUG_LEASE_STATE_TRANSITIONS */
73#/* #define DEBUG_RC_HISTORY */
74#/* #define DEBUG_RC_HISTORY_EXHAUSTIVELY */
75#/* #define RC_HISTORY_MAX 10240 */
76#/* #define POINTER_DEBUG */
77#/* #define DEBUG_FAILOVER_MESSAGES */
78#/* #define DEBUG_FAILOVER_TIMING */
79#/* #define DEBUG_DUMP_ALL_LEASES */
80
81# Failover optional compile-time feature.
82AC_ARG_ENABLE(failover,
83 AC_HELP_STRING([--enable-failover],
84 [enable support for failover (default is yes)]))
85# Failover is on by default, so define if it is not explicitly disabled.
86if test "$enable_failover" != "no"; then
87 AC_DEFINE([FAILOVER_PROTOCOL], [1],
88 [Define to include Failover Protocol support.])
89fi
90
91# execute() support.
92AC_ARG_ENABLE(execute,
93 AC_HELP_STRING([--enable-execute],
94 [enable support for execute() in config (default is yes)]))
95# execute() is on by default, so define if it is not explicitly disabled.
96if test "$enable_execute" != "no" ; then
97 AC_DEFINE([ENABLE_EXECUTE], [1],
98 [Define to include execute() config language support.])
99fi
100
101# Server tracing support.
102AC_ARG_ENABLE(tracing,
103 AC_HELP_STRING([--enable-tracing],
104 [enable support for server activity tracing (default is yes)]))
105# tracing is on by default, so define if it is not explicitly disabled.
106if test "$enable_tracing" != "no" ; then
107 AC_DEFINE([TRACING], [1],
108 [Define to include server activity tracing support.])
109fi
110
fbcee149
DH
111# Delayed-ack feature support (experimental).
112AC_ARG_ENABLE(delayed_ack,
113 AC_HELP_STRING([--enable-delayed-ack],
114 [queues multiple DHCPACK replies (default is no)]))
115if test "$enable_delayed_ack" = "yes"; then
116 AC_DEFINE([DELAYED_ACK], [1],
117 [Define to queue multiple DHCPACK replies per fsync.])
118fi
119
66cebfcb 120# DHCPv6 optional compile-time feature.
fe5b0fdd
DH
121AC_ARG_ENABLE(dhcpv6,
122 AC_HELP_STRING([--enable-dhcpv6],
d00d373a 123 [enable support for DHCPv6 (default is yes)]))
66cebfcb 124# DHCPv6 is on by default, so define if it is not explicitly disabled.
d00d373a 125if test "$enable_dhcpv6" != "no"; then
fe5b0fdd 126 AC_DEFINE([DHCPv6], [1],
d00d373a
SK
127 [Define to 1 to include DHCPv6 support.])
128fi
fe5b0fdd 129
63971a83
DH
130# PARANOIA is off by default (until we can test it with all features)
131AC_ARG_ENABLE(paranoia,
132 AC_HELP_STRING([--enable-paranoia],
133 [enable support for chroot/setuid (default is no)]))
134AC_ARG_ENABLE(early_chroot,
26ef247f 135 AC_HELP_STRING([--enable-early-chroot],
63971a83
DH
136 [enable chrooting prior to configuration (default is no)]))
137# If someone enables early chroot, but does not enable paranoia, do so for
138# them.
139if test "$enable_paranoia" != "yes" && \
140 test "$enable_early_chroot" = "yes" ; then
141 enable_paranoia="yes"
142fi
143
144if test "$enable_paranoia" = "yes" ; then
145 AC_DEFINE([PARANOIA], [1],
146 [Define to any value to include Ari's PARANOIA patch.])
147fi
148if test "$enable_early_chroot" = "yes" ; then
149 AC_DEFINE([EARLY_CHROOT], [1],
150 [Define to any value to chroot() prior to loading config.])
151fi
152
7cfeb916
SR
153AC_ARG_ENABLE(IPv4_PKTINFO,
154 AC_HELP_STRING([--enable-ipv4-pktinfo],
155 [enable use of pktinfo on IPv4 sockets (default is no)]))
156
157if test "$enable_ipv4_pktinfo" = "yes"; then
158 AC_DEFINE([USE_V4_PKTINFO], [1],
159 [Define to 1 to enable IPv4 packet info support.])
160fi
161
162AC_ARG_ENABLE(USE_SOCKETS,
163 AC_HELP_STRING([--enable-use-sockets],
164 [use the standard BSD socket API (default is no)]))
165
166if test "$enable_use_sockets" = "yes"; then
167 AC_DEFINE([USE_SOCKETS], [1],
168 [Define to 1 to use the standard BSD socket API.])
169fi
170
f8b3c6f4
DH
171###
172### Path fun. Older versions of DHCP were installed in /usr/sbin, so we
173### need to look there and potentially overwrite by default (but not if
174### the user configures an alternate value). LOCALSTATEDIR is totally
175### braindead. No one uses /usr/local/var/db/ nor /usr/local/var/run, and
176### they would be insane for suggesting it. We need to look in /var/for
177### 'db' and 'state/dhcp' for db files, and /var/run for pid files by
178### default.
179###
180AC_PREFIX_PROGRAM(dhcpd)
181
182# XXX - isn't there SOME WAY to default autoconf to /var instead of
183# /usr/local/var/no/one/has/this/please/stop/trying?
184case "$localstatedir" in
185 '${prefix}/var')
186 localstatedir=/var
187 ;;
188esac
189
fe5b0fdd
DH
190# Allow specification of alternate state files
191AC_ARG_WITH(srv-lease-file,
192 AC_HELP_STRING([--with-srv-lease-file=PATH],
193 [File for dhcpd leases
194 (default is LOCALSTATEDIR/db/dhcpd.leases)]),
195 AC_DEFINE_UNQUOTED([_PATH_DHCPD_DB], ["$withval"],
196 [File for dhcpd leases.]))
f8b3c6f4
DH
197
198echo -n "checking for dhcpd.leases location..."
199if [[ "x$with_srv_lease_file" = "x" ]] ; then
200 if [[ -d "${localstatedir}/db" ]] ; then
201 with_srv_lease_file="${localstatedir}/db/dhcpd.leases"
202 elif [[ -d "${localstatedir}/state" ]] ; then
203 if [[ -d "${localstatedir}/state/dhcp" ]] ; then
204 with_srv_lease_file="${localstatedir}/state/dhcp/dhcpd.leases"
205 else
206 with_srv_lease_file="${localstatedir}/state/dhcpd.leases"
207 fi
208 elif [[ -d "${localstatedir}/lib" ]] ; then
209 if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
210 with_srv_lease_file="${localstatedir}/lib/dhcp/dhcpd.leases"
211 else
212 with_srv_lease_file="${localstatedir}/lib/dhcpd.leases"
213 fi
214 elif [[ -d "${localstatedir}/etc" ]] ; then
215 with_srv_lease_file="${localstatedir}/etc/dhcpd.leases"
216 else
217 with_srv_lease_file="/etc/dhcpd.leases"
218 fi
219fi
220echo "$with_srv_lease_file"
221
8dea7ba7
FD
222AC_ARG_WITH(srv6-lease-file,
223 AC_HELP_STRING([--with-srv6-lease-file=PATH],
224 [File for dhcpd6 leases
225 (default is LOCALSTATEDIR/db/dhcpd6.leases)]),
226 AC_DEFINE_UNQUOTED([_PATH_DHCPD6_DB], ["$withval"],
227 [File for dhcpd6 leases.]))
228
229echo -n "checking for dhcpd6.leases location..."
230if [[ "x$with_srv6_lease_file" = "x" ]] ; then
231 if [[ -d "${localstatedir}/db" ]] ; then
232 with_srv6_lease_file="${localstatedir}/db/dhcpd6.leases"
233 elif [[ -d "${localstatedir}/state" ]] ; then
234 if [[ -d "${localstatedir}/state/dhcp" ]] ; then
235 with_srv6_lease_file="${localstatedir}/state/dhcp/dhcpd6.leases"
236 else
237 with_srv6_lease_file="${localstatedir}/state/dhcpd6.leases"
238 fi
239 elif [[ -d "${localstatedir}/lib" ]] ; then
240 if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
241 with_srv6_lease_file="${localstatedir}/lib/dhcp/dhcpd6.leases"
242 else
243 with_srv6_lease_file="${localstatedir}/lib/dhcpd6.leases"
244 fi
245 elif [[ -d "${localstatedir}/etc" ]] ; then
246 with_srv6_lease_file="${localstatedir}/etc/dhcpd6.leases"
247 else
248 with_srv6_lease_file="/etc/dhcpd6.leases"
249 fi
250fi
251echo "$with_srv6_lease_file"
252
fe5b0fdd
DH
253AC_ARG_WITH(cli-lease-file,
254 AC_HELP_STRING([--with-cli-lease-file=PATH],
255 [File for dhclient leases
256 (default is LOCALSTATEDIR/db/dhclient.leases)]),
257 AC_DEFINE_UNQUOTED([_PATH_DHCLIENT_DB], ["$withval"],
258 [File for dhclient leases.]))
f8b3c6f4
DH
259
260echo -n "checking for dhclient.leases location..."
261if [[ "x$with_cli_lease_file" = "x" ]] ; then
262 if [[ -d "${localstatedir}/db" ]] ; then
263 with_cli_lease_file="${localstatedir}/db/dhclient.leases"
264 elif [[ -d "${localstatedir}/state" ]] ; then
265 if [[ -d "${localstatedir}/state/dhcp" ]] ; then
266 with_cli_lease_file="${localstatedir}/state/dhcp/dhclient.leases"
267 else
268 with_cli_lease_file="${localstatedir}/state/dhclient.leases"
269 fi
270 elif [[ -d "${localstatedir}/lib" ]] ; then
271 if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
272 with_cli_lease_file="${localstatedir}/lib/dhcp/dhclient.leases"
273 else
274 with_cli_lease_file="${localstatedir}/lib/dhclient.leases"
275 fi
276 elif [[ -d "${localstatedir}/etc" ]] ; then
277 with_cli_lease_file="${localstatedir}/etc/dhclient.leases"
278 else
279 with_cli_lease_file="/etc/dhclient.leases"
280 fi
281fi
282echo "$with_cli_lease_file"
283
8dea7ba7
FD
284AC_ARG_WITH(cli6-lease-file,
285 AC_HELP_STRING([--with-cli6-lease-file=PATH],
286 [File for dhclient6 leases
287 (default is LOCALSTATEDIR/db/dhclient6.leases)]),
288 AC_DEFINE_UNQUOTED([_PATH_DHCLIENT6_DB], ["$withval"],
289 [File for dhclient6 leases.]))
290
291echo -n "checking for dhclient6.leases location..."
292if [[ "x$with_cli6_lease_file" = "x" ]] ; then
293 if [[ -d "${localstatedir}/db" ]] ; then
294 with_cli6_lease_file="${localstatedir}/db/dhclient6.leases"
295 elif [[ -d "${localstatedir}/state" ]] ; then
296 if [[ -d "${localstatedir}/state/dhcp" ]] ; then
297 with_cli6_lease_file="${localstatedir}/state/dhcp/dhclient6.leases"
298 else
299 with_cli6_lease_file="${localstatedir}/state/dhclient6.leases"
300 fi
301 elif [[ -d "${localstatedir}/lib" ]] ; then
302 if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
303 with_cli6_lease_file="${localstatedir}/lib/dhcp/dhclient6.leases"
304 else
305 with_cli6_lease_file="${localstatedir}/lib/dhclient6.leases"
306 fi
307 elif [[ -d "${localstatedir}/etc" ]] ; then
308 with_cli6_lease_file="${localstatedir}/etc/dhclient6.leases"
309 else
310 with_cli6_lease_file="/etc/dhclient6.leases"
311 fi
312fi
313echo "$with_cli6_lease_file"
314
fe5b0fdd
DH
315AC_ARG_WITH(srv-pid-file,
316 AC_HELP_STRING([--with-srv-pid-file=PATH],
317 [File for dhcpd process information
318 (default is LOCALSTATEDIR/run/dhcpd.pid)]),
319 AC_DEFINE_UNQUOTED([_PATH_DHCPD_PID], ["$withval"],
320 [File for dhcpd process information.]))
8dea7ba7
FD
321AC_ARG_WITH(srv6-pid-file,
322 AC_HELP_STRING([--with-srv6-pid-file=PATH],
323 [File for dhcpd6 process information
324 (default is LOCALSTATEDIR/run/dhcpd6.pid)]),
325 AC_DEFINE_UNQUOTED([_PATH_DHCPD6_PID], ["$withval"],
326 [File for dhcpd6 process information.]))
fe5b0fdd
DH
327AC_ARG_WITH(cli-pid-file,
328 AC_HELP_STRING([--with-cli-pid-file=PATH],
329 [File for dhclient process information
330 (default is LOCALSTATEDIR/run/dhclient.pid)]),
8dea7ba7 331 AC_DEFINE_UNQUOTED([_PATH_DHCLIENT_PID], ["$withval"],
fe5b0fdd 332 [File for dhclient process information.]))
8dea7ba7
FD
333AC_ARG_WITH(cli6-pid-file,
334 AC_HELP_STRING([--with-cli6-pid-file=PATH],
335 [File for dhclient6 process information
336 (default is LOCALSTATEDIR/run/dhclient6.pid)]),
337 AC_DEFINE_UNQUOTED([_PATH_DHCLIENT6_PID], ["$withval"],
338 [File for dhclient6 process information.]))
fe5b0fdd
DH
339AC_ARG_WITH(relay-pid-file,
340 AC_HELP_STRING([--with-relay-pid-file=PATH],
341 [File for dhcrelay process information
342 (default is LOCALSTATEDIR/run/dhcrelay.pid)]),
343 AC_DEFINE_UNQUOTED([_PATH_DHCRELAY_PID], ["$withval"],
344 [File for dhcrelay process information.]))
4a5bfeac
SR
345AC_ARG_WITH(relay6-pid-file,
346 AC_HELP_STRING([--with-relay6-pid-file=PATH],
347 [File for dhcrelay6 process information
348 (default is LOCALSTATEDIR/run/dhcrelay6.pid)]),
349 AC_DEFINE_UNQUOTED([_PATH_DHCRELAY6_PID], ["$withval"],
350 [File for dhcrelay6 process information.]))
fe5b0fdd 351
cd3f0b9b
DH
352# Check basic types.
353AC_TYPE_INT8_T
354AC_TYPE_INT16_T
355AC_TYPE_INT32_T
4e0997c6 356AC_TYPE_INT64_T
cd3f0b9b
DH
357
358# Some systems need the u_intX_t types defined across.
359AC_CHECK_TYPE([u_int8_t], [], [
360 AC_TYPE_UINT8_T
361 AC_DEFINE(u_int8_t, [uint8_t], [Define a type for 8-bit unsigned
362 integers.])
363])
364AC_CHECK_TYPE([u_int16_t], [], [
365 AC_TYPE_UINT16_T
366 AC_DEFINE(u_int16_t, [uint16_t], [Define a type for 16-bit unsigned
367 integers.])
368])
369AC_CHECK_TYPE([u_int32_t], [], [
370 AC_TYPE_UINT32_T
371 AC_DEFINE(u_int32_t, [uint32_t], [Define a type for 32-bit unsigned
372 integers.])
373])
4e0997c6
SR
374AC_CHECK_TYPE([u_int64_t], [], [
375 AC_TYPE_UINT64_T
376 AC_DEFINE(u_int64_t, [uint64_t], [Define a type for 64-bit unsigned
377 integers.])
378])
cd3f0b9b 379
b8c0eda0
MA
380# see if ifaddrs.h is available
381AC_CHECK_HEADERS(ifaddrs.h)
382
fe5b0fdd 383# figure out what IPv4 interface code to use
f125dc8b
SK
384AC_CHECK_HEADERS(linux/types.h) # needed for linux/filter.h on old systems
385
386AC_CHECK_HEADER(linux/filter.h, DO_LPF=1, ,
387[
388#ifdef HAVE_LINUX_TYPES_H
389#include <linux/types.h>
390#endif
391])
392if test -n "$DO_LPF"
393then
a57df74a 394 AC_DEFINE([HAVE_LPF], [1],
f125dc8b
SK
395 [Define to 1 to use the Linux Packet Filter interface code.])
396else
397 AC_CHECK_HEADER(sys/dlpi.h, DO_DLPI=1)
398 if test -n "$DO_DLPI"
399 then
a57df74a 400 AC_DEFINE([HAVE_DLPI], [1],
f125dc8b
SK
401 [Define to 1 to use DLPI interface code.])
402 else
403 AC_CHECK_HEADER(net/bpf.h, DO_BPF=1)
404 if test -n "$DO_BPF"
405 then
a57df74a 406 AC_DEFINE([HAVE_BPF], [""],
f125dc8b
SK
407 [Define to 1 to use the
408 Berkeley Packet Filter interface code.])
409 fi
410 fi
f125dc8b 411fi
fe5b0fdd 412
8da06bb1
DH
413# SIOCGLIFCONF uses some transport structures. Trick is not all platforms
414# use the same structures. We like to use 'struct lifconf' and 'struct
415# lifreq', but we'll use these other structures if they're present. HPUX
416# does not define 'struct lifnum', but does use SIOCGLIFNUM - they use an
417# int value.
418#
419AC_MSG_CHECKING([for struct lifnum])
420AC_TRY_COMPILE(
421[ #include <sys/types.h>
cff9b78f 422 #include <sys/socket.h>
8da06bb1
DH
423 #include <net/if.h>
424],
425[ struct lifnum a;
426],
427 [AC_MSG_RESULT(yes)
428 AC_DEFINE([ISC_PLATFORM_HAVELIFNUM], [1],
429 [Define to 1 if the system has 'struct lifnum'.])],
430 [AC_MSG_RESULT(no)])
431
432AC_MSG_CHECKING([for struct if_laddrconf])
433AC_TRY_COMPILE(
434[ #include <sys/types.h>
435 #include <net/if6.h>
436],
437[ struct if_laddrconf a;
438],
439 [AC_MSG_RESULT(yes)
440 AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRCONF], [1],
441 [Define to 1 if the system has 'struct if_laddrconf'.])],
442 [AC_MSG_RESULT(no)])
443
444AC_MSG_CHECKING([for struct if_laddrreq])
445AC_TRY_LINK(
446[#include <sys/types.h>
447 #include <net/if6.h>
448],
449[ struct if_laddrreq a;
450],
451 [AC_MSG_RESULT(yes)
452 AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRREQ], [1],
453 [Define to 1 if the system has 'struct if_laddrreq'.])],
454 [AC_MSG_RESULT(no)])
455
6dd7efa2 456# Look for optional headers.
cff9b78f 457AC_CHECK_HEADERS(sys/socket.h net/if_dl.h net/if6.h regex.h)
6dd7efa2 458
fe5b0fdd
DH
459# Solaris needs some libraries for functions
460AC_SEARCH_LIBS(socket, [socket])
461AC_SEARCH_LIBS(inet_ntoa, [nsl])
462
463AC_SEARCH_LIBS(inet_aton, [socket nsl], ,
464 AC_DEFINE([NEED_INET_ATON], [1],
465 [Define to 1 if the inet_aton() function is missing.]))
466
dd328225
DH
467# Check for a standalone regex library.
468AC_SEARCH_LIBS(regcomp, [regex])
469
2394b26b
DH
470# For HP/UX we need -lipv6 for if_nametoindex, perhaps others.
471AC_SEARCH_LIBS(if_nametoindex, [ipv6])
472
fe5b0fdd
DH
473# check for /dev/random (declares HAVE_DEV_RANDOM)
474AC_CHECK_FILE(/dev/random,
475 AC_DEFINE([HAVE_DEV_RANDOM], [1],
476 [Define to 1 if you have the /dev/random file.]))
477
478# see if there is a "sa_len" field in our interface information structure
479AC_CHECK_MEMBER(struct sockaddr.sa_len,
480 AC_DEFINE([HAVE_SA_LEN], [],
481 [Define to 1 if the sockaddr structure has a length field.]),
482 ,
483 [#include <sys/socket.h>])
484
76c944da
SK
485# figure out pointer size
486AC_CHECK_SIZEOF(struct iaddr *, , [
487#include "includes/inet.h"
488#include <stdio.h>
489])
490
847e7000
SK
491# Solaris does not have the msg_control or msg_controlen members in
492# in the msghdr structure unless you define:
493#
494# _XOPEN_SOURCE, _XOPEN_SOURCE_EXTENDED, and __EXTENSIONS__
495#
496# See the "standards" man page for details.
497#
498# We check for the msg_control member, and if it is not found, we check
499# again with the appropriate defines added to the CFLAGS. (In order to
500# do this we have to remove the check from the cache, which is what the
501# "unset" is for.)
502AC_CHECK_MEMBER(struct msghdr.msg_control,,
503 [CFLAGS="$CFLAGS -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
504 CFLAGS="$CFLAGS -D__EXTENSIONS__"
505 unset ac_cv_member_struct_msghdr_msg_control
506 AC_CHECK_MEMBER(struct msghdr.msg_control,,
507 [AC_MSG_ERROR([Missing msg_control member in
508 msg_control structure.])],
06eb8bab
SK
509 [
510#include <sys/types.h>
511#include <sys/socket.h>
512 ])
513 ],
514 [
515#include <sys/types.h>
516#include <sys/socket.h>
517 ])
847e7000 518
93eda9ab 519libbind=
98bf1607
SR
520AC_ARG_WITH(libbind,
521 AC_HELP_STRING([--with-libbind=PATH],
522 [bind includes and libraries are in PATH
523 (default is ./bind)]),
524 use_libbind="$withval", use_libbind="no")
525case "$use_libbind" in
526yes)
527 libbind="\${top_srcdir}/bind"
528 ;;
529no)
530 libbind="\${top_srcdir}/bind"
531 ;;
532*)
533 libbind="$use_libbind"
534 ;;
535esac
536
33692791
DH
537# OpenLDAP support.
538AC_ARG_WITH(ldap,
539 AC_HELP_STRING([--with-ldap],
540 [enable OpenLDAP support in dhcpd (default is no)]),
541 [ldap=$withval],
542 [ldap=no])
543
544# OpenLDAP with SSL support.
545AC_ARG_WITH(ldapcrypto,
546 AC_HELP_STRING([--with-ldapcrypto],
547 [enable OpenLDAP crypto support in dhcpd (default is no)]),
548 [ldapcrypto=$withval],
549 [ldapcrypto=no])
550
551# OpenLDAP support is disabled by default, if enabled then SSL support is an
552# extra optional that is also disabled by default. Enabling LDAP SSL support
553# implies enabling LDAP support.
554if test x$ldap = xyes || test x$ldapcrypto = xyes ; then
555 AC_SEARCH_LIBS(ldap_initialize, [ldap], ,
556 AC_MSG_FAILURE([*** Cannot find ldap_initialize with -lldap - do you need to install an OpenLDAP2 Devel package?]))
8a0d9ca4
SR
557 AC_SEARCH_LIBS(ber_pvt_opt_on, [lber], ,
558 AC_MSG_FAILURE([*** Cannot find ber_pvt_opt_on with -llber - do you need to install an OpenLDAP2 Devel package?]))
33692791
DH
559
560 if test x$ldapcrypto = xyes ; then
561 AC_SUBST(LDAP_CFLAGS, ["-DLDAP_CONFIGURATION -DLDAP_USE_SSL"])
562 else
563 AC_SUBST(LDAP_CFLAGS, ["-DLDAP_CONFIGURATION"])
564 fi
565fi
566
eaf7eb17
DH
567# Append selected warning levels to CFLAGS before substitution (but after
568# AC_TRY_COMPILE & etc).
569CFLAGS="$CFLAGS $STD_CWARNINGS"
570
98bf1607
SR
571# Try to add the bind include directory
572CFLAGS="$CFLAGS -I$libbind/include"
573
a3528574
SR
574AC_C_FLEXIBLE_ARRAY_MEMBER
575
6ecda39c 576AC_OUTPUT([
fe5b0fdd
DH
577 Makefile
578 client/Makefile
579 common/Makefile
6e999c3c 580 common/tests/Makefile
fe5b0fdd
DH
581 dhcpctl/Makefile
582 dst/Makefile
583 includes/Makefile
fe5b0fdd
DH
584 omapip/Makefile
585 relay/Makefile
586 server/Makefile
6e999c3c 587 tests/Makefile
6ecda39c 588])
fe5b0fdd 589
95bba8b6 590sh util/bindvar.sh