From: Daan De Meyer Date: Wed, 18 Feb 2026 11:45:10 +0000 (+0100) Subject: meson: Explicitly check for musl for gshadow and nss X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ab8bba2b0f9d3dbe188c27783a96f47f1c5d666;p=thirdparty%2Fsystemd.git 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 --- diff --git a/meson.build b/meson.build index 61a2c253ee7..b50466dcfd0 100644 --- a/meson.build +++ b/meson.build @@ -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