meson: crypt.h must always exist

We require at least crypt_r() exists, and it is provided since glibc-2.0
(and dropped in glibc-2.39) or by libxcrypt, and the function is
provided in crypt.h regardless it is provided by glibc or libxcrypt.
Hence, we cannot fallback to unistd.h.

This makes the condition about crypt.h more strict, and stop compilation
earlier when crypt.h does not exist.
This commit is contained in:
Yu Watanabe
2025-07-23 22:13:20 +09:00
parent a6da6c9050
commit fa32f4cd75
4 changed files with 32 additions and 41 deletions
+1 -15
View File
@@ -1,20 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#if HAVE_CRYPT_H
/* libxcrypt is a replacement for glibc's libcrypt, and libcrypt might be
* removed from glibc at some point. As part of the removal, defines for
* crypt(3) are dropped from unistd.h, and we must include crypt.h instead.
*
* Newer versions of glibc (v2.0+) already ship crypt.h with a definition
* of crypt(3) as well, so we simply include it if it is present. MariaDB,
* MySQL, PostgreSQL, Perl and some other wide-spread packages do it the
* same way since ages without any problems.
*/
# include <crypt.h>
#else
# include <unistd.h>
#endif
#include <crypt.h>
#include <stdlib.h>
#include "alloc-util.h"
+1 -5
View File
@@ -1,10 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#if HAVE_CRYPT_H
# include <crypt.h>
#else
# include <unistd.h>
#endif
#include <crypt.h>
#include "libcrypt-util.h"
#include "strv.h"