[PATCH 4/4] meson: Use osdep_prefix for strchrnul()

Akihiko Odaki posted 4 patches 6 months, 3 weeks ago
[PATCH 4/4] meson: Use osdep_prefix for strchrnul()
Posted by Akihiko Odaki 6 months, 3 weeks ago
macOS SDK may have the symbol of strchrnul(), but it is actually
available only on macOS 15.4 or later and that fact is codified in
string.h. Include the header file using osdep_prefix to check if the
function is available on the deployment target.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
 meson.build | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 0a35fc3fa9fe..8ec796d835df 100644
--- a/meson.build
+++ b/meson.build
@@ -2193,6 +2193,7 @@ osdep_prefix = '''
   #include <stddef.h>
   #include <sys/types.h>
 
+  #include <string.h>
   #include <limits.h>
   /* Put unistd.h before time.h as that triggers localtime_r/gmtime_r
    * function availability on recentish Mingw-w64 platforms. */
@@ -2657,7 +2658,7 @@ config_host_data.set('HAVE_GETIFADDRS', cc.has_function('getifaddrs'))
 config_host_data.set('HAVE_GLIB_WITH_SLICE_ALLOCATOR', glib_has_gslice)
 config_host_data.set('HAVE_GLIB_WITH_ALIGNED_ALLOC', glib_has_aligned_alloc)
 config_host_data.set('HAVE_OPENPTY', cc.has_function('openpty', dependencies: util))
-config_host_data.set('HAVE_STRCHRNUL', cc.has_function('strchrnul'))
+config_host_data.set('HAVE_STRCHRNUL', cc.has_function('strchrnul', prefix: osdep_prefix))
 config_host_data.set('HAVE_SYSTEM_FUNCTION', cc.has_function('system', prefix: '#include <stdlib.h>'))
 if rbd.found()
   config_host_data.set('HAVE_RBD_NAMESPACE_EXISTS',

-- 
2.49.0
Re: [PATCH 4/4] meson: Use osdep_prefix for strchrnul()
Posted by Philippe Mathieu-Daudé 6 months, 3 weeks ago
On 24/4/25 06:50, Akihiko Odaki wrote:
> macOS SDK may have the symbol of strchrnul(), but it is actually
> available only on macOS 15.4 or later and that fact is codified in
> string.h. Include the header file using osdep_prefix to check if the
> function is available on the deployment target.
> 
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
>   meson.build | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>