From: Yu Watanabe Date: Sat, 6 Sep 2025 07:25:41 +0000 (+0900) Subject: musl: meson: explicitly link with libintl when necessary X-Git-Tag: v259-rc1~84^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bd19ffd9cb618b15cbd74110aeca2abab745fe9e;p=thirdparty%2Fsystemd.git musl: meson: explicitly link with libintl when necessary On some musl based distributions dgettext() may be provided by libintl.so. Hence, we need to add dependency in that case. --- diff --git a/meson.build b/meson.build index e5fd89e60ce..e3ee957fd5e 100644 --- a/meson.build +++ b/meson.build @@ -1005,6 +1005,22 @@ librt = cc.find_library('rt') libm = cc.find_library('m') libdl = cc.find_library('dl') +# On some distributions that use musl (e.g. Alpine), libintl.h may be provided by gettext rather than musl. +# In that case, we need to explicitly link with libintl.so. +if cc.has_function('dgettext', + prefix : '''#include ''', + args : '-D_GNU_SOURCE') + libintl = [] +else + libintl = cc.find_library('intl') + if not cc.has_function('dgettext', + prefix : '''#include ''', + args : '-D_GNU_SOURCE', + dependencies : libintl) + error('dgettext() not found') + endif +endif + # On some architectures, libatomic is required. But on some installations, # it is found, but actual linking fails. So let's try to use it opportunistically. # If it is installed, but not needed, it will be dropped because of --as-needed. diff --git a/src/home/meson.build b/src/home/meson.build index ebecc7b9c2b..f40f935d556 100644 --- a/src/home/meson.build +++ b/src/home/meson.build @@ -115,6 +115,7 @@ modules += [ 'sources' : pam_systemd_home_sources, 'dependencies' : [ libcrypt, + libintl, libpam_misc, libpam, threads,