From 5d5ed4274952ea649942ec22ab504ae8f851f1dc Mon Sep 17 00:00:00 2001 From: chme Date: Sat, 2 Sep 2017 07:30:23 +0200 Subject: [PATCH] [main/misc] Add misc-function to retrieve enabled buildoptions --- src/main.c | 37 ++++++++----------------------------- src/misc.c | 35 +++++++++++++++++++++++++++++++++++ src/misc.h | 3 +++ 3 files changed, 46 insertions(+), 29 deletions(-) diff --git a/src/main.c b/src/main.c index 7fce010c..e1ff16c4 100644 --- a/src/main.c +++ b/src/main.c @@ -465,13 +465,14 @@ main(int argc, char **argv) char *logfile; char *ffid; char *pidfile; - char buildopts[256]; + char **buildopts; const char *gcry_version; sigset_t sigs; int sigfd; #ifdef HAVE_KQUEUE struct kevent ke_sigs[4]; #endif + int i; int ret; struct option option_map[] = @@ -591,34 +592,12 @@ main(int argc, char **argv) DPRINTF(E_LOG, L_MAIN, "Forked Media Server Version %s taking off\n", VERSION); - /* Remember to check the size of buildopts when adding new opts */ - strcpy(buildopts, ""); -#ifdef ITUNES - strcat(buildopts, " --enable-itunes"); -#endif -#ifdef SPOTIFY - strcat(buildopts, " --enable-spotify"); -#endif -#ifdef LASTFM - strcat(buildopts, " --enable-lastfm"); -#endif -#ifdef CHROMECAST - strcat(buildopts, " --enable-chromecast"); -#endif -#ifdef MPD - strcat(buildopts, " --enable-mpd"); -#endif -#ifdef RAOP_VERIFICATION - strcat(buildopts, " --enable-verification"); -#endif -#ifdef HAVE_ALSA - strcat(buildopts, " --with-alsa"); -#endif -#ifdef HAVE_LIBPULSE - strcat(buildopts, " --with-pulseaudio"); -#endif - - DPRINTF(E_LOG, L_MAIN, "Built %s with:%s\n", __DATE__, buildopts); + DPRINTF(E_LOG, L_MAIN, "Built %s with:\n", __DATE__); + buildopts = buildopts_get(); + for (i = 0; buildopts[i]; i++) + { + DPRINTF(E_LOG, L_MAIN, "- %s\n", buildopts[i]); + } ret = av_lockmgr_register(ffmpeg_lockmgr); if (ret < 0) diff --git a/src/misc.c b/src/misc.c index 25f0d1b8..fe34cb24 100644 --- a/src/misc.c +++ b/src/misc.c @@ -46,6 +46,41 @@ #include "misc.h" +static char *buildopts[] = + { +#ifdef ITUNES + "iTunes XML", +#endif +#ifdef SPOTIFY + "Spotify", +#endif +#ifdef LASTFM + "LastFM", +#endif +#ifdef CHROMECAST + "Chromecast", +#endif +#ifdef MPD + "MPD", +#endif +#ifdef RAOP_VERIFICATION + "Device verification", +#endif +#ifdef HAVE_ALSA + "ALSA", +#endif +#ifdef HAVE_LIBPULSE + "Pulseaudio", +#endif + NULL + }; + +char ** +buildopts_get() +{ + return buildopts; +} + int safe_atoi32(const char *str, int32_t *val) { diff --git a/src/misc.h b/src/misc.h index ac9cf488..1337c307 100644 --- a/src/misc.h +++ b/src/misc.h @@ -29,6 +29,9 @@ struct keyval { }; +char ** +buildopts_get(void); + int safe_atoi32(const char *str, int32_t *val);