add compiled features into --version output (#462)

a lot of application which allow selecting features at build time seem
to output the build config with `--version` or similar (e.g ffmpeg).

aside from giving the user information about the feature set the binary
was compiled with (in case the user didn't compile it themselves, e.g on
a binary distro) it can also (possibly) help when submitting bug
reports.

Reviewed-on: https://codeberg.org/nsxiv/nsxiv/pulls/462
Reviewed-by: explosion-mental <explosion-mental@noreply.codeberg.org>
This commit is contained in:
NRK 2023-07-08 06:53:57 +00:00
parent bfab3a76a4
commit 9b122c82fa
3 changed files with 30 additions and 9 deletions

View File

@ -33,15 +33,6 @@
#include <libexif/exif-data.h> #include <libexif/exif-data.h>
#endif #endif
#ifdef IMLIB2_VERSION
#if IMLIB2_VERSION >= IMLIB2_VERSION_(1, 8, 0)
#define HAVE_IMLIB2_MULTI_FRAME 1
#endif
#endif
#ifndef HAVE_IMLIB2_MULTI_FRAME
#define HAVE_IMLIB2_MULTI_FRAME 0
#endif
#if HAVE_LIBGIF && !HAVE_IMLIB2_MULTI_FRAME #if HAVE_LIBGIF && !HAVE_IMLIB2_MULTI_FRAME
#include <gif_lib.h> #include <gif_lib.h>
enum { DEF_GIF_DELAY = 75 }; enum { DEF_GIF_DELAY = 75 };

View File

@ -159,6 +159,15 @@ typedef keymap_t button_t;
/* image.c */ /* image.c */
#ifdef IMLIB2_VERSION
#if IMLIB2_VERSION >= IMLIB2_VERSION_(1, 8, 0)
#define HAVE_IMLIB2_MULTI_FRAME 1
#endif
#endif
#ifndef HAVE_IMLIB2_MULTI_FRAME
#define HAVE_IMLIB2_MULTI_FRAME 0
#endif
typedef struct { typedef struct {
Imlib_Image im; Imlib_Image im;
unsigned int delay; unsigned int delay;

View File

@ -50,6 +50,27 @@ void print_usage(void)
static void print_version(void) static void print_version(void)
{ {
printf("%s %s\n", progname, VERSION); printf("%s %s\n", progname, VERSION);
fputs("features: "
#if HAVE_INOTIFY
"+inotify "
#endif
#if HAVE_LIBFONTS
"+statusbar "
#endif
#if HAVE_LIBEXIF
"+exif "
#endif
#if HAVE_IMLIB2_MULTI_FRAME
"+multiframe "
#else
#if HAVE_LIBGIF
"+giflib "
#endif
#if HAVE_LIBWEBP
"+libwebp "
#endif
#endif
"\n", stdout);
} }
void parse_options(int argc, char **argv) void parse_options(int argc, char **argv)