distro: add --with-netconfig option for SUSE

NetworkManager can use resolvconf and netconfig as alternatives
to direct modifications to /etc/resolv.conf. You can now choose
whether to build with netconfig or not.

The default is --with-netconfig=yes on SUSE and --with-netconfig=no
on other distributions. Default --with-resolvconf=no still applies
on any distribution.
This commit is contained in:
Pavel Šimerda
2012-09-25 00:12:52 +02:00
parent 38e3819b4e
commit 71e5437f18
2 changed files with 28 additions and 33 deletions

View File

@@ -639,36 +639,27 @@ AC_SUBST(DHCLIENT_PATH)
AC_SUBST(DHCLIENT_VERSION) AC_SUBST(DHCLIENT_VERSION)
AC_SUBST(DHCPCD_PATH) AC_SUBST(DHCPCD_PATH)
# resolvconf support # resolvconf and netconfig support
AC_ARG_WITH([resolvconf], AC_ARG_WITH(resolvconf, AS_HELP_STRING([--with-resolvconf=yes|no|path], [Enable resolvconf support]))
AS_HELP_STRING([--with-resolvconf=yes|no|path], [Enable resolvconf support]), AC_ARG_WITH(netconfig, AS_HELP_STRING([--with-netconfig=yes|no], [Enable SUSE netconfig support]))
with_resolvconf="$withval",with_resolvconf=no) # Use netconfig by default on SUSE
# If a full path is given, use that and do not test if it works or not. AS_IF([test -z "$with_netconfig"], AC_CHECK_FILE(/etc/SuSE-release, with_netconfig=yes))
case "${with_resolvconf}" in # Otherwise default to "no"
/*) AS_IF([test -z "$with_resolvconf"], with_resolvconf=no)
RESOLVCONF_PATH="${with_resolvconf}" AS_IF([test -z "$with_netconfig"], with_netconfig=no)
AC_MSG_NOTICE(setting resolvconf path to ${RESOLVCONF_PATH}) # Find resolvconf and netconfig
;; if test "$with_resolvconf" = "yes"; then
no) AC_MSG_NOTICE(resolvconf support disabled) AC_PATH_PROGS(with_resolvconf, resolvconf, no, /sbin:/usr/sbin:/usr/local/sbin)
;; fi
*) if test "$with_netconfig" = "yes"; then
AC_MSG_CHECKING(for resolvconf) AC_PATH_PROGS(with_netconfig, netconfig, no, /sbin:/usr/sbin:/usr/local/sbin)
for path in /sbin /usr/sbin /usr/pkg/sbin /usr/local/sbin; do fi
if test -x "${path}/resolvconf"; then # Define resolvconf and netconfig paths
RESOLVCONF_PATH="${path}/resolvconf" if test "${with_resolvconf}" != "no"; then
break AC_DEFINE_UNQUOTED(RESOLVCONF_PATH, "$with_resolvconf", [Path to resolvconf (if enabled)])
fi fi
done if test -n "${with_netconfig}" != "no"; then
if test -n "${RESOLVCONF_PATH}"; then AC_DEFINE_UNQUOTED(NETCONFIG_PATH, "$with_netconfig", [Path to netconfig (if enabled)])
AC_MSG_RESULT($RESOLVCONF_PATH)
else
AC_MSG_RESULT(no)
fi
;;
esac
AC_SUBST(RESOLVCONF_PATH)
if test -n "${RESOLVCONF_PATH}"; then
AC_DEFINE_UNQUOTED(RESOLVCONF_PATH, "$RESOLVCONF_PATH", [Define if you have a resolvconf implementation])
fi fi
# iptables path # iptables path
@@ -861,6 +852,10 @@ echo Distribution target: ${with_distro}
echo 'if this is not correct, please specifiy your distro with --with-distro=DISTRO' echo 'if this is not correct, please specifiy your distro with --with-distro=DISTRO'
echo echo
echo "Handlers for /etc/resolv.conf:"
echo " resolvconf: ${with_resolvconf}"
echo " netconfig: ${with_netconfig}"
echo
if test -n "${DHCLIENT_PATH}"; then if test -n "${DHCLIENT_PATH}"; then
echo ISC dhclient support: ${DHCLIENT_PATH} echo ISC dhclient support: ${DHCLIENT_PATH}

View File

@@ -206,7 +206,7 @@ merge_one_ip6_config (NMResolvConfData *rc, NMIP6Config *src, const char *iface)
} }
#if defined(TARGET_SUSE) #if defined(NETCONFIG_PATH)
/**********************************/ /**********************************/
/* SUSE */ /* SUSE */
@@ -230,7 +230,7 @@ run_netconfig (GError **error, gint *stdin_fd)
char *tmp; char *tmp;
GPid pid = -1; GPid pid = -1;
argv[0] = "/sbin/netconfig"; argv[0] = NETCONFIG_PATH;
argv[1] = "modify"; argv[1] = "modify";
argv[2] = "--service"; argv[2] = "--service";
argv[3] = "NetworkManager"; argv[3] = "NetworkManager";
@@ -754,7 +754,7 @@ update_dns (NMDnsManager *self,
success = dispatch_resolvconf (domain, searches, nameservers, iface, error); success = dispatch_resolvconf (domain, searches, nameservers, iface, error);
#endif #endif
#ifdef TARGET_SUSE #ifdef NETCONFIG_PATH
if (success == FALSE) { if (success == FALSE) {
success = dispatch_netconfig (domain, searches, nameservers, success = dispatch_netconfig (domain, searches, nameservers,
nis_domain, nis_servers, nis_domain, nis_servers,