From 61fb2262e71a044198b8b18872a802036c332d80 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Fri, 25 Apr 2025 01:25:40 -0400 Subject: [PATCH] meson: simplify and parameterize various standard function checks This is repetitive logic. We either want to use some -lc function, or if it is not available we define it as -DNO_XXX and usually (but not always) provide some custom compatibility impl instead. Checking the intent of each block when reading through the file is slow and not very DRY. Switch to taking an array of checkable functions instead. Not all functions are straightforward to move, since different macro prefixes are used. Signed-off-by: Eli Schwartz Signed-off-by: Junio C Hamano --- meson.build | 85 ++++++++++++++++++----------------------------------- 1 file changed, 29 insertions(+), 56 deletions(-) diff --git a/meson.build b/meson.build index c47cb79af0..ed0359b9c9 100644 --- a/meson.build +++ b/meson.build @@ -1133,11 +1133,6 @@ else build_options_config.set('NO_UNIX_SOCKETS', '1') endif -if not compiler.has_function('pread') - libgit_c_args += '-DNO_PREAD' - libgit_sources += 'compat/pread.c' -endif - if host_machine.system() == 'darwin' libgit_sources += 'compat/precompose_utf8.c' libgit_c_args += '-DPRECOMPOSE_UNICODE' @@ -1290,23 +1285,39 @@ if not compiler.has_member('struct passwd', 'pw_gecos', prefix: '#include