In addition to the package-version and release-name, output the CLI implementation (if any) and whether mini-gmp was used, e.g.: $ ./src/nft -v nftables v0.9.2 (Scram) cli: linenoise minigmp: no Signed-off-by: Jeremy Sowden <jeremy@xxxxxxxxxx> --- src/Makefile.am | 3 +++ src/main.c | 28 ++++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 5c2ecbd87288..780f8c6b2b0b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -16,6 +16,9 @@ endif if BUILD_CLI_LINENOISE AM_CPPFLAGS += -DHAVE_LINENOISE endif +if BUILD_MINIGMP +AM_CPPFLAGS += -DHAVE_MINIGMP +endif AM_CFLAGS = -Wall \ -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations \ diff --git a/src/main.c b/src/main.c index f77d8a820a02..866f66e288e2 100644 --- a/src/main.c +++ b/src/main.c @@ -154,6 +154,31 @@ static void show_help(const char *name) name, DEFAULT_INCLUDE_PATH); } +static void show_version(void) +{ + const char *cli, *minigmp; + +#if defined(HAVE_LIBREADLINE) + cli = "readline"; +#elif defined(HAVE_LINENOISE) + cli = "linenoise"; +#else + cli = "no"; +#endif + +#if defined(HAVE_MINIGMP) + minigmp = "yes"; +#else + minigmp = "no"; +#endif + + printf("%s v%s (%s)\n" + " cli: %s\n" + " minigmp: %s\n", + PACKAGE_NAME, PACKAGE_VERSION, RELEASE_NAME, + cli, minigmp); +} + static const struct { const char *name; enum nft_debug_level level; @@ -213,8 +238,7 @@ int main(int argc, char * const *argv) show_help(argv[0]); exit(EXIT_SUCCESS); case OPT_VERSION: - printf("%s v%s (%s)\n", - PACKAGE_NAME, PACKAGE_VERSION, RELEASE_NAME); + show_version(); exit(EXIT_SUCCESS); case OPT_CHECK: nft_ctx_set_dry_run(nft, true); -- 2.23.0