]>
Commit | Line | Data |
---|---|---|
0cd94b5e | 1 | AC_INIT([DHCP],[4.4.2-dev],[dhcp-users@isc.org]) |
13e5cc6c FD |
2 | |
3 | @BEGIN WITH LIBTOOL | |
4 | # for libtool | |
5 | AC_CONFIG_MACRO_DIR([m4]) | |
6 | @END WITH LIBTOOL | |
7 | ||
8 | # we specify "foreign" to avoid having to have the GNU mandated files, | |
9 | # like AUTHORS, COPYING, and such | |
bf6f8fce | 10 | AM_INIT_AUTOMAKE([foreign]) |
13e5cc6c FD |
11 | |
12 | # we specify AM_MAINTAINER_MODE to avoid problems with rebuilding | |
13 | # the configure and makefiles. Without it users doing things that | |
14 | # change the timestamps on the code, like checking it into a cvs | |
15 | # tree, could trigger a rebuild of the infrastructure files which | |
16 | # might fail if they don't have the correct tools. | |
17 | AM_MAINTAINER_MODE | |
18 | ||
19 | AC_CANONICAL_HOST | |
20 | ||
21 | # We want to turn on warnings if we are using gcc and the user did | |
22 | # not specify CFLAGS. The autoconf check for the C compiler sets the | |
23 | # CFLAGS if gcc is used, so we will save it before we run that check. | |
24 | SAVE_CFLAGS="$CFLAGS" | |
25 | ||
26 | # Now find our C compiler. | |
27 | AC_PROG_CC | |
28 | ||
29 | # Suppress warnings about --datarootdir | |
30 | AC_DEFUN([AC_DATAROOTDIR_CHECKED]) | |
31 | ||
32 | # If we have gcc, and AC_PROG_CC changed the flags, then we know the | |
33 | # user did not specify any flags. Add warnings in this case. | |
34 | if test "$GCC" = "yes"; then | |
35 | if test "$CFLAGS" != "$SAVE_CFLAGS"; then | |
36 | STD_CWARNINGS="$STD_CWARNINGS -Wall -Werror -fno-strict-aliasing" | |
37 | fi | |
38 | fi | |
39 | ||
40 | # We can have some flags to pass to bind configure | |
41 | BINDCONFIG= | |
42 | if test "$cross_compiling" = "yes"; then | |
43 | BINDCONFIG="--host=$host" | |
44 | fi | |
45 | # Pass CFLAGS and co. $ac_configure_args looks like "'arg1' 'arg2' ..." | |
46 | # and as there can be a space inside an argument some magic is required. | |
47 | # This sets $1 ... $N to my_configure_args, arg1 ... argN | |
48 | eval "set my_configure_args $ac_configure_args" | |
49 | # remove my_configure_args, i.e., the guard against empty $ac_configure_args | |
50 | shift | |
51 | # iterate on arguments and copying 'arg' when it begins by an upper case | |
52 | for a | |
53 | do | |
54 | case $a in | |
55 | [[A-Z]]*) BINDCONFIG="$BINDCONFIG '$a'" ;; | |
56 | esac | |
57 | done | |
58 | AC_SUBST(BINDCONFIG) | |
59 | ||
60 | # POSIX doesn't include the IPv6 Advanced Socket API and glibc hides | |
61 | # parts of the IPv6 Advanced Socket API as a result. This is stupid | |
62 | # as it breaks how the two halves (Basic and Advanced) of the IPv6 | |
63 | # Socket API were designed to be used but we have to live with it. | |
64 | # Use this to define _GNU_SOURCE to pull in the IPv6 Advanced Socket API. | |
65 | AC_USE_SYSTEM_EXTENSIONS | |
66 | ||
d113bc2c | 67 | @BEGIN WITHOUT LIBTOOL |
13e5cc6c | 68 | AC_PROG_RANLIB |
d113bc2c | 69 | @END WITHOUT LIBTOOL |
13e5cc6c FD |
70 | |
71 | AC_PATH_PROG(AR, ar) | |
72 | AC_SUBST(AR) | |
73 | ||
74 | if test "X$AR" = "X"; then | |
75 | AC_MSG_ERROR([ | |
76 | ar program not found. Please fix your PATH to include the directory in | |
77 | which ar resides, or set AR in the environment with the full path to ar.]) | |
78 | fi | |
79 | ||
80 | AC_CONFIG_HEADERS([includes/config.h]) | |
81 | ||
82 | # we sometimes need to know byte order for building packets | |
83 | AC_C_BIGENDIAN(AC_SUBST(byte_order, BIG_ENDIAN), | |
84 | AC_SUBST(byte_order, LITTLE_ENDIAN)) | |
85 | AC_DEFINE_UNQUOTED([DHCP_BYTE_ORDER], [$byte_order], | |
86 | [Define to BIG_ENDIAN for MSB (Motorola or SPARC CPUs) | |
87 | or LITTLE_ENDIAN for LSB (Intel CPUs).]) | |
88 | ||
89 | # Optional compile-time DEBUGging. | |
90 | AC_ARG_ENABLE(debug, | |
91 | AS_HELP_STRING([--enable-debug],[create a debug-only version of the software (default is no).]), | |
92 | [case "${enableval}" in | |
93 | yes) enable_debug=yes | |
94 | AC_DEFINE([DEBUG], [1], | |
95 | [Define to compile debug-only DHCP software.]) | |
96 | # Just override CFLAGS totally to remove optimization. | |
97 | CFLAGS="-g";; | |
98 | no) enable_debug=no ;; | |
99 | *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;; | |
100 | esac],[enable_debug=no]) | |
101 | ||
102 | # XXX: there are actually quite a lot more DEBUG_ features we could enable, | |
103 | # but I don't want to pollute the --help space. | |
104 | # | |
105 | #/* #define DEBUG_TOKENS */ | |
106 | #/* #define DEBUG_PACKET */ | |
107 | #/* #define DEBUG_EXPRESSIONS */ | |
108 | #/* #define DEBUG_FIND_LEASE */ | |
109 | #/* #define DEBUG_EXPRESSION_PARSE */ | |
110 | #/* #define DEBUG_CLASS_MATCHING */ | |
111 | #/* #define DEBUG_MEMORY_LEAKAGE */ | |
112 | #/* #define DEBUG_MALLOC_POOL */ | |
113 | #/* #define DEBUG_LEASE_STATE_TRANSITIONS */ | |
114 | #/* #define DEBUG_RC_HISTORY */ | |
115 | #/* #define DEBUG_RC_HISTORY_EXHAUSTIVELY */ | |
116 | #/* #define RC_HISTORY_MAX 10240 */ | |
117 | #/* #define POINTER_DEBUG */ | |
118 | #/* #define DEBUG_FAILOVER_MESSAGES */ | |
119 | #/* #define DEBUG_FAILOVER_TIMING */ | |
120 | #/* #define DEBUG_DUMP_ALL_LEASES */ | |
121 | ||
122 | # Failover optional compile-time feature. | |
123 | AC_ARG_ENABLE(failover, | |
124 | AS_HELP_STRING([--enable-failover],[enable support for failover (default is yes)])) | |
125 | # Failover is on by default, so define if it is not explicitly disabled. | |
126 | if test "$enable_failover" != "no"; then | |
127 | enable_failover="yes" | |
128 | AC_DEFINE([FAILOVER_PROTOCOL], [1], | |
129 | [Define to include Failover Protocol support.]) | |
130 | fi | |
131 | ||
132 | # execute() support. | |
133 | AC_ARG_ENABLE(execute, | |
134 | AS_HELP_STRING([--enable-execute],[enable support for execute() in config (default is yes)])) | |
135 | # execute() is on by default, so define if it is not explicitly disabled. | |
136 | if test "$enable_execute" != "no" ; then | |
137 | enable_execute="yes" | |
138 | AC_DEFINE([ENABLE_EXECUTE], [1], | |
139 | [Define to include execute() config language support.]) | |
140 | fi | |
141 | ||
142 | # Server tracing support. | |
143 | AC_ARG_ENABLE(tracing, | |
144 | AS_HELP_STRING([--enable-tracing],[enable support for server activity tracing (default is yes)])) | |
145 | # tracing is on by default, so define if it is not explicitly disabled. | |
146 | if test "$enable_tracing" != "no" ; then | |
147 | AC_DEFINE([TRACING], [1], | |
148 | [Define to include server activity tracing support.]) | |
149 | fi | |
150 | ||
4406f9b0 | 151 | # Delayed-ack feature support. |
13e5cc6c | 152 | AC_ARG_ENABLE(delayed_ack, |
4406f9b0 TM |
153 | AS_HELP_STRING([--enable-delayed-ack],[queues multiple DHCPACK replies (default is yes)])) |
154 | if test "$enable_delayed_ack" != "no"; then | |
155 | enable_delayed_ack="yes" | |
13e5cc6c FD |
156 | AC_DEFINE([DELAYED_ACK], [1], |
157 | [Define to queue multiple DHCPACK replies per fsync.]) | |
13e5cc6c FD |
158 | fi |
159 | ||
160 | # DHCPv6 optional compile-time feature. | |
161 | AC_ARG_ENABLE(dhcpv6, | |
162 | AS_HELP_STRING([--enable-dhcpv6],[enable support for DHCPv6 (default is yes)])) | |
163 | # DHCPv6 is on by default, so define if it is not explicitly disabled. | |
164 | if test "$enable_dhcpv6" != "no"; then | |
165 | enable_dhcpv6="yes" | |
166 | AC_DEFINE([DHCPv6], [1], | |
167 | [Define to 1 to include DHCPv6 support.]) | |
168 | fi | |
169 | ||
170 | # DHCPv4o6 optional compile-time feature. | |
171 | AC_ARG_ENABLE(dhcpv4o6, | |
172 | AS_HELP_STRING([--enable-dhcpv4o6],[enable support for DHCPv4-over-DHCPv6 (default is no)])) | |
173 | # DHCPv4o6 is off by default, so define if it is explicitly enabled. | |
174 | if test "$enable_dhcpv4o6" = "yes"; then | |
175 | # DHCPv4o6 requires DHCPv6 | |
176 | if test "$enable_dhcpv6" = "no"; then | |
177 | AC_MSG_ERROR([dhcpv4o6 requires dhcpv6]) | |
178 | fi | |
13e5cc6c FD |
179 | AC_DEFINE([DHCP4o6], [1], |
180 | [Define to 1 to include DHCPv4 over DHCPv6 support.]) | |
4406f9b0 TM |
181 | else |
182 | # so we can report below | |
183 | enable_dhcpv4o6="no" | |
13e5cc6c FD |
184 | fi |
185 | ||
563f0b8a FD |
186 | # Relay port (draft-ietf-dhc-relay-port-10.txt) optional compile-time feature. |
187 | AC_ARG_ENABLE(relay-port, | |
188 | AS_HELP_STRING([--enable-relay-port],[enable support for relay port (default is no)])) | |
189 | # Relay port is off by default (for now) | |
190 | if test "$enable_relay_port" = "yes"; then | |
191 | AC_DEFINE([RELAY_PORT], [1], | |
192 | [Define to 1 to include relay port support.]) | |
2f1fd274 | 193 | else |
66248390 | 194 | # so we can report below |
e985472a | 195 | enable_relay_port="no" |
563f0b8a FD |
196 | fi |
197 | ||
13e5cc6c FD |
198 | # PARANOIA is off by default (until we can test it with all features) |
199 | AC_ARG_ENABLE(paranoia, | |
200 | AS_HELP_STRING([--enable-paranoia],[enable support for chroot/setuid (default is no)])) | |
201 | AC_ARG_ENABLE(early_chroot, | |
202 | AS_HELP_STRING([--enable-early-chroot],[enable chrooting prior to configuration (default is no)])) | |
203 | # If someone enables early chroot, but does not enable paranoia, do so for | |
204 | # them. | |
205 | if test "$enable_paranoia" != "yes" && \ | |
206 | test "$enable_early_chroot" = "yes" ; then | |
207 | enable_paranoia="yes" | |
208 | fi | |
209 | ||
210 | if test "$enable_paranoia" = "yes" ; then | |
211 | AC_DEFINE([PARANOIA], [1], | |
212 | [Define to any value to include Ari's PARANOIA patch.]) | |
213 | fi | |
214 | if test "$enable_early_chroot" = "yes" ; then | |
215 | AC_DEFINE([EARLY_CHROOT], [1], | |
216 | [Define to any value to chroot() prior to loading config.]) | |
217 | fi | |
218 | ||
219 | AC_ARG_ENABLE(ipv4_pktinfo, | |
220 | AS_HELP_STRING([--enable-ipv4-pktinfo],[enable use of pktinfo on IPv4 sockets (default is no)])) | |
221 | ||
222 | if test "$enable_ipv4_pktinfo" = "yes"; then | |
223 | AC_DEFINE([USE_V4_PKTINFO], [1], | |
224 | [Define to 1 to enable IPv4 packet info support.]) | |
225 | fi | |
226 | ||
227 | AC_ARG_ENABLE(use_sockets, | |
228 | AS_HELP_STRING([--enable-use-sockets],[use the standard BSD socket API (default is no)])) | |
229 | ||
230 | if test "$enable_use_sockets" = "yes"; then | |
231 | AC_DEFINE([USE_SOCKETS], [1], | |
232 | [Define to 1 to use the standard BSD socket API.]) | |
233 | fi | |
234 | ||
13e5cc6c FD |
235 | # Include the PID in the log messages. This is useful when there may |
236 | # be multiple instances of a program. | |
237 | # This is off by default | |
238 | AC_ARG_ENABLE(log_pid, | |
239 | AS_HELP_STRING([--enable-log-pid],[Include PIDs in syslog messages (default is no).])) | |
240 | if test "$enable_log_pid" = "yes" ; then | |
241 | AC_DEFINE([USE_LOG_PID], [1], | |
242 | [Define to include PIDs in syslog messages.]) | |
243 | fi | |
244 | ||
245 | # Allow for binary search when inserting v4 leases into queues | |
246 | AC_ARG_ENABLE(binary_leases, | |
247 | AS_HELP_STRING([--enable-binary-leases],[enable support for binary insertion of leases (default is no)])) | |
248 | # binary_leases is off by default. | |
249 | if test "$enable_binary_leases" = "yes"; then | |
250 | AC_DEFINE([BINARY_LEASES], [1], | |
251 | [Define to support binary insertion of leases into queues.]) | |
252 | else | |
253 | enable_binary_leases="no" | |
254 | fi | |
255 | ||
256 | # Testing section | |
257 | ||
258 | DISTCHECK_ATF_CONFIGURE_FLAG= | |
259 | atf_path="no" | |
260 | AC_ARG_WITH([atf], | |
261 | AS_HELP_STRING([--with-atf=PATH],[specify location where atf was installed (or "bind")]), | |
262 | [atf_path="$withval"]) | |
263 | AM_CONDITIONAL(BIND_ATF, test "$atf_path" = "bind") | |
264 | if test "$atf_path" = "bind" ; then | |
265 | DISTCHECK_ATF_CONFIGURE_FLAG="--with-atf=bind" | |
266 | atf_pcp="bind" | |
267 | atf_path="\${top_srcdir}/bind/atf" | |
268 | ATF_CFLAGS="-I$atf_path/include -DUNIT_TEST" | |
269 | ATF_LDFLAGS="-L$atf_path/lib -latf-c" | |
270 | ATF_BIN=`cd $srcdir; pwd`/bind/atf/bin | |
271 | AC_SUBST(ATF_CFLAGS) | |
272 | AC_SUBST(ATF_LDFLAGS) | |
273 | AC_SUBST(ATF_BIN) | |
274 | BINDCONFIG="$BINDCONFIG --with-atf" | |
275 | elif test "$atf_path" != "no" ; then | |
276 | DISTCHECK_ATF_CONFIGURE_FLAG="--with-atf=$atf_path" | |
277 | # Config path for pkg-config | |
278 | atf_pcp="" | |
279 | if test "$atf_path" != "yes" ; then | |
280 | if test -f $atf_path/lib/pkgconfig/atf-c.pc ; then | |
281 | atf_pcp=$atf_path/lib/pkgconfig | |
282 | elif test -f $atf_path/lib64/pkgconfig/atf-c.pc ; then | |
283 | atf_pcp=$atf_path/lib64/pkgconfig | |
284 | fi | |
285 | else | |
286 | # Not specified, try some common paths | |
287 | atf_dirs="/usr /usr/local /usr/pkg /opt /opt/local" | |
288 | for d in $atf_dirs | |
289 | do | |
290 | if test -f $d/lib/pkgconfig/atf-c.pc ; then | |
291 | atf_pcp=$d/lib/pkgconfig | |
292 | atf_path=$d | |
293 | elif test -f $d/lib64/pkgconfig/atf-c.pc ; then | |
294 | atf_pcp=$d/lib64/pkgconfig | |
295 | atf_path=$d | |
296 | fi | |
297 | done | |
298 | fi | |
299 | ||
300 | if test "$atf_pcp" = "" ; then | |
301 | AC_MSG_ERROR([Unable to find atf files in location specified]) | |
302 | else | |
303 | AC_CHECK_PROG([pkgcfg_found],[pkg-config],[pkg-config],[]) | |
304 | if test "$pkgcfg_found" = ""; then | |
305 | AC_MSG_ERROR([Could not locate ATF, pkg-config not installed]) | |
306 | fi | |
307 | ATF_CFLAGS="`PKG_CONFIG_PATH=$atf_pcp pkg-config --cflags atf-c` -DUNIT_TEST" | |
308 | ATF_LDFLAGS="`PKG_CONFIG_PATH=$atf_pcp pkg-config --libs atf-c`" | |
309 | if test -f $atf_pcp/atf-sh.pc ; then | |
310 | ATF_BIN="`PKG_CONFIG_PATH=$atf_pcp pkg-config --variable=exec_prefix atf-sh`/bin" | |
311 | else | |
312 | # older versions don't have atf-sh, try usual place | |
313 | ATF_BIN=$atf_path/bin | |
314 | fi | |
315 | ||
6b87c7f2 | 316 | UNITTESTS=tests |
13e5cc6c FD |
317 | |
318 | AC_SUBST(ATF_CFLAGS) | |
319 | AC_SUBST(ATF_LDFLAGS) | |
320 | AC_SUBST(ATF_BIN) | |
6b87c7f2 | 321 | AC_SUBST(UNITTESTS) |
13e5cc6c FD |
322 | fi |
323 | fi | |
324 | ||
325 | AM_CONDITIONAL(HAVE_ATF, test "$atf_pcp" != "") | |
326 | AM_COND_IF([HAVE_ATF], [AC_DEFINE([HAVE_ATF], [1], [ATF framework specified?])]) | |
327 | AC_SUBST(DISTCHECK_ATF_CONFIGURE_FLAG) | |
328 | ||
329 | ### | |
330 | ### Path fun. Older versions of DHCP were installed in /usr/sbin, so we | |
331 | ### need to look there and potentially overwrite by default (but not if | |
332 | ### the user configures an alternate value). LOCALSTATEDIR is totally | |
333 | ### braindead. No one uses /usr/local/var/db/ nor /usr/local/var/run, and | |
334 | ### they would be insane for suggesting it. We need to look in /var/for | |
335 | ### 'db' and 'state/dhcp' for db files, and /var/run for pid files by | |
336 | ### default. | |
337 | ### | |
338 | AC_PREFIX_PROGRAM(dhcpd) | |
339 | ||
340 | # XXX - isn't there SOME WAY to default autoconf to /var instead of | |
341 | # /usr/local/var/no/one/has/this/please/stop/trying? | |
342 | case "$localstatedir" in | |
343 | '${prefix}/var') | |
344 | localstatedir=/var | |
345 | ;; | |
346 | esac | |
347 | ||
c8f0b32a MS |
348 | # Default server configuration file. |
349 | AC_ARG_WITH(srv-conf-file, | |
350 | AS_HELP_STRING([--with-srv-conf-file=PATH],[Default file containing dhcpd configuration | |
351 | (default is typically /etc/dhcpd.conf)]), | |
352 | AC_DEFINE_UNQUOTED([_PATH_DHCPD_CONF], ["$withval"], | |
353 | [Default file containing dhcpd configuration.])) | |
354 | ||
13e5cc6c FD |
355 | # Allow specification of alternate state files |
356 | AC_ARG_WITH(srv-lease-file, | |
357 | AS_HELP_STRING([--with-srv-lease-file=PATH],[File for dhcpd leases | |
358 | (default is LOCALSTATEDIR/db/dhcpd.leases)]), | |
359 | AC_DEFINE_UNQUOTED([_PATH_DHCPD_DB], ["$withval"], | |
360 | [File for dhcpd leases.])) | |
361 | ||
362 | AC_MSG_CHECKING([for dhcpd.leases location]) | |
363 | if [[ "x$with_srv_lease_file" = "x" ]] ; then | |
364 | if [[ -d "${localstatedir}/db" ]] ; then | |
365 | with_srv_lease_file="${localstatedir}/db/dhcpd.leases" | |
366 | elif [[ -d "${localstatedir}/state" ]] ; then | |
367 | if [[ -d "${localstatedir}/state/dhcp" ]] ; then | |
368 | with_srv_lease_file="${localstatedir}/state/dhcp/dhcpd.leases" | |
369 | else | |
370 | with_srv_lease_file="${localstatedir}/state/dhcpd.leases" | |
371 | fi | |
372 | elif [[ -d "${localstatedir}/lib" ]] ; then | |
373 | if [[ -d "${localstatedir}/lib/dhcp" ]] ; then | |
374 | with_srv_lease_file="${localstatedir}/lib/dhcp/dhcpd.leases" | |
375 | else | |
376 | with_srv_lease_file="${localstatedir}/lib/dhcpd.leases" | |
377 | fi | |
378 | elif [[ -d "${localstatedir}/etc" ]] ; then | |
379 | with_srv_lease_file="${localstatedir}/etc/dhcpd.leases" | |
380 | else | |
381 | with_srv_lease_file="/etc/dhcpd.leases" | |
382 | fi | |
383 | fi | |
384 | AC_MSG_RESULT($with_srv_lease_file) | |
385 | ||
386 | AC_ARG_WITH(srv6-lease-file, | |
387 | AS_HELP_STRING([--with-srv6-lease-file=PATH],[File for dhcpd6 leases | |
388 | (default is LOCALSTATEDIR/db/dhcpd6.leases)]), | |
389 | AC_DEFINE_UNQUOTED([_PATH_DHCPD6_DB], ["$withval"], | |
390 | [File for dhcpd6 leases.])) | |
391 | ||
392 | AC_MSG_CHECKING([for dhcpd6.leases location]) | |
393 | if [[ "x$with_srv6_lease_file" = "x" ]] ; then | |
394 | if [[ -d "${localstatedir}/db" ]] ; then | |
395 | with_srv6_lease_file="${localstatedir}/db/dhcpd6.leases" | |
396 | elif [[ -d "${localstatedir}/state" ]] ; then | |
397 | if [[ -d "${localstatedir}/state/dhcp" ]] ; then | |
398 | with_srv6_lease_file="${localstatedir}/state/dhcp/dhcpd6.leases" | |
399 | else | |
400 | with_srv6_lease_file="${localstatedir}/state/dhcpd6.leases" | |
401 | fi | |
402 | elif [[ -d "${localstatedir}/lib" ]] ; then | |
403 | if [[ -d "${localstatedir}/lib/dhcp" ]] ; then | |
404 | with_srv6_lease_file="${localstatedir}/lib/dhcp/dhcpd6.leases" | |
405 | else | |
406 | with_srv6_lease_file="${localstatedir}/lib/dhcpd6.leases" | |
407 | fi | |
408 | elif [[ -d "${localstatedir}/etc" ]] ; then | |
409 | with_srv6_lease_file="${localstatedir}/etc/dhcpd6.leases" | |
410 | else | |
411 | with_srv6_lease_file="/etc/dhcpd6.leases" | |
412 | fi | |
413 | fi | |
414 | AC_MSG_RESULT($with_srv6_lease_file) | |
415 | ||
416 | AC_ARG_WITH(cli-lease-file, | |
417 | AS_HELP_STRING([--with-cli-lease-file=PATH],[File for dhclient leases | |
418 | (default is LOCALSTATEDIR/db/dhclient.leases)]), | |
419 | AC_DEFINE_UNQUOTED([_PATH_DHCLIENT_DB], ["$withval"], | |
420 | [File for dhclient leases.])) | |
421 | ||
422 | AC_MSG_CHECKING([for dhclient.leases location]) | |
423 | if [[ "x$with_cli_lease_file" = "x" ]] ; then | |
424 | if [[ -d "${localstatedir}/db" ]] ; then | |
425 | with_cli_lease_file="${localstatedir}/db/dhclient.leases" | |
426 | elif [[ -d "${localstatedir}/state" ]] ; then | |
427 | if [[ -d "${localstatedir}/state/dhcp" ]] ; then | |
428 | with_cli_lease_file="${localstatedir}/state/dhcp/dhclient.leases" | |
429 | else | |
430 | with_cli_lease_file="${localstatedir}/state/dhclient.leases" | |
431 | fi | |
432 | elif [[ -d "${localstatedir}/lib" ]] ; then | |
433 | if [[ -d "${localstatedir}/lib/dhcp" ]] ; then | |
434 | with_cli_lease_file="${localstatedir}/lib/dhcp/dhclient.leases" | |
435 | else | |
436 | with_cli_lease_file="${localstatedir}/lib/dhclient.leases" | |
437 | fi | |
438 | elif [[ -d "${localstatedir}/etc" ]] ; then | |
439 | with_cli_lease_file="${localstatedir}/etc/dhclient.leases" | |
440 | else | |
441 | with_cli_lease_file="/etc/dhclient.leases" | |
442 | fi | |
443 | fi | |
444 | AC_MSG_RESULT($with_cli_lease_file) | |
445 | ||
446 | AC_ARG_WITH(cli6-lease-file, | |
447 | AS_HELP_STRING([--with-cli6-lease-file=PATH],[File for dhclient6 leases | |
448 | (default is LOCALSTATEDIR/db/dhclient6.leases)]), | |
449 | AC_DEFINE_UNQUOTED([_PATH_DHCLIENT6_DB], ["$withval"], | |
450 | [File for dhclient6 leases.])) | |
451 | ||
452 | AC_MSG_CHECKING([for dhclient6.leases location]) | |
453 | if [[ "x$with_cli6_lease_file" = "x" ]] ; then | |
454 | if [[ -d "${localstatedir}/db" ]] ; then | |
455 | with_cli6_lease_file="${localstatedir}/db/dhclient6.leases" | |
456 | elif [[ -d "${localstatedir}/state" ]] ; then | |
457 | if [[ -d "${localstatedir}/state/dhcp" ]] ; then | |
458 | with_cli6_lease_file="${localstatedir}/state/dhcp/dhclient6.leases" | |
459 | else | |
460 | with_cli6_lease_file="${localstatedir}/state/dhclient6.leases" | |
461 | fi | |
462 | elif [[ -d "${localstatedir}/lib" ]] ; then | |
463 | if [[ -d "${localstatedir}/lib/dhcp" ]] ; then | |
464 | with_cli6_lease_file="${localstatedir}/lib/dhcp/dhclient6.leases" | |
465 | else | |
466 | with_cli6_lease_file="${localstatedir}/lib/dhclient6.leases" | |
467 | fi | |
468 | elif [[ -d "${localstatedir}/etc" ]] ; then | |
469 | with_cli6_lease_file="${localstatedir}/etc/dhclient6.leases" | |
470 | else | |
471 | with_cli6_lease_file="/etc/dhclient6.leases" | |
472 | fi | |
473 | fi | |
474 | AC_MSG_RESULT($with_cli6_lease_file) | |
475 | ||
476 | AC_ARG_WITH(srv-pid-file, | |
477 | AS_HELP_STRING([--with-srv-pid-file=PATH],[File for dhcpd process information | |
478 | (default is LOCALSTATEDIR/run/dhcpd.pid)]), | |
479 | AC_DEFINE_UNQUOTED([_PATH_DHCPD_PID], ["$withval"], | |
480 | [File for dhcpd process information.])) | |
481 | AC_ARG_WITH(srv6-pid-file, | |
482 | AS_HELP_STRING([--with-srv6-pid-file=PATH],[File for dhcpd6 process information | |
483 | (default is LOCALSTATEDIR/run/dhcpd6.pid)]), | |
484 | AC_DEFINE_UNQUOTED([_PATH_DHCPD6_PID], ["$withval"], | |
485 | [File for dhcpd6 process information.])) | |
486 | AC_ARG_WITH(cli-pid-file, | |
487 | AS_HELP_STRING([--with-cli-pid-file=PATH],[File for dhclient process information | |
488 | (default is LOCALSTATEDIR/run/dhclient.pid)]), | |
489 | AC_DEFINE_UNQUOTED([_PATH_DHCLIENT_PID], ["$withval"], | |
490 | [File for dhclient process information.])) | |
491 | AC_ARG_WITH(cli6-pid-file, | |
492 | AS_HELP_STRING([--with-cli6-pid-file=PATH],[File for dhclient6 process information | |
493 | (default is LOCALSTATEDIR/run/dhclient6.pid)]), | |
494 | AC_DEFINE_UNQUOTED([_PATH_DHCLIENT6_PID], ["$withval"], | |
495 | [File for dhclient6 process information.])) | |
496 | AC_ARG_WITH(relay-pid-file, | |
497 | AS_HELP_STRING([--with-relay-pid-file=PATH],[File for dhcrelay process information | |
498 | (default is LOCALSTATEDIR/run/dhcrelay.pid)]), | |
499 | AC_DEFINE_UNQUOTED([_PATH_DHCRELAY_PID], ["$withval"], | |
500 | [File for dhcrelay process information.])) | |
501 | AC_ARG_WITH(relay6-pid-file, | |
502 | AS_HELP_STRING([--with-relay6-pid-file=PATH],[File for dhcrelay6 process information | |
503 | (default is LOCALSTATEDIR/run/dhcrelay6.pid)]), | |
504 | AC_DEFINE_UNQUOTED([_PATH_DHCRELAY6_PID], ["$withval"], | |
505 | [File for dhcrelay6 process information.])) | |
506 | ||
507 | # Check basic types. | |
508 | AC_TYPE_INT8_T | |
509 | AC_TYPE_INT16_T | |
510 | AC_TYPE_INT32_T | |
511 | AC_TYPE_INT64_T | |
512 | ||
513 | # Some systems need the u_intX_t types defined across. | |
514 | AC_CHECK_TYPE([u_int8_t], [], [ | |
515 | AC_TYPE_UINT8_T | |
516 | AC_DEFINE(u_int8_t, [uint8_t], [Define a type for 8-bit unsigned | |
517 | integers.]) | |
518 | ]) | |
519 | AC_CHECK_TYPE([u_int16_t], [], [ | |
520 | AC_TYPE_UINT16_T | |
521 | AC_DEFINE(u_int16_t, [uint16_t], [Define a type for 16-bit unsigned | |
522 | integers.]) | |
523 | ]) | |
524 | AC_CHECK_TYPE([u_int32_t], [], [ | |
525 | AC_TYPE_UINT32_T | |
526 | AC_DEFINE(u_int32_t, [uint32_t], [Define a type for 32-bit unsigned | |
527 | integers.]) | |
528 | ]) | |
529 | AC_CHECK_TYPE([u_int64_t], [], [ | |
530 | AC_TYPE_UINT64_T | |
531 | AC_DEFINE(u_int64_t, [uint64_t], [Define a type for 64-bit unsigned | |
532 | integers.]) | |
533 | ]) | |
534 | ||
535 | # see if ifaddrs.h is available | |
536 | AC_CHECK_HEADERS(ifaddrs.h) | |
537 | ||
538 | # figure out what IPv4 interface code to use | |
539 | AC_CHECK_HEADERS(linux/types.h) # needed for linux/filter.h on old systems | |
540 | ||
563f0b8a | 541 | relay_port_supported="no" |
13e5cc6c FD |
542 | AC_CHECK_HEADER(linux/filter.h, DO_LPF=1, , |
543 | [ | |
544 | #ifdef HAVE_LINUX_TYPES_H | |
545 | #include <linux/types.h> | |
546 | #endif | |
547 | ]) | |
548 | if test -n "$DO_LPF" | |
549 | then | |
550 | AC_DEFINE([HAVE_LPF], [1], | |
551 | [Define to 1 to use the Linux Packet Filter interface code.]) | |
563f0b8a | 552 | relay_port_supported="yes" |
13e5cc6c FD |
553 | else |
554 | AC_CHECK_HEADER(sys/dlpi.h, DO_DLPI=1) | |
555 | if test -n "$DO_DLPI" | |
556 | then | |
557 | AC_DEFINE([HAVE_DLPI], [1], | |
558 | [Define to 1 to use DLPI interface code.]) | |
559 | else | |
560 | AC_CHECK_HEADER(net/bpf.h, DO_BPF=1) | |
561 | if test -n "$DO_BPF" | |
562 | then | |
563 | AC_DEFINE([HAVE_BPF], [1], | |
564 | [Define to 1 to use the | |
565 | Berkeley Packet Filter interface code.]) | |
563f0b8a | 566 | relay_port_supported="yes" |
13e5cc6c FD |
567 | fi |
568 | fi | |
569 | fi | |
570 | ||
563f0b8a FD |
571 | if test "$enable_relay_port" = "yes"; then |
572 | if test "$relay_port_supported" != "yes"; then | |
573 | AC_MSG_ERROR([--enable-relay-port requires BPF or LPF]) | |
574 | fi | |
575 | fi | |
576 | ||
13e5cc6c FD |
577 | # SIOCGLIFCONF uses some transport structures. Trick is not all platforms |
578 | # use the same structures. We like to use 'struct lifconf' and 'struct | |
579 | # lifreq', but we'll use these other structures if they're present. HPUX | |
580 | # does not define 'struct lifnum', but does use SIOCGLIFNUM - they use an | |
581 | # int value. | |
582 | # | |
583 | AC_MSG_CHECKING([for struct lifnum]) | |
584 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> | |
585 | #include <sys/socket.h> | |
586 | #include <net/if.h> | |
587 | ]], [[ struct lifnum a; | |
588 | ]])],[AC_MSG_RESULT(yes) | |
589 | AC_DEFINE([ISC_PLATFORM_HAVELIFNUM], [1], | |
590 | [Define to 1 if the system has 'struct lifnum'.])],[AC_MSG_RESULT(no)]) | |
591 | ||
592 | AC_MSG_CHECKING([for struct if_laddrconf]) | |
593 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> | |
594 | #include <net/if6.h> | |
595 | ]], [[ struct if_laddrconf a; | |
596 | ]])],[AC_MSG_RESULT(yes) | |
597 | AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRCONF], [1], | |
598 | [Define to 1 if the system has 'struct if_laddrconf'.])],[AC_MSG_RESULT(no)]) | |
599 | ||
600 | AC_MSG_CHECKING([for struct if_laddrreq]) | |
601 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> | |
602 | #include <net/if6.h> | |
603 | ]], [[ struct if_laddrreq a; | |
604 | ]])],[AC_MSG_RESULT(yes) | |
605 | AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRREQ], [1], | |
606 | [Define to 1 if the system has 'struct if_laddrreq'.])],[AC_MSG_RESULT(no)]) | |
607 | ||
608 | # | |
609 | # check for GCC noreturn attribute | |
610 | # | |
611 | AC_MSG_CHECKING(for GCC noreturn attribute) | |
612 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[void foo() __attribute__((noreturn));]])],[AC_MSG_RESULT(yes) | |
613 | AC_DEFINE([ISC_DHCP_NORETURN], [__attribute__((noreturn))], | |
614 | [Define to the string for a noreturn attribute.])],[AC_MSG_RESULT(no) | |
615 | AC_DEFINE([ISC_DHCP_NORETURN], [], | |
616 | [Define to the string for a noreturn attribute.])]) | |
617 | ||
618 | # Look for optional headers. | |
619 | AC_CHECK_HEADERS(sys/socket.h net/if_dl.h net/if6.h regex.h) | |
620 | ||
621 | # Solaris needs some libraries for functions | |
622 | AC_SEARCH_LIBS(socket, [socket]) | |
623 | AC_SEARCH_LIBS(inet_ntoa, [nsl]) | |
624 | ||
625 | AC_SEARCH_LIBS(inet_aton, [socket nsl], , | |
626 | AC_DEFINE([NEED_INET_ATON], [1], | |
627 | [Define to 1 if the inet_aton() function is missing.])) | |
628 | ||
629 | # Check for a standalone regex library. | |
630 | AC_SEARCH_LIBS(regcomp, [regex]) | |
631 | ||
632 | AC_CHECK_FUNCS(strlcat) | |
633 | ||
634 | # For HP/UX we need -lipv6 for if_nametoindex, perhaps others. | |
635 | AC_SEARCH_LIBS(if_nametoindex, [ipv6]) | |
636 | ||
bf0b1863 FD |
637 | # For some Solaris nanosleep is found by BIND in librt |
638 | have_nanosleep="no" | |
639 | AC_CHECK_FUNC(nanosleep, have_nanosleep="yes") | |
640 | if test "$have_nanosleep" = "no"; then | |
641 | AC_CHECK_LIB(rt, nanosleep, have_nanosleep="rt") | |
642 | fi | |
643 | if test "$have_nanosleep" = "rt"; then | |
644 | LIBS="-lrt $LIBS" | |
645 | fi | |
646 | ||
13e5cc6c FD |
647 | # check for /dev/random (declares HAVE_DEV_RANDOM) |
648 | AC_MSG_CHECKING(for random device) | |
649 | AC_ARG_WITH(randomdev, | |
650 | AS_HELP_STRING([--with-randomdev=PATH],[Path for random device | |
651 | (default is /dev/random)]), | |
652 | use_randomdev="$withval", use_randomdev="unspec") | |
653 | if test "$use_randomdev" = "unspec"; then | |
654 | if test "$cross_compiling" = "yes"; then | |
655 | AC_MSG_RESULT(unspecified) | |
656 | AC_MSG_ERROR([ need --with-randomdev=PATH or --with-randomdev=no]) | |
657 | fi | |
658 | use_randomdev="/dev/random" | |
659 | elif test "$use_randomdev" = "yes"; then | |
660 | use_randomdev="/dev/random" | |
661 | fi | |
662 | if test "$use_randomdev" = "no"; then | |
663 | AC_MSG_RESULT(disabled) | |
664 | BINDCONFIG="$BINDCONFIG --with-randomdev=no" | |
665 | else | |
666 | if test "$cross_compiling" = "yes"; then | |
667 | AC_MSG_RESULT($use_randomdev (unchecked)) | |
668 | else | |
669 | AC_MSG_RESULT($use_randomdev) | |
670 | AC_CHECK_FILE($use_randomdev, | |
671 | AC_DEFINE([HAVE_DEV_RANDOM], [1], | |
672 | [Define to 1 if you have the /dev/random or other configured file.]), | |
673 | AC_MSG_ERROR(cannot find $use_randomdev)) | |
674 | fi | |
675 | BINDCONFIG="$BINDCONFIG --with-randomdev=$use_randomdev" | |
676 | fi | |
677 | ||
678 | BINDIOMUX="--disable-kqueue --disable-epoll --disable-devpoll" | |
679 | # check kqueue/epoll/devpoll alternative to select | |
680 | AC_ARG_ENABLE(kqueue, | |
681 | AS_HELP_STRING([--enable-kqueue],[use BSD kqueue (default is no)]), | |
682 | want_kqueue="$enableval", want_kqueue="no") | |
683 | if test "$want_kqueue" = "yes"; then | |
684 | BINDIOMUX="--enable-kqueue" | |
685 | AC_MSG_WARN([--enable-kqueue is not supported: it may lead to issues such as server looping]) | |
686 | fi | |
687 | AC_ARG_ENABLE(epoll, | |
688 | AS_HELP_STRING([--enable-epoll],[use Linux epoll (default is no)]), | |
689 | want_epoll="$enableval", want_epoll="no") | |
690 | if test "$want_epoll" = "yes"; then | |
691 | BINDIOMUX="--enable-epoll" | |
692 | AC_MSG_WARN([--enable-epoll is not supported: it may lead to issues such as server looping]) | |
693 | fi | |
694 | AC_ARG_ENABLE(devpoll, | |
695 | AS_HELP_STRING([--enable-devpoll],[use /dev/poll (default is no)]), | |
696 | want_devpoll="$enableval", want_devpoll="no") | |
697 | if test "$want_devpoll" = "yes"; then | |
698 | BINDIOMUX="--enable-devpoll" | |
699 | AC_MSG_WARN([--enable-devpoll is not supported: it may lead to issues such as server looping]) | |
700 | fi | |
701 | AC_SUBST(BINDIOMUX) | |
702 | ||
703 | # general extra bind configure arguments | |
704 | AC_ARG_WITH(bind-extra-config, | |
705 | AS_HELP_STRING([--with-bind-extra-config],[configure bind librairies | |
706 | with some extra options (default is none)]), | |
707 | use_xbindconfig="$withval", use_xbindconfig="") | |
708 | case "$use_xbindconfig" in | |
709 | yes|no|'') | |
710 | ;; | |
711 | *) | |
712 | BINDCONFIG="$BINDCONFIG $use_xbindconfig" | |
713 | AC_MSG_WARN([Most options to bind configure are not supported when used by ISC DHCP]) | |
714 | ;; | |
715 | esac | |
716 | ||
717 | # see if there is a "sa_len" field in our interface information structure | |
718 | AC_CHECK_MEMBER(struct sockaddr.sa_len, | |
719 | AC_DEFINE([HAVE_SA_LEN], [], | |
720 | [Define to 1 if the sockaddr structure has a length field.]), | |
721 | , | |
722 | [#include <sys/socket.h>]) | |
723 | ||
724 | # figure out pointer size | |
725 | SAVE_CFLAGS="$CFLAGS" | |
726 | CFLAGS="$CFLAGS -I$srcdir" | |
727 | AC_CHECK_SIZEOF(struct iaddr *, , [ | |
728 | #include "includes/inet.h" | |
729 | #include <stdio.h> | |
730 | ]) | |
731 | CFLAGS="$SAVE_CFLAGS" | |
732 | ||
733 | # Solaris does not have the msg_control or msg_controlen members | |
734 | # in the msghdr structure unless you define: | |
735 | # | |
736 | # _XOPEN_SOURCE, _XOPEN_SOURCE_EXTENDED, and __EXTENSIONS__ | |
737 | # | |
738 | # See the "standards" man page for details. | |
739 | # | |
740 | # We check for the msg_control member, and if it is not found, we check | |
741 | # again with the appropriate defines added to the CFLAGS. (In order to | |
742 | # do this we have to remove the check from the cache, which is what the | |
743 | # "unset" is for.) | |
744 | AC_CHECK_MEMBER(struct msghdr.msg_control,, | |
745 | [CFLAGS="$CFLAGS -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1" | |
746 | CFLAGS="$CFLAGS -D__EXTENSIONS__" | |
747 | unset ac_cv_member_struct_msghdr_msg_control | |
748 | AC_CHECK_MEMBER(struct msghdr.msg_control,, | |
749 | [AC_MSG_ERROR([Missing msg_control member in | |
750 | msg_control structure.])], | |
751 | [ | |
752 | #include <sys/types.h> | |
753 | #include <sys/socket.h> | |
754 | ]) | |
755 | ], | |
756 | [ | |
757 | #include <sys/types.h> | |
758 | #include <sys/socket.h> | |
759 | ]) | |
760 | ||
761 | AC_CHECK_MEMBER(struct tpacket_auxdata.tp_vlan_tci, | |
762 | [AC_DEFINE([VLAN_TCI_PRESENT], [1], [tpacket_auxdata.tp_vlan_tci present])] | |
763 | ,, [#include <linux/if_packet.h>]) | |
764 | ||
765 | # bind/Makefile.in is not from automake so we need 2 variables for bind dir | |
766 | BINDSUBDIR= | |
767 | BINDDIR= | |
768 | BINDSRCDIR= | |
769 | BINDLIBIRSDIR= | |
770 | BINDLIBDNSDIR= | |
771 | BINDLIBISCCFGDIR= | |
772 | BINDLIBISCDIR= | |
773 | DISTCHECK_LIBBIND_CONFIGURE_FLAG= | |
774 | AC_ARG_WITH(libbind, | |
775 | AS_HELP_STRING([--with-libbind=PATH],[bind includes and libraries are in PATH]), | |
776 | use_libbind="$withval", use_libbind="no") | |
777 | case "$use_libbind" in | |
778 | yes) | |
779 | AC_MSG_ERROR([PATH is required in --with-libbind=PATH]) | |
780 | ;; | |
781 | no) | |
782 | BINDSUBDIR="\${top_srcdir}/bind" | |
783 | my_abs_srcdir=`cd $srcdir && pwd` | |
784 | BINDDIR="${my_abs_srcdir}/bind" | |
785 | if test ! -d "$srcdir/bind"; then | |
786 | AC_MSG_ERROR([Where to find or build bind includes and libraries must be specified]) | |
787 | fi | |
788 | if test -d "$srcdir/bind/bind9"; then | |
789 | BINDSRCDIR="${my_abs_srcdir}/bind/bind9" | |
790 | else | |
791 | if test ! -f "$srcdir/bind/version.tmp"; then | |
792 | AC_MSG_ERROR([Cannot find $srcdir/bind/version.tmp]) | |
793 | fi | |
794 | . "$srcdir/bind/version.tmp" | |
795 | bindversion=${MAJORVER}.${MINORVER}.${PATCHVER}${RELEASETYPE}${RELEASEVER} | |
796 | BINDSRCDIR="${my_abs_srcdir}/bind/bind-$bindversion" | |
797 | fi | |
798 | AC_CONFIG_FILES([$srcdir/bind/Makefile]) | |
799 | ||
800 | BINDLIBIRSDIR="$BINDSRCDIR/lib/irs" | |
801 | BINDLIBDNSDIR="$BINDSRCDIR/lib/dns" | |
802 | BINDLIBISCCFGDIR="$BINDSRCDIR/lib/isccfg" | |
803 | BINDLIBISCDIR="$BINDSRCDIR/lib/isc" | |
804 | ;; | |
805 | *) | |
806 | if test ! -d "$use_libbind"; then | |
807 | AC_MSG_ERROR([Cannot find bind directory at $use_libbind]) | |
808 | fi | |
6d91a86b FD |
809 | if test ! -d "$use_libbind/include" -o \ |
810 | ! -f "$use_libbind/include/isc/buffer.h" | |
811 | then | |
13e5cc6c FD |
812 | AC_MSG_ERROR([Cannot find bind includes at $use_libbind/include]) |
813 | fi | |
6d91a86b FD |
814 | if test ! -d "$use_libbind/lib" -o \ |
815 | \( ! -f "$use_libbind/lib/libisc.a" -a \ | |
816 | ! -f "$use_libbind/lib/libisc.la" \) | |
817 | then | |
13e5cc6c FD |
818 | AC_MSG_ERROR([Cannot find bind libraries at $use_libbind/lib]) |
819 | fi | |
820 | BINDDIR="$use_libbind" | |
821 | BINDLIBIRSDIR="$BINDDIR/lib" | |
822 | BINDLIBDNSDIR="$BINDDIR/lib" | |
823 | BINDLIBISCCFGDIR="$BINDDIR/lib" | |
824 | BINDLIBISCDIR="$BINDDIR/lib" | |
825 | DISTCHECK_LIBBIND_CONFIGURE_FLAG="--with-libbind=$use_libbind" | |
826 | ;; | |
827 | esac | |
828 | AC_SUBST(BINDSUBDIR) | |
829 | AC_SUBST(BINDDIR) | |
830 | AC_SUBST(BINDSRCDIR) | |
831 | AC_SUBST(BINDLIBIRSDIR) | |
832 | AC_SUBST(BINDLIBDNSDIR) | |
833 | AC_SUBST(BINDLIBISCCFGDIR) | |
834 | AC_SUBST(BINDLIBISCDIR) | |
835 | AC_SUBST(DISTCHECK_LIBBIND_CONFIGURE_FLAG) | |
836 | AM_CONDITIONAL(HAVE_BINDDIR, test "$use_libbind" = "no") | |
837 | ||
13e5cc6c FD |
838 | # |
839 | # GNU libtool support | |
840 | # | |
841 | case "$build_os" in | |
842 | sunos*) | |
843 | # Just set the maximum command line length for sunos | |
844 | # as it otherwise takes a exceptionally long time to | |
845 | # work it out. Required for libtool. | |
846 | ||
847 | lt_cv_sys_max_cmd_len=4096 | |
848 | ;; | |
849 | esac | |
850 | ||
851 | want_libtool="no" | |
852 | @BEGIN WITH LIBTOOL | |
853 | LT_INIT | |
854 | want_libtool="yes" | |
855 | @END WITH LIBTOOL | |
856 | ||
857 | BINDLT= | |
bf6f8fce | 858 | DISTCHECK_LIBTOOL_CONFIGURE_FLAG= |
13e5cc6c | 859 | AC_ARG_ENABLE(libtool, |
6d91a86b FD |
860 | AS_HELP_STRING([--enable-libtool], |
861 | @BEGIN WITH LIBTOOL | |
862 | [use GNU libtool for dynamic shared libraries (default is yes).]), | |
863 | @END WITH LIBTOOL | |
864 | @BEGIN WITHOUT LIBTOOL | |
865 | [use GNU libtool for dynamic shared libraries (default is no).]), | |
866 | @END WITHOUT LIBTOOL | |
13e5cc6c | 867 | want_libtool="$enableval") |
d113bc2c | 868 | |
6d91a86b FD |
869 | if test "$use_libbind" != "no"; then |
870 | if test "$want_libtool" = "yes" -a \ | |
871 | ! -f "$use_libbind/lib/libisc.la" | |
872 | then | |
873 | AC_MSG_ERROR([Cannot find dynamic libraries at $use_libbind/lib]) | |
874 | fi | |
875 | if test "$want_libtool" = "no" -a \ | |
876 | ! -f "$use_libbind/lib/libisc.a" | |
877 | then | |
878 | AC_MSG_ERROR([Cannot find static libraries at $use_libbind/lib]) | |
879 | fi | |
880 | fi | |
881 | ||
13e5cc6c FD |
882 | @BEGIN WITH LIBTOOL |
883 | if test "$want_libtool" = "no"; then | |
884 | AC_MSG_ERROR([libtool configure is used but libtool is disabled?]) | |
885 | fi | |
d113bc2c FD |
886 | |
887 | DHLIBS=LTLIBRARIES | |
13e5cc6c | 888 | A=la |
bf6f8fce | 889 | BINDLT="--with-libtool --disable-symtable" |
36d4e51a | 890 | DISTCHECK_LIBTOOL_CONFIGURE_FLAG="--enable-libtool" |
13e5cc6c | 891 | @END WITH LIBTOOL |
d113bc2c | 892 | |
13e5cc6c FD |
893 | @BEGIN WITHOUT LIBTOOL |
894 | if test "$want_libtool" = "yes"; then | |
895 | AC_MSG_WARN([legacy configure is used but libtool is enabled. Trying to recover...]) | |
6d91a86b | 896 | # expand $ac_configure_args |
d113bc2c FD |
897 | eval "set my_configure_args $ac_configure_args" |
898 | shift | |
6d91a86b | 899 | cd $srcdir; exec ./config+lt "$@" |
13e5cc6c FD |
900 | AC_MSG_ERROR([Recovering failed]) |
901 | fi | |
d113bc2c FD |
902 | |
903 | DHLIBS=LIBRARIES | |
13e5cc6c FD |
904 | A=a |
905 | @END WITHOUT LIBTOOL | |
d113bc2c FD |
906 | |
907 | AC_SUBST(DHLIBS) | |
13e5cc6c FD |
908 | AC_SUBST(A) |
909 | AC_SUBST(BINDLT) | |
bf6f8fce FD |
910 | AC_SUBST(DISTCHECK_LIBTOOL_CONFIGURE_FLAG) |
911 | ||
912 | # quoting in Makefile.am.in | |
913 | Q=@ | |
914 | AC_SUBST(Q) | |
915 | ||
916 | # install bind includes and libraries | |
917 | ||
918 | want_install_bind="no" | |
919 | @BEGIN WITH LIBTOOL | |
920 | want_install_bind="yes" | |
921 | @END WITH LIBTOOL | |
922 | if test "$want_libtool" = "yes"; then | |
923 | want_install_bind="yes" | |
924 | fi | |
925 | if test "$use_libbind" != "no"; then | |
926 | want_install_bind="no" | |
927 | fi | |
928 | AC_ARG_ENABLE(bind_install, | |
6d91a86b FD |
929 | AS_HELP_STRING([--enable-bind-install], |
930 | @BEGIN WITH LIBTOOL | |
931 | [install bind includes and libraries.]), | |
932 | @END WITH LIBTOOL | |
933 | @BEGIN WITHOUT LIBTOOL | |
934 | [install bind includes and libraries (default is no).]), | |
935 | @END WITHOUT LIBTOOL | |
bf6f8fce FD |
936 | want_install_bind="$enableval") |
937 | if test "$want_install_bind" = "yes"; then | |
938 | if test "$use_libbind" != "no"; then | |
939 | AC_MSG_WARN([--enable-bind-install does nothing when --with-libbind is set]) | |
940 | fi | |
941 | elif test "$want_libtool" = "yes" -a "$use_libbind" = "no"; then | |
942 | AC_MSG_WARN([embedded dynamic bind libraries must be installed]) | |
943 | fi | |
944 | AM_CONDITIONAL(INSTALL_BIND, test "$want_install_bind" = "yes") | |
13e5cc6c FD |
945 | |
946 | # OpenLDAP support. | |
947 | AC_ARG_WITH(ldap, | |
948 | AS_HELP_STRING([--with-ldap],[enable OpenLDAP support in dhcpd (default is no)]), | |
949 | [ldap=$withval], | |
950 | [ldap=no]) | |
951 | ||
952 | # OpenLDAP with SSL support. | |
953 | AC_ARG_WITH(ldapcrypto, | |
954 | AS_HELP_STRING([--with-ldapcrypto],[enable OpenLDAP crypto support in dhcpd (default is no)]), | |
955 | [ldapcrypto=$withval], | |
956 | [ldapcrypto=no]) | |
957 | ||
958 | # Gssapi to allow LDAP to authenticate with a keytab | |
959 | AC_ARG_WITH(ldap-gssapi, | |
960 | AC_HELP_STRING([--with-ldap-gssapi], | |
961 | [enable krb5/gssapi authentication for OpenLDAP in dhcpd (default is no)]), | |
962 | [ldap_gssapi=$withval], | |
963 | [ldap_gssapi=no]) | |
964 | ||
965 | ||
966 | # LDAP CASA auth support. | |
967 | AC_ARG_WITH(ldapcasa, | |
968 | AC_HELP_STRING([--with-ldapcasa], | |
969 | [enable LDAP CASA auth support in dhcpd (default is no)]), | |
970 | [ldapcasa=$withval], | |
971 | [ldapcasa=no]) | |
972 | ||
973 | # OpenLDAP support is disabled by default, if enabled then SSL support is an | |
974 | # extra optional that is also disabled by default. Enabling LDAP SSL support | |
975 | # implies enabling LDAP support. Similarly, KRB5 support implies LDAP support, | |
976 | # but doesn't include SSL. The two are not dependant. | |
977 | if test x$ldap = xyes || test x$ldapcrypto = xyes || test x$ldap_gssapi = xyes; then | |
978 | saved_LIBS="$LIBS" | |
979 | LIBS="" | |
980 | AC_SEARCH_LIBS(ldap_initialize, [ldap], , | |
981 | AC_MSG_FAILURE([*** Cannot find ldap_initialize with -lldap - do you need to install an OpenLDAP2 Devel package?])) | |
982 | AC_SEARCH_LIBS(ber_pvt_opt_on, [lber], , | |
983 | AC_MSG_FAILURE([*** Cannot find ber_pvt_opt_on with -llber - do you need to install an OpenLDAP2 Devel package?])) | |
984 | if test x$ldap_gssapi = xyes ; then | |
985 | AC_SEARCH_LIBS(krb5_init_context, [krb5], , | |
986 | AC_MSG_FAILURE([*** Cannot find krb5_init_context with -lkrb5 - do you need to install a Kerberos Devel package?])) | |
987 | fi | |
988 | ||
989 | # Create LDAP_LIBS which we specify them explicitly rather than lumping them in with LIBS | |
990 | AC_SUBST(LDAP_LIBS, [$LIBS]) | |
991 | LIBS="$saved_LIBS" | |
992 | ||
993 | ||
994 | AC_CHECK_HEADERS([ldap.h]) | |
995 | AC_CHECK_FUNCS([inet_pton inet_ntop]) | |
996 | ||
997 | ||
998 | LDAP_CFLAGS="-DLDAP_CONFIGURATION" | |
999 | ||
1000 | if test x$ldapcasa = xyes ; then | |
1001 | AC_CHECK_HEADERS([micasa_mgmd.h],[ | |
1002 | LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_CASA_AUTH" | |
1003 | ], AC_MSG_FAILURE([*** Cannot find micasa_mgmd.h for ldap casa auth support])) | |
1004 | fi | |
1005 | ||
1006 | if test x$ldapcrypto = xyes ; then | |
1007 | LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_USE_SSL" | |
1008 | fi | |
1009 | ||
1010 | if test x$ldap_gssapi = xyes; then | |
1011 | LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_USE_GSSAPI" | |
1012 | fi | |
1013 | ||
1014 | AC_SUBST(LDAP_CFLAGS, [$LDAP_CFLAGS]) | |
1015 | fi | |
1016 | ||
1017 | # Append selected warning levels to CFLAGS before substitution (but after | |
1018 | # AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[]) & etc). | |
1019 | CFLAGS="$CFLAGS $STD_CWARNINGS" | |
1020 | ||
1021 | # Try to add the bind and dhcp include directories | |
1022 | CFLAGS="$CFLAGS -I\$(top_srcdir)/includes -I$BINDDIR/include" | |
1023 | ||
1024 | case "$host" in | |
1025 | *-darwin*) | |
1026 | CFLAGS="$CFLAGS -D__APPLE_USE_RFC_3542";; | |
1027 | *-solaris*) | |
1028 | # As of Solaris 11, ethernet dev files are in /dev/net | |
1029 | AC_CHECK_FILE(/dev/net, | |
1030 | [AC_DEFINE([USE_DEV_NET], [1], | |
1031 | [Define to 1 if ethernet devices are in /dev/net])]) | |
1032 | ;; | |
1033 | esac | |
1034 | ||
1035 | AC_C_FLEXIBLE_ARRAY_MEMBER | |
1036 | ||
1037 | AC_CONFIG_FILES([ | |
1038 | Makefile | |
1039 | client/Makefile | |
1040 | client/tests/Makefile | |
1041 | common/Makefile.am | |
1042 | common/Makefile | |
1043 | common/tests/Makefile | |
1044 | dhcpctl/Makefile.am | |
1045 | dhcpctl/Makefile | |
1046 | includes/Makefile | |
0cd94b5e | 1047 | keama/Makefile |
13e5cc6c FD |
1048 | omapip/Makefile.am |
1049 | omapip/Makefile | |
1050 | relay/Makefile | |
1051 | server/Makefile | |
1052 | tests/Makefile.am | |
1053 | tests/Makefile | |
1054 | tests/unittest.sh | |
1055 | server/tests/Makefile | |
1056 | doc/devel/doxyfile | |
1057 | ]) | |
1058 | AC_OUTPUT | |
1059 | ||
1060 | @BEGIN WITH LIBTOOL | |
1061 | AC_MSG_NOTICE([postconfig: run automake in $srcdir]) | |
1062 | (cd $srcdir; automake) | |
1063 | AC_MSG_NOTICE([postconfig: rerun config.status]) | |
1064 | sh ./config.status | |
1065 | @END WITH LIBTOOL | |
1066 | ||
1067 | if test "$enable_dhcpv4o6" = "yes"; then | |
1068 | DHCP_VERSIONS="DHCPv4, DHCPv6 and DHCPv4-over-DHCPv6" | |
1069 | elif test "$enable_dhcpv6" != "no"; then | |
1070 | DHCP_VERSIONS="DHCPv4 and DHCPv6" | |
1071 | else | |
1072 | DHCP_VERSIONS="DHCPv4" | |
1073 | fi | |
1074 | ||
1075 | cat > config.report << END | |
1076 | ||
1077 | ISC DHCP source configure results: | |
1078 | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | |
1079 | ||
1080 | Package: | |
1081 | Name: $PACKAGE_NAME | |
1082 | Version: $PACKAGE_VERSION | |
1083 | ||
1084 | C Compiler: $CC | |
1085 | ||
1086 | Flags: | |
1087 | DEFS: $DEFS | |
1088 | CFLAGS: $CFLAGS | |
1089 | ||
1090 | DHCP versions: $DHCP_VERSIONS | |
1091 | ||
1092 | Features: | |
1093 | debug: $enable_debug | |
1094 | failover: $enable_failover | |
1095 | execute: $enable_execute | |
1096 | binary-leases: $enable_binary_leases | |
1097 | dhcpv6: $enable_dhcpv6 | |
1098 | delayed-ack: $enable_delayed_ack | |
4406f9b0 | 1099 | dhcpv4o6: $enable_dhcpv4o6 |
563f0b8a | 1100 | relay-port: $enable_relay_port |
13e5cc6c FD |
1101 | |
1102 | Developer: | |
1103 | ATF unittests : $atf_path | |
1104 | ||
1105 | END | |
1106 | # TODO: Add Perl system tests | |
1107 | ||
1108 | if test "$atf_path" != "no" | |
1109 | then | |
1110 | echo "ATF_CFLAGS : $ATF_CFLAGS" >> config.report | |
1111 | echo "ATF_LDFLAGS : $ATF_LDFLAGS" >> config.report | |
1112 | echo "ATF_BIN : $ATF_BIN" >> config.report | |
1113 | echo | |
1114 | fi | |
1115 | ||
1116 | cat config.report | |
1117 | ||
1118 | echo | |
1119 | echo Now you can type "make" to build ISC DHCP | |
1120 | echo |