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