From ebc5ea0b80072b5026d8fb220208befd00bdd2c3 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Fri, 4 Apr 2014 11:19:40 -0400 Subject: [PATCH] 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. --- configure.ac | 9 +++++++++ src/ppp-manager/nm-ppp-manager.c | 15 ++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 2ca6aed586..4f51831075 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/src/ppp-manager/nm-ppp-manager.c b/src/ppp-manager/nm-ppp-manager.c index 822721531c..9ab140db10 100644 --- a/src/ppp-manager/nm-ppp-manager.c +++ b/src/ppp-manager/nm-ppp-manager.c @@ -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");