]> git.ipfire.org Git - thirdparty/dhcp.git/blob - configure.ac
Added an AR configure variable and regen
[thirdparty/dhcp.git] / configure.ac
1 AC_INIT([DHCP],[4.3.3],[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 # We can have some flags to pass to bind configure
36 BINDCONFIG=
37 if test "$cross_compiling" = "yes"; then
38 BINDCONFIG="--host=$host"
39 fi
40 AC_SUBST(BINDCONFIG)
41 AM_CONDITIONAL(CROSS_COMPILING, test "$cross_compiling" = "yes")
42
43 # POSIX doesn't include the IPv6 Advanced Socket API and glibc hides
44 # parts of the IPv6 Advanced Socket API as a result. This is stupid
45 # as it breaks how the two halves (Basic and Advanced) of the IPv6
46 # Socket API were designed to be used but we have to live with it.
47 # Use this to define _GNU_SOURCE to pull in the IPv6 Advanced Socket API.
48 AC_USE_SYSTEM_EXTENSIONS
49
50 AC_PROG_RANLIB
51
52 AC_PATH_PROG(AR, ar)
53 AC_SUBST(AR)
54
55 AC_CONFIG_HEADERS([includes/config.h])
56
57 # we sometimes need to know byte order for building packets
58 AC_C_BIGENDIAN(AC_SUBST(byte_order, BIG_ENDIAN),
59 AC_SUBST(byte_order, LITTLE_ENDIAN))
60 AC_DEFINE_UNQUOTED([DHCP_BYTE_ORDER], [$byte_order],
61 [Define to BIG_ENDIAN for MSB (Motorola or SPARC CPUs)
62 or LITTLE_ENDIAN for LSB (Intel CPUs).])
63
64 # Optional compile-time DEBUGging.
65 AC_ARG_ENABLE(debug,
66 AS_HELP_STRING([--enable-debug],[create a debug-only version of the software (default is no).]),
67 [case "${enableval}" in
68 yes) enable_debug=yes
69 AC_DEFINE([DEBUG], [1],
70 [Define to compile debug-only DHCP software.])
71 # Just override CFLAGS totally to remove optimization.
72 CFLAGS="-g";;
73 no) enable_debug=no ;;
74 *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
75 esac],[enable_debug=no])
76
77 # XXX: there are actually quite a lot more DEBUG_ features we could enable,
78 # but I don't want to pollute the --help space.
79 #
80 #/* #define DEBUG_TOKENS */
81 #/* #define DEBUG_PACKET */
82 #/* #define DEBUG_EXPRESSIONS */
83 #/* #define DEBUG_FIND_LEASE */
84 #/* #define DEBUG_EXPRESSION_PARSE */
85 #/* #define DEBUG_CLASS_MATCHING */
86 #/* #define DEBUG_MEMORY_LEAKAGE */
87 #/* #define DEBUG_MALLOC_POOL */
88 #/* #define DEBUG_LEASE_STATE_TRANSITIONS */
89 #/* #define DEBUG_RC_HISTORY */
90 #/* #define DEBUG_RC_HISTORY_EXHAUSTIVELY */
91 #/* #define RC_HISTORY_MAX 10240 */
92 #/* #define POINTER_DEBUG */
93 #/* #define DEBUG_FAILOVER_MESSAGES */
94 #/* #define DEBUG_FAILOVER_TIMING */
95 #/* #define DEBUG_DUMP_ALL_LEASES */
96
97 # Failover optional compile-time feature.
98 AC_ARG_ENABLE(failover,
99 AS_HELP_STRING([--enable-failover],[enable support for failover (default is yes)]))
100 # Failover is on by default, so define if it is not explicitly disabled.
101 if test "$enable_failover" != "no"; then
102 enable_failover="yes"
103 AC_DEFINE([FAILOVER_PROTOCOL], [1],
104 [Define to include Failover Protocol support.])
105 fi
106
107 # execute() support.
108 AC_ARG_ENABLE(execute,
109 AS_HELP_STRING([--enable-execute],[enable support for execute() in config (default is yes)]))
110 # execute() is on by default, so define if it is not explicitly disabled.
111 if test "$enable_execute" != "no" ; then
112 enable_execute="yes"
113 AC_DEFINE([ENABLE_EXECUTE], [1],
114 [Define to include execute() config language support.])
115 fi
116
117 # Server tracing support.
118 AC_ARG_ENABLE(tracing,
119 AS_HELP_STRING([--enable-tracing],[enable support for server activity tracing (default is yes)]))
120 # tracing is on by default, so define if it is not explicitly disabled.
121 if test "$enable_tracing" != "no" ; then
122 AC_DEFINE([TRACING], [1],
123 [Define to include server activity tracing support.])
124 fi
125
126 # Delayed-ack feature support (experimental).
127 AC_ARG_ENABLE(delayed_ack,
128 AS_HELP_STRING([--enable-delayed-ack],[queues multiple DHCPACK replies (default is no)]))
129 if test "$enable_delayed_ack" = "yes"; then
130 AC_DEFINE([DELAYED_ACK], [1],
131 [Define to queue multiple DHCPACK replies per fsync.])
132 else
133 enable_delayed_ack="no"
134 fi
135
136 # DHCPv6 optional compile-time feature.
137 AC_ARG_ENABLE(dhcpv6,
138 AS_HELP_STRING([--enable-dhcpv6],[enable support for DHCPv6 (default is yes)]))
139 # DHCPv6 is on by default, so define if it is not explicitly disabled.
140 if test "$enable_dhcpv6" != "no"; then
141 enable_dhcpv6="yes"
142 AC_DEFINE([DHCPv6], [1],
143 [Define to 1 to include DHCPv6 support.])
144 fi
145
146 # PARANOIA is off by default (until we can test it with all features)
147 AC_ARG_ENABLE(paranoia,
148 AS_HELP_STRING([--enable-paranoia],[enable support for chroot/setuid (default is no)]))
149 AC_ARG_ENABLE(early_chroot,
150 AS_HELP_STRING([--enable-early-chroot],[enable chrooting prior to configuration (default is no)]))
151 # If someone enables early chroot, but does not enable paranoia, do so for
152 # them.
153 if test "$enable_paranoia" != "yes" && \
154 test "$enable_early_chroot" = "yes" ; then
155 enable_paranoia="yes"
156 fi
157
158 if test "$enable_paranoia" = "yes" ; then
159 AC_DEFINE([PARANOIA], [1],
160 [Define to any value to include Ari's PARANOIA patch.])
161 fi
162 if test "$enable_early_chroot" = "yes" ; then
163 AC_DEFINE([EARLY_CHROOT], [1],
164 [Define to any value to chroot() prior to loading config.])
165 fi
166
167 AC_ARG_ENABLE(ipv4_pktinfo,
168 AS_HELP_STRING([--enable-ipv4-pktinfo],[enable use of pktinfo on IPv4 sockets (default is no)]))
169
170 if test "$enable_ipv4_pktinfo" = "yes"; then
171 AC_DEFINE([USE_V4_PKTINFO], [1],
172 [Define to 1 to enable IPv4 packet info support.])
173 fi
174
175 AC_ARG_ENABLE(use_sockets,
176 AS_HELP_STRING([--enable-use-sockets],[use the standard BSD socket API (default is no)]))
177
178 if test "$enable_use_sockets" = "yes"; then
179 AC_DEFINE([USE_SOCKETS], [1],
180 [Define to 1 to use the standard BSD socket API.])
181 fi
182
183 # Try to hnadle incorrect byte order for secs field
184 # This is off by default
185 AC_ARG_ENABLE(secs_byteorder,
186 AS_HELP_STRING([--enable-secs-byteorder],[Correct bad byteorders in the secs field (default is no).]))
187
188 if test "$enable_secs_byteorder" = "yes" ; then
189 AC_DEFINE([SECS_BYTEORDER], [1],
190 [Define to correct bad byteorders in secs field.])
191 fi
192
193 # Include the PID in the log messages. This is useful when there may
194 # be multiple instances of a program.
195 # This is off by default
196 AC_ARG_ENABLE(log_pid,
197 AS_HELP_STRING([--enable-log-pid],[Include PIDs in syslog messages (default is no).]))
198 if test "$enable_log_pid" = "yes" ; then
199 AC_DEFINE([USE_LOG_PID], [1],
200 [Define to include PIDs in syslog messages.])
201 fi
202
203 # Allow for binary search when inserting v4 leases into queues
204 AC_ARG_ENABLE(binary_leases,
205 AS_HELP_STRING([--enable-binary-leases],[enable support for binary insertion of leases (default is no)]))
206 # binary_leases is off by default.
207 if test "$enable_binary_leases" = "yes"; then
208 AC_DEFINE([BINARY_LEASES], [1],
209 [Define to support binary insertion of leases into queues.])
210 else
211 enable_binary_leases="no"
212 fi
213
214 # Testing section
215
216 atf_path="no"
217 AC_ARG_WITH([atf],
218 AS_HELP_STRING([--with-atf=PATH],[specify location where atf was installed (or "bind")]),
219 [atf_path="$withval"])
220 AM_CONDITIONAL(BIND_ATF, test "$atf_path" = "bind")
221 if test "$atf_path" = "bind" ; then
222 atf_pcp="bind"
223 atf_path="\${top_srcdir}/bind/atf"
224 ATF_CFLAGS="-I$atf_path/include -DUNIT_TEST"
225 ATF_LDFLAGS="-L$atf_path/lib -latf-c"
226 ATF_BIN=`pwd`/bind/atf/bin
227 AC_SUBST(ATF_CFLAGS)
228 AC_SUBST(ATF_LDFLAGS)
229 AC_SUBST(ATF_BIN)
230 BINDCONFIG="$BINDCONFIG --with-atf"
231 elif test "$atf_path" != "no" ; then
232 # Config path for pkg-config
233 atf_pcp=""
234 if test "$atf_path" != "yes" ; then
235 if test -f $atf_path/lib/pkgconfig/atf-c.pc ; then
236 atf_pcp=$atf_path/lib/pkgconfig
237 elif test -f $atf_path/lib64/pkgconfig/atf-c.pc ; then
238 atf_pcp=$atf_path/lib64/pkgconfig
239 fi
240 else
241 # Not specified, try some common paths
242 atf_dirs="/usr /usr/local /usr/pkg /opt /opt/local"
243 for d in $atf_dirs
244 do
245 if test -f $d/lib/pkgconfig/atf-c.pc ; then
246 atf_pcp=$d/lib/pkgconfig
247 atf_path=$d
248 elif test -f $d/lib64/pkgconfig/atf-c.pc ; then
249 atf_pcp=$d/lib64/pkgconfig
250 atf_path=$d
251 fi
252 done
253 fi
254
255 if test "$atf_pcp" = "" ; then
256 AC_MSG_ERROR([Unable to find atf files in location specified])
257 else
258 AC_CHECK_PROG([pkgcfg_found],[pkg-config],[pkg-config],[])
259 if test "$pkgcfg_found" = ""; then
260 AC_MSG_ERROR([Could not locate ATF, pkg-config not installed])
261 fi
262 ATF_CFLAGS="`PKG_CONFIG_PATH=$atf_pcp pkg-config --cflags atf-c` -DUNIT_TEST"
263 ATF_LDFLAGS="`PKG_CONFIG_PATH=$atf_pcp pkg-config --libs atf-c`"
264 if test -f $atf_pcp/atf-sh.pc ; then
265 ATF_BIN="`PKG_CONFIG_PATH=$atf_pcp pkg-config --variable=exec_prefix atf-sh`/bin"
266 else
267 # older versions don't have atf-sh, try usual place
268 ATF_BIN=$atf_path/bin
269 fi
270
271 if test ! -x $ATF_BIN/atf-run -o ! -x $ATF_BIN/atf-report ; then
272 AC_MSG_WARN([atf-run,atf-report not found, assuming they are in your path])
273 fi
274
275 AC_SUBST(ATF_CFLAGS)
276 AC_SUBST(ATF_LDFLAGS)
277 AC_SUBST(ATF_BIN)
278 fi
279 fi
280
281 AM_CONDITIONAL(HAVE_ATF, test "$atf_pcp" != "")
282 AM_COND_IF([HAVE_ATF], [AC_DEFINE([HAVE_ATF], [1], [ATF framework specified?])])
283
284 ###
285 ### Path fun. Older versions of DHCP were installed in /usr/sbin, so we
286 ### need to look there and potentially overwrite by default (but not if
287 ### the user configures an alternate value). LOCALSTATEDIR is totally
288 ### braindead. No one uses /usr/local/var/db/ nor /usr/local/var/run, and
289 ### they would be insane for suggesting it. We need to look in /var/for
290 ### 'db' and 'state/dhcp' for db files, and /var/run for pid files by
291 ### default.
292 ###
293 AC_PREFIX_PROGRAM(dhcpd)
294
295 # XXX - isn't there SOME WAY to default autoconf to /var instead of
296 # /usr/local/var/no/one/has/this/please/stop/trying?
297 case "$localstatedir" in
298 '${prefix}/var')
299 localstatedir=/var
300 ;;
301 esac
302
303 # Allow specification of alternate state files
304 AC_ARG_WITH(srv-lease-file,
305 AS_HELP_STRING([--with-srv-lease-file=PATH],[File for dhcpd leases
306 (default is LOCALSTATEDIR/db/dhcpd.leases)]),
307 AC_DEFINE_UNQUOTED([_PATH_DHCPD_DB], ["$withval"],
308 [File for dhcpd leases.]))
309
310 AC_MSG_CHECKING([for dhcpd.leases location])
311 if [[ "x$with_srv_lease_file" = "x" ]] ; then
312 if [[ -d "${localstatedir}/db" ]] ; then
313 with_srv_lease_file="${localstatedir}/db/dhcpd.leases"
314 elif [[ -d "${localstatedir}/state" ]] ; then
315 if [[ -d "${localstatedir}/state/dhcp" ]] ; then
316 with_srv_lease_file="${localstatedir}/state/dhcp/dhcpd.leases"
317 else
318 with_srv_lease_file="${localstatedir}/state/dhcpd.leases"
319 fi
320 elif [[ -d "${localstatedir}/lib" ]] ; then
321 if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
322 with_srv_lease_file="${localstatedir}/lib/dhcp/dhcpd.leases"
323 else
324 with_srv_lease_file="${localstatedir}/lib/dhcpd.leases"
325 fi
326 elif [[ -d "${localstatedir}/etc" ]] ; then
327 with_srv_lease_file="${localstatedir}/etc/dhcpd.leases"
328 else
329 with_srv_lease_file="/etc/dhcpd.leases"
330 fi
331 fi
332 AC_MSG_RESULT($with_srv_lease_file)
333
334 AC_ARG_WITH(srv6-lease-file,
335 AS_HELP_STRING([--with-srv6-lease-file=PATH],[File for dhcpd6 leases
336 (default is LOCALSTATEDIR/db/dhcpd6.leases)]),
337 AC_DEFINE_UNQUOTED([_PATH_DHCPD6_DB], ["$withval"],
338 [File for dhcpd6 leases.]))
339
340 AC_MSG_CHECKING([for dhcpd6.leases location])
341 if [[ "x$with_srv6_lease_file" = "x" ]] ; then
342 if [[ -d "${localstatedir}/db" ]] ; then
343 with_srv6_lease_file="${localstatedir}/db/dhcpd6.leases"
344 elif [[ -d "${localstatedir}/state" ]] ; then
345 if [[ -d "${localstatedir}/state/dhcp" ]] ; then
346 with_srv6_lease_file="${localstatedir}/state/dhcp/dhcpd6.leases"
347 else
348 with_srv6_lease_file="${localstatedir}/state/dhcpd6.leases"
349 fi
350 elif [[ -d "${localstatedir}/lib" ]] ; then
351 if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
352 with_srv6_lease_file="${localstatedir}/lib/dhcp/dhcpd6.leases"
353 else
354 with_srv6_lease_file="${localstatedir}/lib/dhcpd6.leases"
355 fi
356 elif [[ -d "${localstatedir}/etc" ]] ; then
357 with_srv6_lease_file="${localstatedir}/etc/dhcpd6.leases"
358 else
359 with_srv6_lease_file="/etc/dhcpd6.leases"
360 fi
361 fi
362 AC_MSG_RESULT($with_srv6_lease_file)
363
364 AC_ARG_WITH(cli-lease-file,
365 AS_HELP_STRING([--with-cli-lease-file=PATH],[File for dhclient leases
366 (default is LOCALSTATEDIR/db/dhclient.leases)]),
367 AC_DEFINE_UNQUOTED([_PATH_DHCLIENT_DB], ["$withval"],
368 [File for dhclient leases.]))
369
370 AC_MSG_CHECKING([for dhclient.leases location])
371 if [[ "x$with_cli_lease_file" = "x" ]] ; then
372 if [[ -d "${localstatedir}/db" ]] ; then
373 with_cli_lease_file="${localstatedir}/db/dhclient.leases"
374 elif [[ -d "${localstatedir}/state" ]] ; then
375 if [[ -d "${localstatedir}/state/dhcp" ]] ; then
376 with_cli_lease_file="${localstatedir}/state/dhcp/dhclient.leases"
377 else
378 with_cli_lease_file="${localstatedir}/state/dhclient.leases"
379 fi
380 elif [[ -d "${localstatedir}/lib" ]] ; then
381 if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
382 with_cli_lease_file="${localstatedir}/lib/dhcp/dhclient.leases"
383 else
384 with_cli_lease_file="${localstatedir}/lib/dhclient.leases"
385 fi
386 elif [[ -d "${localstatedir}/etc" ]] ; then
387 with_cli_lease_file="${localstatedir}/etc/dhclient.leases"
388 else
389 with_cli_lease_file="/etc/dhclient.leases"
390 fi
391 fi
392 AC_MSG_RESULT($with_cli_lease_file)
393
394 AC_ARG_WITH(cli6-lease-file,
395 AS_HELP_STRING([--with-cli6-lease-file=PATH],[File for dhclient6 leases
396 (default is LOCALSTATEDIR/db/dhclient6.leases)]),
397 AC_DEFINE_UNQUOTED([_PATH_DHCLIENT6_DB], ["$withval"],
398 [File for dhclient6 leases.]))
399
400 AC_MSG_CHECKING([for dhclient6.leases location])
401 if [[ "x$with_cli6_lease_file" = "x" ]] ; then
402 if [[ -d "${localstatedir}/db" ]] ; then
403 with_cli6_lease_file="${localstatedir}/db/dhclient6.leases"
404 elif [[ -d "${localstatedir}/state" ]] ; then
405 if [[ -d "${localstatedir}/state/dhcp" ]] ; then
406 with_cli6_lease_file="${localstatedir}/state/dhcp/dhclient6.leases"
407 else
408 with_cli6_lease_file="${localstatedir}/state/dhclient6.leases"
409 fi
410 elif [[ -d "${localstatedir}/lib" ]] ; then
411 if [[ -d "${localstatedir}/lib/dhcp" ]] ; then
412 with_cli6_lease_file="${localstatedir}/lib/dhcp/dhclient6.leases"
413 else
414 with_cli6_lease_file="${localstatedir}/lib/dhclient6.leases"
415 fi
416 elif [[ -d "${localstatedir}/etc" ]] ; then
417 with_cli6_lease_file="${localstatedir}/etc/dhclient6.leases"
418 else
419 with_cli6_lease_file="/etc/dhclient6.leases"
420 fi
421 fi
422 AC_MSG_RESULT($with_cli6_lease_file)
423
424 AC_ARG_WITH(srv-pid-file,
425 AS_HELP_STRING([--with-srv-pid-file=PATH],[File for dhcpd process information
426 (default is LOCALSTATEDIR/run/dhcpd.pid)]),
427 AC_DEFINE_UNQUOTED([_PATH_DHCPD_PID], ["$withval"],
428 [File for dhcpd process information.]))
429 AC_ARG_WITH(srv6-pid-file,
430 AS_HELP_STRING([--with-srv6-pid-file=PATH],[File for dhcpd6 process information
431 (default is LOCALSTATEDIR/run/dhcpd6.pid)]),
432 AC_DEFINE_UNQUOTED([_PATH_DHCPD6_PID], ["$withval"],
433 [File for dhcpd6 process information.]))
434 AC_ARG_WITH(cli-pid-file,
435 AS_HELP_STRING([--with-cli-pid-file=PATH],[File for dhclient process information
436 (default is LOCALSTATEDIR/run/dhclient.pid)]),
437 AC_DEFINE_UNQUOTED([_PATH_DHCLIENT_PID], ["$withval"],
438 [File for dhclient process information.]))
439 AC_ARG_WITH(cli6-pid-file,
440 AS_HELP_STRING([--with-cli6-pid-file=PATH],[File for dhclient6 process information
441 (default is LOCALSTATEDIR/run/dhclient6.pid)]),
442 AC_DEFINE_UNQUOTED([_PATH_DHCLIENT6_PID], ["$withval"],
443 [File for dhclient6 process information.]))
444 AC_ARG_WITH(relay-pid-file,
445 AS_HELP_STRING([--with-relay-pid-file=PATH],[File for dhcrelay process information
446 (default is LOCALSTATEDIR/run/dhcrelay.pid)]),
447 AC_DEFINE_UNQUOTED([_PATH_DHCRELAY_PID], ["$withval"],
448 [File for dhcrelay process information.]))
449 AC_ARG_WITH(relay6-pid-file,
450 AS_HELP_STRING([--with-relay6-pid-file=PATH],[File for dhcrelay6 process information
451 (default is LOCALSTATEDIR/run/dhcrelay6.pid)]),
452 AC_DEFINE_UNQUOTED([_PATH_DHCRELAY6_PID], ["$withval"],
453 [File for dhcrelay6 process information.]))
454
455 # Check basic types.
456 AC_TYPE_INT8_T
457 AC_TYPE_INT16_T
458 AC_TYPE_INT32_T
459 AC_TYPE_INT64_T
460
461 # Some systems need the u_intX_t types defined across.
462 AC_CHECK_TYPE([u_int8_t], [], [
463 AC_TYPE_UINT8_T
464 AC_DEFINE(u_int8_t, [uint8_t], [Define a type for 8-bit unsigned
465 integers.])
466 ])
467 AC_CHECK_TYPE([u_int16_t], [], [
468 AC_TYPE_UINT16_T
469 AC_DEFINE(u_int16_t, [uint16_t], [Define a type for 16-bit unsigned
470 integers.])
471 ])
472 AC_CHECK_TYPE([u_int32_t], [], [
473 AC_TYPE_UINT32_T
474 AC_DEFINE(u_int32_t, [uint32_t], [Define a type for 32-bit unsigned
475 integers.])
476 ])
477 AC_CHECK_TYPE([u_int64_t], [], [
478 AC_TYPE_UINT64_T
479 AC_DEFINE(u_int64_t, [uint64_t], [Define a type for 64-bit unsigned
480 integers.])
481 ])
482
483 # see if ifaddrs.h is available
484 AC_CHECK_HEADERS(ifaddrs.h)
485
486 # figure out what IPv4 interface code to use
487 AC_CHECK_HEADERS(linux/types.h) # needed for linux/filter.h on old systems
488
489 AC_CHECK_HEADER(linux/filter.h, DO_LPF=1, ,
490 [
491 #ifdef HAVE_LINUX_TYPES_H
492 #include <linux/types.h>
493 #endif
494 ])
495 if test -n "$DO_LPF"
496 then
497 AC_DEFINE([HAVE_LPF], [1],
498 [Define to 1 to use the Linux Packet Filter interface code.])
499 else
500 AC_CHECK_HEADER(sys/dlpi.h, DO_DLPI=1)
501 if test -n "$DO_DLPI"
502 then
503 AC_DEFINE([HAVE_DLPI], [1],
504 [Define to 1 to use DLPI interface code.])
505 else
506 AC_CHECK_HEADER(net/bpf.h, DO_BPF=1)
507 if test -n "$DO_BPF"
508 then
509 AC_DEFINE([HAVE_BPF], [1],
510 [Define to 1 to use the
511 Berkeley Packet Filter interface code.])
512 fi
513 fi
514 fi
515
516 # SIOCGLIFCONF uses some transport structures. Trick is not all platforms
517 # use the same structures. We like to use 'struct lifconf' and 'struct
518 # lifreq', but we'll use these other structures if they're present. HPUX
519 # does not define 'struct lifnum', but does use SIOCGLIFNUM - they use an
520 # int value.
521 #
522 AC_MSG_CHECKING([for struct lifnum])
523 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h>
524 #include <sys/socket.h>
525 #include <net/if.h>
526 ]], [[ struct lifnum a;
527 ]])],[AC_MSG_RESULT(yes)
528 AC_DEFINE([ISC_PLATFORM_HAVELIFNUM], [1],
529 [Define to 1 if the system has 'struct lifnum'.])],[AC_MSG_RESULT(no)])
530
531 AC_MSG_CHECKING([for struct if_laddrconf])
532 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h>
533 #include <net/if6.h>
534 ]], [[ struct if_laddrconf a;
535 ]])],[AC_MSG_RESULT(yes)
536 AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRCONF], [1],
537 [Define to 1 if the system has 'struct if_laddrconf'.])],[AC_MSG_RESULT(no)])
538
539 AC_MSG_CHECKING([for struct if_laddrreq])
540 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
541 #include <net/if6.h>
542 ]], [[ struct if_laddrreq a;
543 ]])],[AC_MSG_RESULT(yes)
544 AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRREQ], [1],
545 [Define to 1 if the system has 'struct if_laddrreq'.])],[AC_MSG_RESULT(no)])
546
547 #
548 # check for GCC noreturn attribute
549 #
550 AC_MSG_CHECKING(for GCC noreturn attribute)
551 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[void foo() __attribute__((noreturn));]])],[AC_MSG_RESULT(yes)
552 AC_DEFINE([ISC_DHCP_NORETURN], [__attribute__((noreturn))],
553 [Define to the string for a noreturn attribute.])],[AC_MSG_RESULT(no)
554 AC_DEFINE([ISC_DHCP_NORETURN], [],
555 [Define to the string for a noreturn attribute.])])
556
557 # Look for optional headers.
558 AC_CHECK_HEADERS(sys/socket.h net/if_dl.h net/if6.h regex.h)
559
560 # Solaris needs some libraries for functions
561 AC_SEARCH_LIBS(socket, [socket])
562 AC_SEARCH_LIBS(inet_ntoa, [nsl])
563
564 AC_SEARCH_LIBS(inet_aton, [socket nsl], ,
565 AC_DEFINE([NEED_INET_ATON], [1],
566 [Define to 1 if the inet_aton() function is missing.]))
567
568 # Check for a standalone regex library.
569 AC_SEARCH_LIBS(regcomp, [regex])
570
571 AC_CHECK_FUNCS(strlcat)
572
573 # For HP/UX we need -lipv6 for if_nametoindex, perhaps others.
574 AC_SEARCH_LIBS(if_nametoindex, [ipv6])
575
576 # check for /dev/random (declares HAVE_DEV_RANDOM)
577 AC_CHECK_FILE(/dev/random,
578 AC_DEFINE([HAVE_DEV_RANDOM], [1],
579 [Define to 1 if you have the /dev/random file.]))
580
581 # see if there is a "sa_len" field in our interface information structure
582 AC_CHECK_MEMBER(struct sockaddr.sa_len,
583 AC_DEFINE([HAVE_SA_LEN], [],
584 [Define to 1 if the sockaddr structure has a length field.]),
585 ,
586 [#include <sys/socket.h>])
587
588 # figure out pointer size
589 AC_CHECK_SIZEOF(struct iaddr *, , [
590 #include "includes/inet.h"
591 #include <stdio.h>
592 ])
593
594 # Solaris does not have the msg_control or msg_controlen members
595 # in the msghdr structure unless you define:
596 #
597 # _XOPEN_SOURCE, _XOPEN_SOURCE_EXTENDED, and __EXTENSIONS__
598 #
599 # See the "standards" man page for details.
600 #
601 # We check for the msg_control member, and if it is not found, we check
602 # again with the appropriate defines added to the CFLAGS. (In order to
603 # do this we have to remove the check from the cache, which is what the
604 # "unset" is for.)
605 AC_CHECK_MEMBER(struct msghdr.msg_control,,
606 [CFLAGS="$CFLAGS -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
607 CFLAGS="$CFLAGS -D__EXTENSIONS__"
608 unset ac_cv_member_struct_msghdr_msg_control
609 AC_CHECK_MEMBER(struct msghdr.msg_control,,
610 [AC_MSG_ERROR([Missing msg_control member in
611 msg_control structure.])],
612 [
613 #include <sys/types.h>
614 #include <sys/socket.h>
615 ])
616 ],
617 [
618 #include <sys/types.h>
619 #include <sys/socket.h>
620 ])
621
622 AC_CHECK_MEMBER(struct tpacket_auxdata.tp_vlan_tci,
623 [AC_DEFINE([VLAN_TCI_PRESENT], [1], [tpacket_auxdata.tp_vlan_tci present])]
624 ,, [#include <linux/if_packet.h>])
625
626 BINDDIR=
627 AC_ARG_WITH(libbind,
628 AS_HELP_STRING([--with-libbind=PATH],[bind includes and libraries are in PATH
629 (default is ./bind)]),
630 use_libbind="$withval", use_libbind="no")
631 case "$use_libbind" in
632 yes)
633 BINDDIR="\${top_srcdir}/bind"
634 ;;
635 no)
636 BINDDIR="\${top_srcdir}/bind"
637 ;;
638 *)
639 BINDDIR="$use_libbind"
640 if test ! -d "bind"; then
641 # no bind directory, create it with a fake Makefile.in
642 # (AC_CONFIG_FILES and top Makefile refer to it so
643 # it must exits)
644 mkdir bind
645 cat > bind/Makefile.in << EOF
646 # placeholder
647 all check clean distclean distdir install uninstall:
648
649 EOF
650 fi
651 ;;
652 esac
653 AC_SUBST(BINDDIR)
654
655 # OpenLDAP support.
656 AC_ARG_WITH(ldap,
657 AS_HELP_STRING([--with-ldap],[enable OpenLDAP support in dhcpd (default is no)]),
658 [ldap=$withval],
659 [ldap=no])
660
661 # OpenLDAP with SSL support.
662 AC_ARG_WITH(ldapcrypto,
663 AS_HELP_STRING([--with-ldapcrypto],[enable OpenLDAP crypto support in dhcpd (default is no)]),
664 [ldapcrypto=$withval],
665 [ldapcrypto=no])
666
667 # Gssapi to allow LDAP to authenticate with a keytab
668 AC_ARG_WITH(ldap-gssapi,
669 AC_HELP_STRING([--with-ldap-gssapi],
670 [enable krb5/gssapi authentication for OpenLDAP in dhcpd (default is no)]),
671 [ldap_gssapi=$withval],
672 [ldap_gssapi=no])
673
674
675 # LDAP CASA auth support.
676 AC_ARG_WITH(ldapcasa,
677 AC_HELP_STRING([--with-ldapcasa],
678 [enable LDAP CASA auth support in dhcpd (default is no)]),
679 [ldapcasa=$withval],
680 [ldapcasa=no])
681
682 # OpenLDAP support is disabled by default, if enabled then SSL support is an
683 # extra optional that is also disabled by default. Enabling LDAP SSL support
684 # implies enabling LDAP support. Similarly, KRB5 support implies LDAP support,
685 # but doesn't include SSL. The two are not dependant.
686 if test x$ldap = xyes || test x$ldapcrypto = xyes || test x$ldap_gssapi = xyes; then
687 saved_LIBS="$LIBS"
688 LIBS=""
689 AC_SEARCH_LIBS(ldap_initialize, [ldap], ,
690 AC_MSG_FAILURE([*** Cannot find ldap_initialize with -lldap - do you need to install an OpenLDAP2 Devel package?]))
691 AC_SEARCH_LIBS(ber_pvt_opt_on, [lber], ,
692 AC_MSG_FAILURE([*** Cannot find ber_pvt_opt_on with -llber - do you need to install an OpenLDAP2 Devel package?]))
693 if test x$ldap_gssapi = xyes ; then
694 AC_SEARCH_LIBS(krb5_init_context, [krb5], ,
695 AC_MSG_FAILURE([*** Cannot find krb5_init_context with -lkrb5 - do you need to install a Kerberos Devel package?]))
696 fi
697
698 # Create LDAP_LIBS which we specify them explicitly rather than lumping them in with LIBS
699 AC_SUBST(LDAP_LIBS, [$LIBS])
700 LIBS="$saved_LIBS"
701
702
703 AC_CHECK_HEADERS([ldap.h])
704 AC_CHECK_FUNCS([inet_pton inet_ntop])
705
706
707 LDAP_CFLAGS="-DLDAP_CONFIGURATION"
708
709 if test x$ldapcasa = xyes ; then
710 AC_CHECK_HEADERS([micasa_mgmd.h],[
711 LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_CASA_AUTH"
712 ], AC_MSG_FAILURE([*** Cannot find micasa_mgmd.h for ldap casa auth support]))
713 fi
714
715 if test x$ldapcrypto = xyes ; then
716 LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_USE_SSL"
717 fi
718
719 if test x$ldap_gssapi = xyes; then
720 LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_USE_GSSAPI"
721 fi
722
723 AC_SUBST(LDAP_CFLAGS, [$LDAP_CFLAGS])
724 fi
725
726 # Append selected warning levels to CFLAGS before substitution (but after
727 # AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[]) & etc).
728 CFLAGS="$CFLAGS $STD_CWARNINGS"
729
730 # Try to add the bind include directory
731 CFLAGS="$CFLAGS -I$BINDDIR/include"
732
733 case "$host" in
734 *-darwin*)
735 CFLAGS="$CFLAGS -D__APPLE_USE_RFC_3542" ;;
736 esac
737
738 AC_C_FLEXIBLE_ARRAY_MEMBER
739
740 AC_CONFIG_FILES([
741 Makefile
742 bind/Makefile
743 client/Makefile
744 client/tests/Makefile
745 common/Makefile
746 common/tests/Makefile
747 dhcpctl/Makefile
748 includes/Makefile
749 omapip/Makefile
750 relay/Makefile
751 server/Makefile
752 tests/Makefile
753 tests/unittest.sh
754 server/tests/Makefile
755 doc/devel/doxyfile
756 ])
757 AC_OUTPUT
758
759 sh util/bindvar.sh
760 if test $? -ne 0; then
761 AC_MSG_ERROR([*** util/bindvar.sh failed])
762 fi
763
764 cat > config.report << END
765
766 ISC DHCP source configure results:
767 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
768
769 Package:
770 Name: $PACKAGE_NAME
771 Version: $PACKAGE_VERSION
772
773 C Compiler: $CC
774
775 Flags:
776 DEFS: $DEFS
777 CFLAGS: $CFLAGS
778
779 Features:
780 debug: $enable_debug
781 failover: $enable_failover
782 execute: $enable_execute
783 binary-leases: $enable_binary_leases
784 dhcpv6: $enable_dhcpv6
785 delayed-ack: $enable_delayed_ack
786
787 Developer:
788 ATF unittests : $atf_path
789
790 END
791 # TODO: Add Perl system tests
792
793 if test "$atf_path" != "no"
794 then
795 echo "ATF_CFLAGS : $ATF_CFLAGS" >> config.report
796 echo "ATF_LDFLAGS : $ATF_LDFLAGS" >> config.report
797 echo "ATF_BIN : $ATF_BIN" >> config.report
798 echo
799 fi
800
801 cat config.report
802
803 echo
804 echo Now you can type "make" to build ISC DHCP
805 echo