summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorPavel Šimerda <psimerda@redhat.com>2012-10-30 00:31:51 +0100
committerDan Williams <dcbw@redhat.com>2012-11-16 15:27:22 -0600
commitffb60cdba45b344c189449751f387729a343bee0 (patch)
tree3051f2f665128632d3888094647e56490b8ac039 /configure.ac
parent077fafa870d685651ba47ac59709e0518f1bc28b (diff)
downloadNetworkManager-ffb60cdba45b344c189449751f387729a343bee0.tar.gz
dhcp: improve DHCP client selection in configure.ac
This patch is mostly just a cleanup. It removes some obsolete processing related to DHCP client support.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac124
1 files changed, 38 insertions, 86 deletions
diff --git a/configure.ac b/configure.ac
index cf7c94db15..6f01330f29 100644
--- a/configure.ac
+++ b/configure.ac
@@ -471,7 +471,7 @@ AC_ARG_ENABLE(ppp, AS_HELP_STRING([--enable-ppp], [enable PPP/PPPoE support]),
[enable_ppp=${enableval}], [enable_ppp=yes])
if (test "${enable_ppp}" = "yes"); then
AC_CHECK_HEADERS(pppd/pppd.h,,
- AC_MSG_ERROR(couldn't find pppd.h. pppd development headers are required.))
+ AC_MSG_ERROR("couldn't find pppd.h. pppd development headers are required."))
AC_DEFINE(WITH_PPP, 1, [Define if you have PPP support])
else
@@ -489,83 +489,43 @@ fi
AC_SUBST(PPPD_PLUGIN_DIR)
-# dhclient support
+# DHCP client support
AC_ARG_WITH([dhclient], AS_HELP_STRING([--with-dhclient=yes|no|path], [Enable dhclient 4.x support]))
-# If a full path is given, use that and do not test if it works or not.
-case "${with_dhclient}" in
- # NM only works with ISC dhclient - other derivatives don't have
- # the same userland. dhclient 4.x is required for IPv6 support;
- # with older versions NM won't be able to use DHCPv6.
-
- /*)
- DHCLIENT_PATH="${with_dhclient}"
- DHCLIENT_VERSION=4
- if test -x "${with_dhclient}"; then
- case `"${with_dhclient}" --version 2>&1` in
- "isc-dhclient-4"*) DHCLIENT_VERSION=4; break;;
- "isc-dhclient-V3"*) DHCLIENT_VERSION=3; break;;
- esac
- fi
- AC_MSG_NOTICE(using dhclient at ${DHCLIENT_PATH})
- ;;
- no) AC_MSG_NOTICE(dhclient support disabled)
- ;;
- *)
- AC_MSG_CHECKING(for dhclient)
- for path in /sbin /usr/sbin /usr/pkg/sbin /usr/local/sbin; do
- test -x "${path}/dhclient" || continue
- case `"$path/dhclient" --version 2>&1` in
- "isc-dhclient-4"*) DHCLIENT_PATH="$path/dhclient"; DHCLIENT_VERSION=4; break;;
- "isc-dhclient-V3"*) DHCLIENT_PATH="$path/dhclient"; DHCLIENT_VERSION=3; break;;
- esac
- done
- if test -n "${DHCLIENT_PATH}"; then
- AC_MSG_RESULT($DHCLIENT_PATH)
- else
- AC_MSG_RESULT(no)
- fi
- ;;
-esac
-
-# dhcpcd support
AC_ARG_WITH([dhcpcd], AS_HELP_STRING([--with-dhcpcd=yes|no|path], [Enable dhcpcd 4.x support]))
-# If a full path is given, use that and do not test if it works or not.
-case "${with_dhcpcd}" in
- /*)
- DHCPCD_PATH="${with_dhcpcd}"
- AC_MSG_NOTICE(using dhcpcd at ${DHCPCD_PATH})
- ;;
- no) AC_MSG_NOTICE(dhcpcd support disabled)
- ;;
- *)
- AC_MSG_CHECKING(for dhcpcd)
- # We fully work with upstream dhcpcd-4
- for path in /sbin /usr/sbin /usr/pkg/sbin /usr/local/sbin; do
- test -x "${path}/dhcpcd" || continue
- case `"$path/dhcpcd" --version 2>/dev/null` in
- "dhcpcd "[123]*);;
- "dhcpcd "*) DHCPCD_PATH="$path/dhcpcd"; break;;
- esac
- done
- if test -n "${DHCPCD_PATH}"; then
- AC_MSG_RESULT($DHCPCD_PATH)
- else
- AC_MSG_RESULT(no)
+# Default to "yes"
+AS_IF([test -z "$with_dhclient"], with_dhclient=yes)
+AS_IF([test -z "$with_dhcpcd"], with_dhcpcd=yes)
+# Search and check the executables
+if test "$with_dhclient" = "yes"; then
+ AC_PATH_PROGS(with_dhclient, dhclient, no, /sbin:/usr/sbin:/usr/local/sbin)
+ if test "$with_dhclient" != "no"; then
+ if ! $with_dhclient --version 2>&1 | grep -q "^isc-dhclient-4\."; then
+ AC_MSG_WARN([Cannot use dhclient, version 4.x is required])
+ with_dhclient=no
fi
- ;;
-esac
-
-if test -z "$DHCPCD_PATH" -a -z "$DHCLIENT_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])
- DHCLIENT_PATH=/sbin/dhclient
- AC_MSG_WARN([Falling back to ISC dhclient, ${DHCLIENT_PATH}])
+ fi
+fi
+if test "$with_dhcpcd" = "yes"; then
+ AC_PATH_PROGS(with_dhcpcd, dhcpcd, no, /sbin:/usr/sbin:/usr/local/sbin)
+ if test "$with_dhcpcd" != "no"; then
+ if ! $with_dhcpcd --version 2>&1 | grep -q "^dhcpcd [[45]]\."; then
+ AC_MSG_WARN([Cannot use dhcpcd, version 4.x or 5.x is required])
+ with_dhcpcd=no
+ fi
+ fi
+fi
+# Fallback
+if test "$with_dhclient" = "no" -a "$with_dhcpcd" = "no"; then
+ AC_MSG_WARN([Could not find a suitable DHCP client, falling back to dhclient])
+ with_dhclient=/sbin/dhclient
+fi
+# Add substitutions
+if test "$with_dhclient" != "no"; then
+ AC_SUBST(DHCLIENT_PATH, $with_dhclient)
+fi
+if test "$with_dhcpcd" != "no"; then
+ AC_SUBST(DHCPCD_PATH, $with_dhcpcd)
fi
-AC_SUBST(DHCLIENT_PATH)
-AC_SUBST(DHCLIENT_VERSION)
-AC_SUBST(DHCPCD_PATH)
# resolvconf and netconfig support
AC_ARG_WITH(resolvconf, AS_HELP_STRING([--with-resolvconf=yes|no|path], [Enable resolvconf support]))
@@ -793,18 +753,10 @@ echo " resolvconf: ${with_resolvconf}"
echo " netconfig: ${with_netconfig}"
echo
-if test -n "${DHCLIENT_PATH}"; then
- echo ISC dhclient support: ${DHCLIENT_PATH}
- echo ISC dhclient version: ${DHCLIENT_VERSION}
-else
- echo ISC dhclient support: no
-fi
-
-if test -n "${DHCPCD_PATH}"; then
- echo dhcpcd support: ${DHCPCD_PATH}
-else
- echo dhcpcd support: no
-fi
+echo "DHCP clients:"
+echo " dhclient: $with_dhclient"
+echo " dhcpcd: $with_dhcpcd"
+echo
if test "${enable_polkit}" = "yes"; then
if test "${enable_modify_system}"; then