Re: [PATCH] Enable dhcpcd instead of dhclient



Roy Marples wrote:
Michael Biebl wrote:
Roy Marples wrote:
On Thu, 2008-07-17 at 10:14 -0400, Dan Williams wrote:
I don't have a problem with that.  So lets:

1) if given a full path that ends in dhclient or dhcpcd, don't do
further checks just use that
2) Document the required versions in the README
3) If nothing is found or specified, default to dhclient since that's
what it's been up until now

Sounds good to me.

Roy, will you write a patch for that?

Atttached is a patch for 1 and 3.
If no dhcp client is found, default to /sbin/dhclient and warn about it.
If a full path is given then don't check version, just use it. But do check we have a backend .c file for it.

I didn't do 2 as NM doesn't have a requirements file I could find.

Of course, I should have removed my debugging changes to ensure it worked ;)

Here is the correct patch.

Thanks

Roy
Index: configure.in
===================================================================
--- configure.in	(revision 3912)
+++ configure.in	(working copy)
@@ -336,7 +336,14 @@
 
 # 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 "x$with_dhcp_client" = "x" -a "x$DHCP_CLIENT_PATH" = "x" || test 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
@@ -372,10 +379,18 @@
 	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])
+	# 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 -f src/dhcp-manager/nm-dhcp-"${DHCP_CLIENT}".c; then
+	AC_MSG_ERROR([No backend for the DHCP client ${DHCP_CLIENT}])
+fi
 AC_SUBST(DHCP_CLIENT)
 
 AC_ARG_ENABLE(more-warnings,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]