Check for dhclient hostname support
authorMarcel Holtmann <marcel@holtmann.org>
Thu, 13 May 2010 11:08:32 +0000 (13:08 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 13 May 2010 11:08:32 +0000 (13:08 +0200)
configure.ac
plugins/dhclient.c

index 3fc7b88..94d518e 100644 (file)
@@ -128,6 +128,12 @@ if (test "${enable_dhclient}" != "no"); then
                DHCLIENT="${path_dhclient}"
                AC_SUBST(DHCLIENT)
        fi
+       AC_MSG_CHECKING(dhclient major version)
+       version_dhclient=`${DHCLIENT} --version 2>&1 | sed '/^isc-dhclient-*/!d; s///; s/\..*//;q'`
+       AC_MSG_RESULT(${version_dhclient})
+       if (test "${version_dhclient}" = "4"); then
+               AC_DEFINE(HAVE_DHCLIENT_HOSTNAME, 1, [Define to 1 if you have dhclient hostname support.])
+       fi
 fi
 AM_CONDITIONAL(DHCLIENT, test "${enable_dhclient}" != "no")
 AM_CONDITIONAL(DHCLIENT_BUILTIN, test "${enable_dhclient}" = "builtin")
index d29b1d6..fd86773 100644 (file)
@@ -147,8 +147,10 @@ static void dhclient_setup(struct connman_task *task, const char *ifname)
        connman_task_add_argument(task, "-sf", "%s/dhclient-script", SCRIPTDIR);
 
        hostname = connman_utsname_get_hostname();
+#ifdef HAVE_DHCLIENT_HOSTNAME
        if (hostname != NULL)
                connman_task_add_argument(task, "-H", hostname);
+#endif
 
        connman_task_add_argument(task, ifname, NULL);
        connman_task_add_argument(task, "-n", NULL);