Using strchrnul eagerly results in a failure to compile when using the newest 
SDKs, with:

error: 'strchrnul' is only available on macOS 15.4 or newer 
[-Werror,-Wunguarded-availability-new]

Working around that by not using strchrnul when targeting macOS.

This didn't show up on the CI because it used the macOS 15.1 SDK instead of a 
macOS 15.4 SDK or later.

Signed-off-by: Mohamed Mediouni <[email protected]>
---
 meson.build | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 7b4e5bc72b..78bde0611b 100644
--- a/meson.build
+++ b/meson.build
@@ -2646,7 +2646,12 @@ config_host_data.set('HAVE_COPY_FILE_RANGE', 
cc.has_function('copy_file_range'))
 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_OPENPTY', cc.has_function('openpty', dependencies: 
util))
-config_host_data.set('HAVE_STRCHRNUL', cc.has_function('strchrnul', prefix: 
osdep_prefix))
+
+# strchrnul was introduced in macOS 15.4.
+# Keep this condition for compatibility of new macOS SDKs with older releases.
+if host_os != 'darwin'
+  config_host_data.set('HAVE_STRCHRNUL', cc.has_function('strchrnul', prefix: 
osdep_prefix))
+endif
 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.50.1 (Apple Git-155)


Reply via email to