ppp-manager: find pppd at build time, allow overriding

Add --with-pppd, just like --with-dnsmasq.

Also change "ppp" to "pppd" for clarity in a few places.
This commit is contained in:
Dan Winship 2014-04-04 11:19:40 -04:00
parent 3e58107fe0
commit ebc5ea0b80
2 changed files with 17 additions and 7 deletions

View file

@ -537,6 +537,15 @@ else
fi
AC_SUBST(PPPD_PLUGIN_DIR)
AC_ARG_WITH(pppd, AS_HELP_STRING([--with-pppd=/path/to/pppd], [path to pppd binary]))
if test "x${with_pppd}" = x; then
AC_PATH_PROG(PPPD_PATH, pppd, [], $PATH:/sbin:/usr/sbin)
else
PPPD_PATH="$with_pppd"
fi
AC_DEFINE_UNQUOTED(PPPD_PATH, "$PPPD_PATH", [Define to path of pppd binary])
AC_SUBST(PPPD_PATH)
# ModemManager1 with libmm-glib
AC_ARG_WITH(modem-manager-1, AS_HELP_STRING([--with-modem-manager-1], [Enable new ModemManager1 interface support]),,[with_modem_manager_1=auto])
if (test "${with_modem_manager_1}" != "no"); then

View file

@ -651,16 +651,17 @@ static inline const char *
nm_find_pppd (void)
{
static const char *pppd_binary_paths[] = {
PPPD_PATH,
"/usr/local/sbin/pppd",
"/usr/sbin/pppd",
"/sbin/pppd",
NULL
};
const char **pppd_binary = pppd_binary_paths;
const char **pppd_binary = pppd_binary_paths;
while (*pppd_binary != NULL) {
if (g_file_test (*pppd_binary, G_FILE_TEST_EXISTS))
if (**pppd_binary && g_file_test (*pppd_binary, G_FILE_TEST_EXISTS))
break;
pppd_binary++;
}
@ -787,22 +788,22 @@ create_pppd_cmd_line (NMPPPManager *self,
GError **err)
{
NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (self);
const char *ppp_binary;
const char *pppd_binary;
NMCmdLine *cmd;
gboolean ppp_debug;
g_return_val_if_fail (setting != NULL, NULL);
ppp_binary = nm_find_pppd ();
if (!ppp_binary) {
pppd_binary = nm_find_pppd ();
if (!pppd_binary) {
g_set_error (err, NM_PPP_MANAGER_ERROR, NM_PPP_MANAGER_ERROR,
"Could not find ppp binary.");
"Could not find pppd binary.");
return NULL;
}
/* Create pppd command line */
cmd = nm_cmd_line_new ();
nm_cmd_line_add_string (cmd, ppp_binary);
nm_cmd_line_add_string (cmd, pppd_binary);
nm_cmd_line_add_string (cmd, "nodetach");
nm_cmd_line_add_string (cmd, "lock");