diff --git a/configure.in b/configure.in index 95737a030..b7aa4371d 100644 --- a/configure.in +++ b/configure.in @@ -338,7 +338,14 @@ AC_SUBST(PPPD_PLUGIN_DIR) # DHCP client AC_ARG_WITH([dhcp-client], AS_HELP_STRING([--with-dhcp-client=dhcpcd|dhclient], [path to the chosen dhcp client])) -if test "x$with_dhcp_client" = "x" || test x`basename "$with_dhcp_client"` = "xdhclient"; then +# If a full path is given, use that and do not test if it works or not. +case "${with_dhcp_client}" in + /*) + DHCP_CLIENT_PATH="${with_dhcp_client}" + AC_MSG_NOTICE(using the DHCP client ${DHCP_CLIENT_PATH}) + ;; +esac +if test -z "$DHCP_CLIENT_PATH" -a \( -z "$with_dhcp_client" -o x`basename "$with_dhcp_client"` = "xdhclient" \); then # We only work with ISC dhclient - the FreeBSD and OpenBSD derivatives don't have the same userland. AC_MSG_CHECKING(for dhclient) for client in "$with_dhcp_client" /sbin/dhclient /usr/pkg/sbin/dhclient /usr/local/sbin/dhclient; do @@ -347,15 +354,17 @@ if test "x$with_dhcp_client" = "x" || test x`basename "$with_dhcp_client"` = "xd "isc-dhclient-"*) DHCP_CLIENT_PATH="$client"; break;; esac done - if test "x$DHCP_CLIENT_PATH" = "x"; then + if test -z "$DHCP_CLIENT_PATH"; then AC_MSG_RESULT(no) - if test "x$with_dhcp_client" != "x"; then + if test -n "$with_dhcp_client"; then AC_MSG_ERROR([Could not find ISC dhclient]) fi + else + AC_MSG_RESULT($DHCP_CLIENT_PATH) fi - AC_MSG_RESULT($DHCP_CLIENT_PATH) fi -if test "x$with_dhcp_client" = "x" -a "x$DHCP_CLIENT_PATH" = "x" || test x`basename "$with_dhcp_client"` = "xdhcpcd"; then +if test -z "$DHCP_CLIENT_PATH" -a \( -z "$with_dhcp_client" -o x`basename "$with_dhcp_client"` = "xdhcpcd" \); then + test -n "$DHCP_CLIENT_PATH" && echo bar # We fully work with upstream dhcpcd-4 AC_MSG_CHECKING([for dhcpcd]) for client in "$with_dhcp_client" /sbin/dhcpcd /usr/pkg/sbin/dhcpcd /usr/local/sbin/dhcpcd; do @@ -365,19 +374,28 @@ if test "x$with_dhcp_client" = "x" -a "x$DHCP_CLIENT_PATH" = "x" || test x`basen "dhcpcd "*) DHCP_CLIENT_PATH="$client"; break;; esac done - if test "x$DHCP_CLIENT_PATH" = "x"; then + if test -z "$DHCP_CLIENT_PATH"; then AC_MSG_RESULT(no) - if test "x$with_dhcp_client" != "x"; then + if test -n "$with_dhcp_client"; then AC_MSG_ERROR([Could not find dhcpcd-4 or newer]) fi + else + AC_MSG_RESULT($DHCP_CLIENT_PATH) fi - AC_MSG_RESULT($DHCP_CLIENT_PATH) fi -if test "x$DHCP_CLIENT_PATH" = "x"; then - AC_MSG_ERROR([Could not find a suitable DHCP client]) +if test -z "$DHCP_CLIENT_PATH"; then + # DHCP clients are not a build time dependency, only runtime. + # dhclient has been the longtime default for NM and it's in /sbin + # in most distros, so use it. + AC_MSG_WARN([Could not find a suitable DHCP client]) + DHCP_CLIENT_PATH=/sbin/dhclient + AC_MSG_WARN([Falling back to ISC dhclient, ${DHCP_CLIENT_PATH}]) fi AC_SUBST(DHCP_CLIENT_PATH) DHCP_CLIENT=`basename "$DHCP_CLIENT_PATH"` +if test "$DHCP_CLIENT" != "dhclient" -a "$DHCP_CLIENT" != "dhcpcd"; then + AC_MSG_ERROR([No backend for the DHCP client ${DHCP_CLIENT}]) +fi AC_SUBST(DHCP_CLIENT) AC_ARG_ENABLE(more-warnings,