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