package fixing
[profile/ivi/dhcp.git] / configure.ac
1 AC_INIT([DHCP], [4.2.3-P2], [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 # This is very much off by default.
55 if 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"
60 fi
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.
82 AC_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.
86 if test "$enable_failover" != "no"; then
87         AC_DEFINE([FAILOVER_PROTOCOL], [1],
88                   [Define to include Failover Protocol support.])
89 fi
90
91 # execute() support.
92 AC_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.
96 if test "$enable_execute" != "no" ; then
97         AC_DEFINE([ENABLE_EXECUTE], [1],
98                   [Define to include execute() config language support.])
99 fi
100
101 # Server tracing support.
102 AC_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.
106 if test "$enable_tracing" != "no" ; then
107         AC_DEFINE([TRACING], [1],
108                   [Define to include server activity tracing support.])
109 fi
110
111 # Delayed-ack feature support (experimental).
112 AC_ARG_ENABLE(delayed_ack,
113         AC_HELP_STRING([--enable-delayed-ack],
114                        [queues multiple DHCPACK replies (default is no)]))
115 if test "$enable_delayed_ack" = "yes"; then
116         AC_DEFINE([DELAYED_ACK], [1],
117                   [Define to queue multiple DHCPACK replies per fsync.])
118 fi
119
120 # DHCPv6 optional compile-time feature.
121 AC_ARG_ENABLE(dhcpv6,
122         AC_HELP_STRING([--enable-dhcpv6],
123                        [enable support for DHCPv6 (default is yes)]))
124 # DHCPv6 is on by default, so define if it is not explicitly disabled.
125 if test "$enable_dhcpv6" != "no"; then
126         AC_DEFINE([DHCPv6], [1], 
127                   [Define to 1 to include DHCPv6 support.])
128 fi
129
130 # PARANOIA is off by default (until we can test it with all features)
131 AC_ARG_ENABLE(paranoia,
132         AC_HELP_STRING([--enable-paranoia],
133                 [enable support for chroot/setuid (default is no)]))
134 AC_ARG_ENABLE(early_chroot,
135         AC_HELP_STRING([--enable-early-chroot],
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.
139 if test "$enable_paranoia" != "yes" && \
140    test "$enable_early_chroot" = "yes" ; then
141         enable_paranoia="yes"
142 fi
143
144 if test "$enable_paranoia" = "yes" ; then
145         AC_DEFINE([PARANOIA], [1],
146                   [Define to any value to include Ari's PARANOIA patch.])
147 fi
148 if test "$enable_early_chroot" = "yes" ; then
149         AC_DEFINE([EARLY_CHROOT], [1],
150                   [Define to any value to chroot() prior to loading config.])
151 fi
152
153 AC_ARG_ENABLE(IPv4_PKTINFO,
154         AC_HELP_STRING([--enable-ipv4-pktinfo],
155                 [enable use of pktinfo on IPv4 sockets (default is no)]))
156
157 if test "$enable_ipv4_pktinfo" = "yes"; then
158         AC_DEFINE([USE_V4_PKTINFO], [1],
159                 [Define to 1 to enable IPv4 packet info support.])
160 fi
161
162 AC_ARG_ENABLE(USE_SOCKETS,
163         AC_HELP_STRING([--enable-use-sockets],
164                 [use the standard BSD socket API (default is no)]))
165
166 if test "$enable_use_sockets" = "yes"; then
167         AC_DEFINE([USE_SOCKETS], [1],
168                 [Define to 1 to use the standard BSD socket API.])
169 fi
170
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 ###
180 AC_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?
184 case "$localstatedir" in
185         '${prefix}/var')
186                 localstatedir=/var
187                 ;;
188 esac
189
190 # Allow specification of alternate state files
191 AC_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.]))
197
198 echo -n "checking for dhcpd.leases location..."
199 if [[ "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
219 fi
220 echo "$with_srv_lease_file"
221
222 AC_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
229 echo -n "checking for dhcpd6.leases location..."
230 if [[ "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
250 fi
251 echo "$with_srv6_lease_file"
252
253 AC_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.]))
259
260 echo -n "checking for dhclient.leases location..."
261 if [[ "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
281 fi
282 echo "$with_cli_lease_file"
283
284 AC_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
291 echo -n "checking for dhclient6.leases location..."
292 if [[ "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
312 fi
313 echo "$with_cli6_lease_file"
314
315 AC_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.]))
321 AC_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.]))
327 AC_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)]),
331         AC_DEFINE_UNQUOTED([_PATH_DHCLIENT_PID], ["$withval"],
332                            [File for dhclient process information.]))
333 AC_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.]))
339 AC_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.]))
345 AC_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.]))
351
352 # Check basic types.
353 AC_TYPE_INT8_T
354 AC_TYPE_INT16_T
355 AC_TYPE_INT32_T
356 AC_TYPE_INT64_T
357
358 # Some systems need the u_intX_t types defined across.
359 AC_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 ])
364 AC_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 ])
369 AC_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 ])
374 AC_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 ])
379
380 # see if ifaddrs.h is available
381 AC_CHECK_HEADERS(ifaddrs.h)
382
383 # figure out what IPv4 interface code to use
384 AC_CHECK_HEADERS(linux/types.h)  # needed for linux/filter.h on old systems
385
386 AC_CHECK_HEADER(linux/filter.h, DO_LPF=1, ,
387 [
388 #ifdef HAVE_LINUX_TYPES_H
389 #include <linux/types.h>
390 #endif
391 ])
392 if test -n "$DO_LPF"
393 then
394         AC_DEFINE([HAVE_LPF], [1], 
395                   [Define to 1 to use the Linux Packet Filter interface code.])
396 else
397         AC_CHECK_HEADER(sys/dlpi.h, DO_DLPI=1)
398         if test -n "$DO_DLPI"
399         then
400                 AC_DEFINE([HAVE_DLPI], [1], 
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
406                         AC_DEFINE([HAVE_BPF], [""],
407                                   [Define to 1 to use the 
408                                    Berkeley Packet Filter interface code.])
409                 fi
410         fi
411 fi
412
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 #
419 AC_MSG_CHECKING([for struct lifnum])
420 AC_TRY_COMPILE(
421 [ #include <sys/types.h>
422   #include <sys/socket.h>
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
432 AC_MSG_CHECKING([for struct if_laddrconf])
433 AC_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
444 AC_MSG_CHECKING([for struct if_laddrreq])
445 AC_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
456 # Look for optional headers.
457 AC_CHECK_HEADERS(sys/socket.h net/if_dl.h net/if6.h regex.h)
458
459 # Solaris needs some libraries for functions
460 AC_SEARCH_LIBS(socket, [socket])
461 AC_SEARCH_LIBS(inet_ntoa, [nsl])
462
463 AC_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
467 # Check for a standalone regex library.
468 AC_SEARCH_LIBS(regcomp, [regex])
469
470 # For HP/UX we need -lipv6 for if_nametoindex, perhaps others.
471 AC_SEARCH_LIBS(if_nametoindex, [ipv6])
472
473 # check for /dev/random (declares HAVE_DEV_RANDOM)
474 AC_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
479 AC_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
485 # figure out pointer size
486 AC_CHECK_SIZEOF(struct iaddr *, , [
487 #include "includes/inet.h"
488 #include <stdio.h>
489 ])
490
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.)
502 AC_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.])],
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         ])
518
519 libbind=
520 AC_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")
525 case "$use_libbind" in 
526 yes)
527         libbind="\${top_srcdir}/bind"
528         ;;
529 no)
530         libbind="\${top_srcdir}/bind"
531         ;;
532 *)
533         libbind="$use_libbind"
534         ;;
535 esac
536
537 # OpenLDAP support.
538 AC_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.
545 AC_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.
554 if 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?]))
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?]))
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
565 fi
566
567 # Append selected warning levels to CFLAGS before substitution (but after
568 # AC_TRY_COMPILE & etc).
569 CFLAGS="$CFLAGS $STD_CWARNINGS"
570
571 # Try to add the bind include directory
572 CFLAGS="$CFLAGS -I$libbind/include"
573
574 AC_C_FLEXIBLE_ARRAY_MEMBER
575
576 AC_OUTPUT([
577   Makefile
578   client/Makefile
579   common/Makefile
580   common/tests/Makefile
581   dhcpctl/Makefile
582   dst/Makefile
583   includes/Makefile
584   omapip/Makefile
585   relay/Makefile
586   server/Makefile
587   tests/Makefile
588 ])
589
590 sh util/bindvar.sh