build: allow disabling PPP support at build time

Pass --enable-ppp=no and pppd headers won't be required, and the
pppd plugin won't be built.  Here's to you, Gentoo!
This commit is contained in:
Dan Williams 2011-02-21 17:48:08 -06:00
parent b712274e86
commit a096d3a676
3 changed files with 30 additions and 3 deletions

View file

@ -359,9 +359,16 @@ else
fi
AC_SUBST(DBUS_SYS_DIR)
# PPPD
AC_CHECK_HEADERS(pppd/pppd.h,,
AC_MSG_ERROR(couldn't find pppd.h. pppd development headers are required.))
# pppd
AC_ARG_ENABLE(ppp, AC_HELP_STRING([--enable-ppp], [enable PPP/PPPoE support]),
[enable_ppp=${enableval}], [enable_ppp=yes])
if (test "${enable_ppp}" = "yes"); then
AC_CHECK_HEADERS(pppd/pppd.h,,
AC_MSG_ERROR(couldn't find pppd.h. pppd development headers are required.))
AC_DEFINE(WITH_PPP, 1, [Define if you have PPP support])
fi
AM_CONDITIONAL(WITH_PPP, test "${enable_ppp}" = "yes")
AC_ARG_WITH([pppd-plugin-dir], AS_HELP_STRING([--with-pppd-plugin-dir=DIR], [path to the pppd plugins directory]))
@ -372,6 +379,7 @@ else
fi
AC_SUBST(PPPD_PLUGIN_DIR)
# dhclient support
AC_ARG_WITH([dhclient], AS_HELP_STRING([--with-dhclient=yes|no|path], [Enable dhclient 4.x support]))
# If a full path is given, use that and do not test if it works or not.
@ -659,6 +667,12 @@ else
echo WiMAX support: no
fi
if test "${enable_ppp}" = "yes"; then
echo PPP support: yes
else
echo PPP support: no
fi
echo
echo Building documentation: ${with_docs}
echo Building tests: ${with_tests}

View file

@ -33,6 +33,8 @@ libppp_manager_la_LIBADD = \
$(DBUS_LIBS) \
$(GLIB_LIBS)
if WITH_PPP
pppd_plugindir = $(PPPD_PLUGIN_DIR)
pppd_plugin_LTLIBRARIES = nm-pppd-plugin.la
@ -52,6 +54,8 @@ nm_pppd_plugin_la_LIBADD = \
$(DBUS_LIBS) \
$(GLIB_LIBS)
endif
BUILT_SOURCES = nm-ppp-manager-glue.h
CLEANFILES = $(BUILT_SOURCES)

View file

@ -958,6 +958,15 @@ nm_ppp_manager_start (NMPPPManager *manager,
priv = NM_PPP_MANAGER_GET_PRIVATE (manager);
#if !WITH_PPP
/* PPP support disabled */
g_set_error_literal (err,
NM_PPP_MANAGER_ERROR,
NM_PPP_MANAGER_ERROR_UNKOWN,
"PPP support is not enabled.");
return FALSE;
#endif
priv->pid = 0;
/* Make sure /dev/ppp exists (bgo #533064) */