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