]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
meson: Fix false positive detection of mempcpy on macOS
authorJordan Williams <jordan@jwillikers.com>
Fri, 29 Mar 2024 19:00:01 +0000 (14:00 -0500)
committerKarel Zak <kzak@redhat.com>
Tue, 2 Apr 2024 06:54:02 +0000 (08:54 +0200)
The has_function check incorrectly detects mempcpy on macOS.
This function is not available on macOS and should not be detected.
Likely, this has to do with Meson's detection of compiler built-ins.
Using a specific prefix and defining _GNU_SOURCE fixes the detection.

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
(cherry picked from commit 2c5a42b3cbf278461a12872ce7a944ad396d47b5)

meson.build

index f46356ac66531c08c9ff115c8353f051140e0e74..77f6dd845e9bcaa436c47e80b08f7563a6cf9c1a 100644 (file)
@@ -565,7 +565,6 @@ funcs = '''
         llistxattr
         llseek
         newlocale
-        mempcpy
         mkostemp
         move_mount
         mount_setattr
@@ -630,6 +629,9 @@ foreach func: funcs
   conf.set('HAVE_' + func.to_upper(), have ? 1 : false)
 endforeach
 
+have_mempcpy = cc.has_function('mempcpy', prefix: '#include <string.h>', args: '-D_GNU_SOURCE')
+conf.set('HAVE_MEMPCPY', have_mempcpy ? 1 : false)
+
 have = conf.get('HAVE_FUTIMENS') in [1] and conf.get('HAVE_INOTIFY_INIT1') in [1]
 conf.set('AGETTY_RELOAD', have ? 1 : false)
 if not have