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