diff --git a/ChangeLog b/ChangeLog index 4b28ca8098..f785715185 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-06-10 Dan Williams + + * configure.in + - Add TARGET_* define to config.h to distinguish distros + + * src/dhcp-manager/nm-dhcp-manager.c + - (dhclient_run): use distro-specific path for dhclient config file + 2008-06-09 Dan Williams * src/dnsmasq-manager/nm-dnsmasq-manager.c diff --git a/configure.in b/configure.in index 7e14720ccb..16b42091af 100644 --- a/configure.in +++ b/configure.in @@ -105,15 +105,51 @@ else ;; esac fi + AM_CONDITIONAL(TARGET_REDHAT, test x"$with_distro" = xredhat) +if test x"$with_distro" = xredhat; then + AC_DEFINE(TARGET_REDHAT, 1, [Define if you have Fedora or RHEL]) +fi + AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse) +if test x"$with_distro" = xsuse; then + AC_DEFINE(TARGET_SUSE, 1, [Define if you have OpenSUSE or SLES]) +fi + AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo) +if test x"$with_distro" = xgentoo; then + AC_DEFINE(TARGET_GENTOO, 1, [Define if you have Gentoo]) +fi + AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian) +if test x"$with_distro" = xdebian; then + AC_DEFINE(TARGET_DEBIAN, 1, [Define if you have Debian]) +fi + AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware) +if test x"$with_distro" = xslackware; then + AC_DEFINE(TARGET_SLACKWARE, 1, [Define if you have Slackware]) +fi + AM_CONDITIONAL(TARGET_ARCH, test x"$with_distro" = xarch) +if test x"$with_distro" = xarch; then + AC_DEFINE(TARGET_ARCH, 1, [Define if you have Arch]) +fi + AM_CONDITIONAL(TARGET_PALDO, test x"$with_distro" = xpaldo) +if test x"$with_distro" = xpaldo; then + AC_DEFINE(TARGET_PALDO, 1, [Define if you have Paldo]) +fi + AM_CONDITIONAL(TARGET_FRUGALWARE, test x"$with_distro" = xfrugalware) +if test x"$with_distro" = xfrugalware; then + AC_DEFINE(TARGET_FRUGALWARE, 1, [Define if you have Frugalware]) +fi + AM_CONDITIONAL(TARGET_MANDRIVA, test x"$with_distro" = xmandriva) +if test x"$with_distro" = xmandriva; then + AC_DEFINE(TARGET_MANDRIVA, 1, [Define if you have Mandriva]) +fi AC_MSG_CHECKING([Linux Wireless Extensions >= 18]) AC_TRY_COMPILE([#ifndef __user diff --git a/src/dhcp-manager/nm-dhcp-manager.c b/src/dhcp-manager/nm-dhcp-manager.c index 282ce78e5e..45294b9490 100644 --- a/src/dhcp-manager/nm-dhcp-manager.c +++ b/src/dhcp-manager/nm-dhcp-manager.c @@ -55,6 +55,15 @@ #define NM_DHCP_TIMEOUT 45 /* DHCP timeout, in seconds */ +#if defined(TARGET_SUSE) +#define DHCLIENT_CONF_PATH SYSCONFDIR "/dhclient.conf" +#elif defined(TARGET_DEBIAN) +#define DHCLIENT_CONF_PATH SYSCONFDIR "/dhcp3/dhclient.conf" +#else +#define DHCLIENT_CONF_PATH_FORMAT SYSCONFDIR "/dhclient-%s.conf" +#endif + + static const char *dhclient_binary_paths[] = { "/sbin/dhclient", @@ -636,7 +645,11 @@ dhclient_run (NMDHCPDevice *device) goto out; } - conffile = g_strdup_printf (SYSCONFDIR "/dhclient-%s.conf", device->iface); +#ifdef DHCLIENT_CONF_PATH_FORMAT + conffile = g_strdup_printf (DHCLIENT_CONF_PATH_FORMAT, device->iface); +#else + conffile = g_strdup (DHCLIENT_CONF_PATH); +#endif if (!conffile) { nm_warning ("%s: not enough memory for dhclient options.", device->iface); goto out;