ppp: detect the ppp version in the configure script
Previously, the ppp version was only detected (and used) at one place, in "nm-pppd-compat.c", after including the ppp headers. That was nice and easy. However, with that way, we could only detect it after including ppp headers, and given the ugliness of ppp headers, we only want to include them in "nm-pppd-compat.c" (and nowhere else). In particular, 'nm-pppd-compat.c" uses symbols from the ppp daemon, it thus can only be linked into a ppp plugin, not in NetworkManager core itself. But at some places we will need to know the ppp version, outside of the ppp plugin and "nm-pppd-compat.c". Additionally, detect it at configure time and place it in "config.h". There is a static assert that we are in agreement with the two ways of detection.
This commit is contained in:
@@ -239,6 +239,9 @@
|
|||||||
/* Define to path of pppd binary */
|
/* Define to path of pppd binary */
|
||||||
#mesondefine PPPD_PATH
|
#mesondefine PPPD_PATH
|
||||||
|
|
||||||
|
/* The detected ppp API version */
|
||||||
|
#mesondefine NM_PPP_VERSION_2_5_OR_NEWER
|
||||||
|
|
||||||
/* Define if you have iwd support */
|
/* Define if you have iwd support */
|
||||||
#mesondefine WITH_IWD
|
#mesondefine WITH_IWD
|
||||||
|
|
||||||
|
@@ -754,10 +754,12 @@ fi
|
|||||||
AC_SUBST(DBUS_SYS_DIR)
|
AC_SUBST(DBUS_SYS_DIR)
|
||||||
|
|
||||||
# pppd
|
# pppd
|
||||||
|
NM_PPP_VERSION_2_5_OR_NEWER=0
|
||||||
PPPD_VERSION=2.4.9
|
PPPD_VERSION=2.4.9
|
||||||
PKG_CHECK_EXISTS([pppd], [
|
PKG_CHECK_EXISTS([pppd], [
|
||||||
PPPD_VERSION=`$PKG_CONFIG --modversion pppd`
|
PPPD_VERSION=`$PKG_CONFIG --modversion pppd`
|
||||||
PPPD_CFLAGS=`$PKG_CONFIG --cflags pppd`
|
PPPD_CFLAGS=`$PKG_CONFIG --cflags pppd`
|
||||||
|
NM_PPP_VERSION_2_5_OR_NEWER=1
|
||||||
])
|
])
|
||||||
|
|
||||||
AC_ARG_ENABLE(ppp,
|
AC_ARG_ENABLE(ppp,
|
||||||
@@ -783,6 +785,7 @@ else
|
|||||||
PPPD_PLUGIN_DIR="${libdir}/pppd/$PPPD_VERSION"
|
PPPD_PLUGIN_DIR="${libdir}/pppd/$PPPD_VERSION"
|
||||||
fi
|
fi
|
||||||
AC_SUBST(PPPD_PLUGIN_DIR)
|
AC_SUBST(PPPD_PLUGIN_DIR)
|
||||||
|
AC_DEFINE_UNQUOTED(NM_PPP_VERSION_2_5_OR_NEWER, $NM_PPP_VERSION_2_5_OR_NEWER, [The detected ppp API version])
|
||||||
|
|
||||||
AC_ARG_WITH(pppd, AS_HELP_STRING([--with-pppd=/path/to/pppd], [path to pppd binary]))
|
AC_ARG_WITH(pppd, AS_HELP_STRING([--with-pppd=/path/to/pppd], [path to pppd binary]))
|
||||||
if test "x${with_pppd}" = x; then
|
if test "x${with_pppd}" = x; then
|
||||||
|
@@ -560,10 +560,12 @@ config_h.set10('WITH_FIREWALLD_ZONE', enable_firewalld_zone)
|
|||||||
|
|
||||||
# pppd
|
# pppd
|
||||||
enable_ppp = get_option('ppp')
|
enable_ppp = get_option('ppp')
|
||||||
|
NM_PPP_VERSION_2_5_OR_NEWER = 0
|
||||||
if enable_ppp
|
if enable_ppp
|
||||||
pppd_dep = dependency('pppd', required: false)
|
pppd_dep = dependency('pppd', required: false)
|
||||||
if (pppd_dep.found())
|
if (pppd_dep.found())
|
||||||
pppd_version = pppd_dep.version()
|
pppd_version = pppd_dep.version()
|
||||||
|
NM_PPP_VERSION_2_5_OR_NEWER = 1
|
||||||
else
|
else
|
||||||
assert(cc.has_header('pppd/pppd.h'), 'couldn\'t find pppd.h. pppd development headers are required')
|
assert(cc.has_header('pppd/pppd.h'), 'couldn\'t find pppd.h. pppd development headers are required')
|
||||||
pppd_version = '2.4.9'
|
pppd_version = '2.4.9'
|
||||||
@@ -584,6 +586,7 @@ if enable_ppp
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
config_h.set10('WITH_PPP', enable_ppp)
|
config_h.set10('WITH_PPP', enable_ppp)
|
||||||
|
config_h.set10('NM_PPP_VERSION_2_5_OR_NEWER', NM_PPP_VERSION_2_5_OR_NEWER)
|
||||||
|
|
||||||
# ModemManager1 with libmm-glib
|
# ModemManager1 with libmm-glib
|
||||||
enable_modem_manager = get_option('modem_manager')
|
enable_modem_manager = get_option('modem_manager')
|
||||||
|
@@ -75,6 +75,10 @@ _NM_PRAGMA_WARNING_REENABLE;
|
|||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
G_STATIC_ASSERT(PPP_VERSION_2_5_OR_NEWER == NM_PPP_VERSION_2_5_OR_NEWER);
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
G_STATIC_ASSERT((gint64) NM_PPP_STATUS_DEAD == PHASE_DEAD);
|
G_STATIC_ASSERT((gint64) NM_PPP_STATUS_DEAD == PHASE_DEAD);
|
||||||
G_STATIC_ASSERT((gint64) NM_PPP_STATUS_INITIALIZE == PHASE_INITIALIZE);
|
G_STATIC_ASSERT((gint64) NM_PPP_STATUS_INITIALIZE == PHASE_INITIALIZE);
|
||||||
G_STATIC_ASSERT((gint64) NM_PPP_STATUS_SERIALCONN == PHASE_SERIALCONN);
|
G_STATIC_ASSERT((gint64) NM_PPP_STATUS_SERIALCONN == PHASE_SERIALCONN);
|
||||||
|
Reference in New Issue
Block a user