diff options
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 181 |
1 files changed, 149 insertions, 32 deletions
diff --git a/configure.ac b/configure.ac index fd936410..9351150a 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([DHCP],[4.3.2],[dhcp-users@isc.org]) +AC_INIT([DHCP],[4.3.3],[dhcp-users@isc.org]) # we specify "foreign" to avoid having to have the GNU mandated files, # like AUTHORS, COPYING, and such @@ -9,11 +9,11 @@ AM_INIT_AUTOMAKE([foreign]) # change the timestamps on the code, like checking it into a cvs # tree, could trigger a rebuild of the infrastructure files which # might fail if they don't have the correct tools. -AM_MAINTAINER_MODE +AM_MAINTAINER_MODE AC_CANONICAL_HOST -# We want to turn on warnings if we are using gcc and the user did +# We want to turn on warnings if we are using gcc and the user did # not specify CFLAGS. The autoconf check for the C compiler sets the # CFLAGS if gcc is used, so we will save it before we run that check. SAVE_CFLAGS="$CFLAGS" @@ -34,7 +34,11 @@ fi # We can have some flags to pass to bind configure BINDCONFIG= +if test "$cross_compiling" = "yes"; then + BINDCONFIG="--host=$host" +fi AC_SUBST(BINDCONFIG) +AM_CONDITIONAL(CROSS_COMPILING, test "$cross_compiling" = "yes") # POSIX doesn't include the IPv6 Advanced Socket API and glibc hides # parts of the IPv6 Advanced Socket API as a result. This is stupid @@ -44,12 +48,22 @@ AC_SUBST(BINDCONFIG) AC_USE_SYSTEM_EXTENSIONS AC_PROG_RANLIB + +AC_PATH_PROG(AR, ar) +AC_SUBST(AR) + +if test "X$AR" = "X"; then + AC_MSG_ERROR([ +ar program not found. Please fix your PATH to include the directory in +which ar resides, or set AR in the environment with the full path to ar.]) +fi + AC_CONFIG_HEADERS([includes/config.h]) # we sometimes need to know byte order for building packets -AC_C_BIGENDIAN(AC_SUBST(byte_order, BIG_ENDIAN), +AC_C_BIGENDIAN(AC_SUBST(byte_order, BIG_ENDIAN), AC_SUBST(byte_order, LITTLE_ENDIAN)) -AC_DEFINE_UNQUOTED([DHCP_BYTE_ORDER], [$byte_order], +AC_DEFINE_UNQUOTED([DHCP_BYTE_ORDER], [$byte_order], [Define to BIG_ENDIAN for MSB (Motorola or SPARC CPUs) or LITTLE_ENDIAN for LSB (Intel CPUs).]) @@ -91,6 +105,7 @@ AC_ARG_ENABLE(failover, AS_HELP_STRING([--enable-failover],[enable support for failover (default is yes)])) # Failover is on by default, so define if it is not explicitly disabled. if test "$enable_failover" != "no"; then + enable_failover="yes" AC_DEFINE([FAILOVER_PROTOCOL], [1], [Define to include Failover Protocol support.]) fi @@ -100,6 +115,7 @@ AC_ARG_ENABLE(execute, AS_HELP_STRING([--enable-execute],[enable support for execute() in config (default is yes)])) # execute() is on by default, so define if it is not explicitly disabled. if test "$enable_execute" != "no" ; then + enable_execute="yes" AC_DEFINE([ENABLE_EXECUTE], [1], [Define to include execute() config language support.]) fi @@ -119,6 +135,8 @@ AC_ARG_ENABLE(delayed_ack, if test "$enable_delayed_ack" = "yes"; then AC_DEFINE([DELAYED_ACK], [1], [Define to queue multiple DHCPACK replies per fsync.]) +else + enable_delayed_ack="no" fi # DHCPv6 optional compile-time feature. @@ -126,7 +144,8 @@ AC_ARG_ENABLE(dhcpv6, AS_HELP_STRING([--enable-dhcpv6],[enable support for DHCPv6 (default is yes)])) # DHCPv6 is on by default, so define if it is not explicitly disabled. if test "$enable_dhcpv6" != "no"; then - AC_DEFINE([DHCPv6], [1], + enable_dhcpv6="yes" + AC_DEFINE([DHCPv6], [1], [Define to 1 to include DHCPv6 support.]) fi @@ -187,6 +206,17 @@ if test "$enable_log_pid" = "yes" ; then [Define to include PIDs in syslog messages.]) fi +# Allow for binary search when inserting v4 leases into queues +AC_ARG_ENABLE(binary_leases, + AS_HELP_STRING([--enable-binary-leases],[enable support for binary insertion of leases (default is no)])) +# binary_leases is off by default. +if test "$enable_binary_leases" = "yes"; then + AC_DEFINE([BINARY_LEASES], [1], + [Define to support binary insertion of leases into queues.]) +else + enable_binary_leases="no" +fi + # Testing section DISTCHECK_ATF_CONFIGURE_FLAG= @@ -234,6 +264,10 @@ elif test "$atf_path" != "no" ; then if test "$atf_pcp" = "" ; then AC_MSG_ERROR([Unable to find atf files in location specified]) else + AC_CHECK_PROG([pkgcfg_found],[pkg-config],[pkg-config],[]) + if test "$pkgcfg_found" = ""; then + AC_MSG_ERROR([Could not locate ATF, pkg-config not installed]) + fi ATF_CFLAGS="`PKG_CONFIG_PATH=$atf_pcp pkg-config --cflags atf-c` -DUNIT_TEST" ATF_LDFLAGS="`PKG_CONFIG_PATH=$atf_pcp pkg-config --libs atf-c`" if test -f $atf_pcp/atf-sh.pc ; then @@ -278,7 +312,7 @@ esac # Allow specification of alternate state files AC_ARG_WITH(srv-lease-file, - AS_HELP_STRING([--with-srv-lease-file=PATH],[File for dhcpd leases + AS_HELP_STRING([--with-srv-lease-file=PATH],[File for dhcpd leases (default is LOCALSTATEDIR/db/dhcpd.leases)]), AC_DEFINE_UNQUOTED([_PATH_DHCPD_DB], ["$withval"], [File for dhcpd leases.])) @@ -308,7 +342,7 @@ fi AC_MSG_RESULT($with_srv_lease_file) AC_ARG_WITH(srv6-lease-file, - AS_HELP_STRING([--with-srv6-lease-file=PATH],[File for dhcpd6 leases + AS_HELP_STRING([--with-srv6-lease-file=PATH],[File for dhcpd6 leases (default is LOCALSTATEDIR/db/dhcpd6.leases)]), AC_DEFINE_UNQUOTED([_PATH_DHCPD6_DB], ["$withval"], [File for dhcpd6 leases.])) @@ -338,7 +372,7 @@ fi AC_MSG_RESULT($with_srv6_lease_file) AC_ARG_WITH(cli-lease-file, - AS_HELP_STRING([--with-cli-lease-file=PATH],[File for dhclient leases + AS_HELP_STRING([--with-cli-lease-file=PATH],[File for dhclient leases (default is LOCALSTATEDIR/db/dhclient.leases)]), AC_DEFINE_UNQUOTED([_PATH_DHCLIENT_DB], ["$withval"], [File for dhclient leases.])) @@ -368,7 +402,7 @@ fi AC_MSG_RESULT($with_cli_lease_file) AC_ARG_WITH(cli6-lease-file, - AS_HELP_STRING([--with-cli6-lease-file=PATH],[File for dhclient6 leases + AS_HELP_STRING([--with-cli6-lease-file=PATH],[File for dhclient6 leases (default is LOCALSTATEDIR/db/dhclient6.leases)]), AC_DEFINE_UNQUOTED([_PATH_DHCLIENT6_DB], ["$withval"], [File for dhclient6 leases.])) @@ -470,20 +504,20 @@ AC_CHECK_HEADER(linux/filter.h, DO_LPF=1, , ]) if test -n "$DO_LPF" then - AC_DEFINE([HAVE_LPF], [1], + AC_DEFINE([HAVE_LPF], [1], [Define to 1 to use the Linux Packet Filter interface code.]) else AC_CHECK_HEADER(sys/dlpi.h, DO_DLPI=1) if test -n "$DO_DLPI" then - AC_DEFINE([HAVE_DLPI], [1], + AC_DEFINE([HAVE_DLPI], [1], [Define to 1 to use DLPI interface code.]) else AC_CHECK_HEADER(net/bpf.h, DO_BPF=1) if test -n "$DO_BPF" then AC_DEFINE([HAVE_BPF], [1], - [Define to 1 to use the + [Define to 1 to use the Berkeley Packet Filter interface code.]) fi fi @@ -537,8 +571,8 @@ AC_CHECK_HEADERS(sys/socket.h net/if_dl.h net/if6.h regex.h) AC_SEARCH_LIBS(socket, [socket]) AC_SEARCH_LIBS(inet_ntoa, [nsl]) -AC_SEARCH_LIBS(inet_aton, [socket nsl], , - AC_DEFINE([NEED_INET_ATON], [1], +AC_SEARCH_LIBS(inet_aton, [socket nsl], , + AC_DEFINE([NEED_INET_ATON], [1], [Define to 1 if the inet_aton() function is missing.])) # Check for a standalone regex library. @@ -550,13 +584,39 @@ AC_CHECK_FUNCS(strlcat) AC_SEARCH_LIBS(if_nametoindex, [ipv6]) # check for /dev/random (declares HAVE_DEV_RANDOM) -AC_CHECK_FILE(/dev/random, - AC_DEFINE([HAVE_DEV_RANDOM], [1], - [Define to 1 if you have the /dev/random file.])) +AC_MSG_CHECKING(for random device) +AC_ARG_WITH(randomdev, + AS_HELP_STRING([--with-randomdev=PATH],[Path for random device + (default is /dev/random)]), + use_randomdev="$withval", use_randomdev="unspec") +if test "$use_randomdev" = "unspec"; then + if test "$cross_compiling" = "yes"; then + AC_MSG_RESULT(unspecified) + AC_MSG_ERROR([ need --with-randomdev=PATH or --with-randomdev=no]) + fi + use_randomdev="/dev/random" +elif test "$use_randomdev" = "yes"; then + use_randomdev="/dev/random" +fi +if test "$use_randomdev" = "no"; then + AC_MSG_RESULT(disabled) + BINDCONFIG="$BINDCONFIG --with-randomdev=no" +else + if test "$cross_compiling" = "yes"; then + AC_MSG_RESULT($use_randomdev (unchecked)) + else + AC_MSG_RESULT($use_randomdev) + AC_CHECK_FILE($use_randomdev, + AC_DEFINE([HAVE_DEV_RANDOM], [1], + [Define to 1 if you have the /dev/random or other configured file.]), + AC_MSG_ERROR(cannot find $use_randomdev)) + fi + BINDCONFIG="$BINDCONFIG --with-randomdev=$use_randomdev" +fi # see if there is a "sa_len" field in our interface information structure AC_CHECK_MEMBER(struct sockaddr.sa_len, - AC_DEFINE([HAVE_SA_LEN], [], + AC_DEFINE([HAVE_SA_LEN], [], [Define to 1 if the sockaddr structure has a length field.]), , [#include <sys/socket.h>]) @@ -570,13 +630,13 @@ AC_CHECK_SIZEOF(struct iaddr *, , [ ]) CFLAGS="$SAVE_CFLAGS" -# Solaris does not have the msg_control or msg_controlen members +# Solaris does not have the msg_control or msg_controlen members # in the msghdr structure unless you define: # # _XOPEN_SOURCE, _XOPEN_SOURCE_EXTENDED, and __EXTENSIONS__ -# +# # See the "standards" man page for details. -# +# # We check for the msg_control member, and if it is not found, we check # again with the appropriate defines added to the CFLAGS. (In order to # do this we have to remove the check from the cache, which is what the @@ -586,7 +646,7 @@ AC_CHECK_MEMBER(struct msghdr.msg_control,, CFLAGS="$CFLAGS -D__EXTENSIONS__" unset ac_cv_member_struct_msghdr_msg_control AC_CHECK_MEMBER(struct msghdr.msg_control,, - [AC_MSG_ERROR([Missing msg_control member in + [AC_MSG_ERROR([Missing msg_control member in msg_control structure.])], [ #include <sys/types.h> @@ -605,10 +665,10 @@ AC_CHECK_MEMBER(struct tpacket_auxdata.tp_vlan_tci, BINDDIR= BINDSRCDIR= AC_ARG_WITH(libbind, - AS_HELP_STRING([--with-libbind=PATH],[bind includes and libraries are in PATH + AS_HELP_STRING([--with-libbind=PATH],[bind includes and libraries are in PATH (default is ./bind)]), use_libbind="$withval", use_libbind="no") -case "$use_libbind" in +case "$use_libbind" in yes) BINDDIR="\${top_srcdir}/bind" BINDSRCDIR="\${top_srcdir}/bind" @@ -621,8 +681,14 @@ no) BINDDIR="$use_libbind" if test ! -d "$srcdir/bind"; then # no bind directory, create it with a fake Makefile.in + # (AC_CONFIG_FILES and top Makefile refer to it so + # it must exits) mkdir $srcdir/bind - echo "# placeholder" > $srcdir/bind/Makefile.in + cat > $srcdir/bind/Makefile.in << EOF +# placeholder +all check clean distclean distdir install uninstall: + +EOF fi ;; esac @@ -641,20 +707,63 @@ AC_ARG_WITH(ldapcrypto, [ldapcrypto=$withval], [ldapcrypto=no]) +# Gssapi to allow LDAP to authenticate with a keytab +AC_ARG_WITH(ldap-gssapi, + AC_HELP_STRING([--with-ldap-gssapi], + [enable krb5/gssapi authentication for OpenLDAP in dhcpd (default is no)]), + [ldap_gssapi=$withval], + [ldap_gssapi=no]) + + +# LDAP CASA auth support. +AC_ARG_WITH(ldapcasa, + AC_HELP_STRING([--with-ldapcasa], + [enable LDAP CASA auth support in dhcpd (default is no)]), + [ldapcasa=$withval], + [ldapcasa=no]) + # OpenLDAP support is disabled by default, if enabled then SSL support is an # extra optional that is also disabled by default. Enabling LDAP SSL support -# implies enabling LDAP support. -if test x$ldap = xyes || test x$ldapcrypto = xyes ; then +# implies enabling LDAP support. Similarly, KRB5 support implies LDAP support, +# but doesn't include SSL. The two are not dependant. +if test x$ldap = xyes || test x$ldapcrypto = xyes || test x$ldap_gssapi = xyes; then + saved_LIBS="$LIBS" + LIBS="" AC_SEARCH_LIBS(ldap_initialize, [ldap], , AC_MSG_FAILURE([*** Cannot find ldap_initialize with -lldap - do you need to install an OpenLDAP2 Devel package?])) AC_SEARCH_LIBS(ber_pvt_opt_on, [lber], , AC_MSG_FAILURE([*** Cannot find ber_pvt_opt_on with -llber - do you need to install an OpenLDAP2 Devel package?])) + if test x$ldap_gssapi = xyes ; then + AC_SEARCH_LIBS(krb5_init_context, [krb5], , + AC_MSG_FAILURE([*** Cannot find krb5_init_context with -lkrb5 - do you need to install a Kerberos Devel package?])) + fi + + # Create LDAP_LIBS which we specify them explicitly rather than lumping them in with LIBS + AC_SUBST(LDAP_LIBS, [$LIBS]) + LIBS="$saved_LIBS" + + + AC_CHECK_HEADERS([ldap.h]) + AC_CHECK_FUNCS([inet_pton inet_ntop]) + + + LDAP_CFLAGS="-DLDAP_CONFIGURATION" + + if test x$ldapcasa = xyes ; then + AC_CHECK_HEADERS([micasa_mgmd.h],[ + LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_CASA_AUTH" + ], AC_MSG_FAILURE([*** Cannot find micasa_mgmd.h for ldap casa auth support])) + fi if test x$ldapcrypto = xyes ; then - AC_SUBST(LDAP_CFLAGS, ["-DLDAP_CONFIGURATION -DLDAP_USE_SSL"]) - else - AC_SUBST(LDAP_CFLAGS, ["-DLDAP_CONFIGURATION"]) + LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_USE_SSL" fi + + if test x$ldap_gssapi = xyes; then + LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_USE_GSSAPI" + fi + + AC_SUBST(LDAP_CFLAGS, [$LDAP_CFLAGS]) fi # Append selected warning levels to CFLAGS before substitution (but after @@ -690,7 +799,12 @@ AC_CONFIG_FILES([ ]) AC_OUTPUT -(cd $srcdir; sh util/bindvar.sh) +(cd $srcdir + sh util/bindvar.sh + if test $? -ne 0; then + AC_MSG_ERROR([*** util/bindvar.sh failed]) + fi +) cat > config.report << END @@ -711,6 +825,9 @@ Features: debug: $enable_debug failover: $enable_failover execute: $enable_execute + binary-leases: $enable_binary_leases + dhcpv6: $enable_dhcpv6 + delayed-ack: $enable_delayed_ack Developer: ATF unittests : $atf_path |