meson: Explicitly check for musl for gshadow and nss

This allows building with musl on glibc systems as follows:

env \
    CC=musl-gcc \
    CXX=musl-gcc \
    CFLAGS="-idirafter /usr/include" \
    CXXFLAGS="-idirafter /usr/include" \
        meson setup --auto-features=disabled -Dlibc=musl musl
This commit is contained in:
Daan De Meyer
2026-02-19 20:04:06 +01:00
committed by Daan De Meyer
parent fd6506eb9a
commit 5ab8bba2b0
+8 -10
View File
@@ -675,8 +675,6 @@ conf.set('GPERF_LEN_TYPE', gperf_len_type,
#####################################################################
foreach header : [
'gshadow.h',
'nss.h',
'sys/sdt.h',
'threads.h',
'valgrind/memcheck.h',
@@ -1603,11 +1601,11 @@ foreach tuple : [
['efi'],
['environment-d'],
['firstboot'],
['gshadow', conf.get('HAVE_GSHADOW_H') == 1, 'gshadow.h not found'],
['gshadow', get_option('libc') != 'musl', 'musl does not support it'],
['hibernate'],
['hostnamed'],
['hwdb'],
['idn', conf.get('HAVE_NI_IDN') == 1, 'NI_IDN is not defined'],
['idn', conf.get('HAVE_NI_IDN') == 1, 'NI_IDN is not defined'],
['ima'],
['ipe'],
['initrd'],
@@ -1619,8 +1617,8 @@ foreach tuple : [
['mountfsd'],
['networkd'],
['nsresourced'],
['nss-myhostname', conf.get('HAVE_NSS_H') == 1, 'nss.h not found'],
['nss-systemd', conf.get('HAVE_NSS_H') == 1, 'nss.h not found'],
['nss-myhostname', get_option('libc') != 'musl', 'musl does not support it'],
['nss-systemd', get_option('libc') != 'musl', 'musl does not support it'],
['oomd'],
['portabled'],
['pstore'],
@@ -1635,7 +1633,7 @@ foreach tuple : [
['timesyncd'],
['tmpfiles'],
['tpm'],
['utmp', get_option('libc') != 'musl', 'musl does not support it'],
['utmp', get_option('libc') != 'musl', 'musl does not support it'],
['userdb'],
['vconsole'],
['xdg-autostart'],
@@ -1657,15 +1655,15 @@ foreach tuple : [['nss-mymachines', 'machined'],
['nss-resolve', 'resolve']]
want = get_option(tuple[0])
if want.enabled()
if conf.get('HAVE_NSS_H') != 1
error('@0@ is requested but nss.h not found'.format(tuple[0]))
if get_option('libc') == 'musl'
error('@0@ is requested but musl does not support it'.format(tuple[0]))
endif
if not get_option(tuple[1])
error('@0@ is requested but @1@ is disabled'.format(tuple[0], tuple[1]))
endif
have = true
elif want.allowed()
have = get_option(tuple[1]) and conf.get('HAVE_NSS_H') == 1
have = get_option(tuple[1]) and get_option('libc') != 'musl'
else
have = false
endif