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