From abcc28985f5ab3b50c3ed85abee5e7f8bbd0889e Mon Sep 17 00:00:00 2001
From: Oliver Smith <ollieparanoid@postmarketos.org>
Date: Sun, 21 Dec 2025 17:04:26 +0100
Subject: [PATCH] meson: disable libintl check if pam is disabled

Disable the libintl check when building without the pam feature, so e.g.
systemd-boot can be (cross) compiled without having the foreign arch
libintl installed on a musl platform.
---
 meson.build | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/meson.build b/meson.build
index bcf1ff2df5..c7088f3d9c 100644
--- a/meson.build
+++ b/meson.build
@@ -1021,11 +1021,10 @@ 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',
+libintl = []
+if get_option('pam').enabled() and not cc.has_function('dgettext',
                    prefix : '''#include <libintl.h>''',
                    args : '-D_GNU_SOURCE')
-        libintl = []
-else
         libintl = cc.find_library('intl')
         if not cc.has_function('dgettext',
                                prefix : '''#include <libintl.h>''',
-- 
2.52.0

