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