]> 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)
committerJordan Williams <jordan@jwillikers.com>
Mon, 1 Apr 2024 12:42:39 +0000 (07:42 -0500)
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>
meson.build

index 9600ce49f73d69045a9ddc304bb3570aec72a85e..1ec913d7b17a48b3e2d75fb16b9ea823f32f00e4 100644 (file)
@@ -569,7 +569,6 @@ funcs = '''
         llistxattr
         llseek
         newlocale
-        mempcpy
         mkostemp
         move_mount
         mount_setattr
@@ -634,6 +633,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