From f19c9d2097c2c1c3e49f8a612db7268de20bbb3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eivind=20N=C3=A6ss?= Date: Sat, 4 Mar 2023 23:26:00 +0100 Subject: [PATCH] build: detect pppd version via pkg-config for PPPD_PLUGIN_DIR Ppp 2.5 adds a pkg-config file, so we can detect the version. Use it. [thaller@redhat.com: split out patch] (cherry picked from commit 0324098afaee6e9e72050b2c8a6fb47803c36494) (cherry picked from commit 89bde5c9caf949043cbe3bc82adb11f1eef83b92) --- configure.ac | 8 ++++++-- meson.build | 9 ++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 320eb37a6a..aa1a17c9b0 100644 --- a/configure.ac +++ b/configure.ac @@ -767,13 +767,17 @@ else fi AM_CONDITIONAL(WITH_PPP, test "${enable_ppp}" = "yes") +PPPD_VERSION=2.4.9 +PKG_CHECK_EXISTS([pppd], [ + PPPD_VERSION=`$PKG_CONFIG --modversion pppd` +]) + AC_ARG_WITH([pppd-plugin-dir], AS_HELP_STRING([--with-pppd-plugin-dir=DIR], [path to the pppd plugins directory])) - if test -n "$with_pppd_plugin_dir" ; then PPPD_PLUGIN_DIR="$with_pppd_plugin_dir" else - PPPD_PLUGIN_DIR="${libdir}/pppd/2.4.5" + PPPD_PLUGIN_DIR="${libdir}/pppd/$PPPD_VERSION" fi AC_SUBST(PPPD_PLUGIN_DIR) diff --git a/meson.build b/meson.build index 525be69c6a..7d6cdbe958 100644 --- a/meson.build +++ b/meson.build @@ -563,6 +563,13 @@ enable_ppp = get_option('ppp') if enable_ppp assert(cc.has_header('pppd/pppd.h'), 'couldn\'t find pppd.h. pppd development headers are required') + pppd_dep = dependency('pppd', required: false) + if (pppd_dep.found()) + pppd_version = pppd_dep.version() + else + pppd_version = '2.4.9' + endif + pppd_path = get_option('pppd') if pppd_path == '' pppd = find_program('pppd', '/sbin/pppd', '/usr/sbin/pppd', required: false) @@ -574,7 +581,7 @@ if enable_ppp pppd_plugin_dir = get_option('pppd_plugin_dir') if pppd_plugin_dir == '' - pppd_plugin_dir = join_paths(nm_libdir, 'pppd', '2.4.5') + pppd_plugin_dir = join_paths(nm_libdir, 'pppd', pppd_version) endif endif config_h.set10('WITH_PPP', enable_ppp)