ncmpc
ncmpc copied to clipboard
Fix build with -Dnls=false on toolchain providing libintl.h
Always check for libintl.h
to avoid a clash with ncmpc fake gettext. If libintl.h
is available, include it and undef getext before defining fake gettext. Indeed, a toolchain can provide an external gettext definition in libintl.h which will be included indirectly into ncmpc (e.g., though include <chrono>
) resulting in the following build failure if the user disables NLS through -Dnls=false
:
In file included from ../src/save_playlist.cxx:8:
/home/buildroot/autobuild/instance-2/output-1/host/or1k-buildroot-linux-gnu/sysroot/usr/include/libintl.h:39:14: error: expected unqualified-id before 'const'
39 | extern char *gettext (const char *__msgid)
| ^~~~~~~
/home/buildroot/autobuild/instance-2/output-1/host/or1k-buildroot-linux-gnu/sysroot/usr/include/libintl.h:39:14: error: expected ')' before 'const'
../src/i18n.h:22:20: note: to match this '('
22 | #define gettext(x) (x)
| ^
Fixes:
- http://autobuild.buildroot.org/results/c860e64909dd3b7fa033db0970e1cfc1376c4ec5
- http://autobuild.buildroot.org/results/36eab556fac80124755bff4110af3e43fe6edd78