Check to make sure that we have inotify in libc, before looking for it
in libinotify.

Cc: Paolo Bonzini <[email protected]>
Cc: Marc-André Lureau <[email protected]>
Cc: Daniel P. Berrange <[email protected]>
Cc: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Warner Losh <[email protected]>
---
FreeBSD 15 and newer now has a native inotify implementation. Check for
it before checking for the wrapper libinotify library which is needed in
FreeBSD 14 and earlier. Make the check dependent on symbols, not host
version.

Separate series because it's really independent of the two other
patch series I have submitted and it is more important.
---
 meson.build | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/meson.build b/meson.build
index 2d114e9018..537f50283f 100644
--- a/meson.build
+++ b/meson.build
@@ -2662,13 +2662,15 @@ have_inotify_init = 
cc.has_header_symbol('sys/inotify.h', 'inotify_init')
 have_inotify_init1 = cc.has_header_symbol('sys/inotify.h', 'inotify_init1')
 inotify = not_found
 if (have_inotify_init or have_inotify_init1) and host_os == 'freebsd'
-  # libinotify-kqueue
-  inotify = cc.find_library('inotify')
-  if have_inotify_init
-    have_inotify_init = inotify.found()
-  endif
-  if have_inotify_init1
-    have_inotify_init1 = inotify.found()
+  if not cc.has_function('inotify_init') and not 
cc.has_function('inotify_init1')
+    inotify = cc.find_library('inotify')
+    # libinotify-kqueue
+    if have_inotify_init
+      have_inotify_init = inotify.found()
+    endif
+    if have_inotify_init1
+      have_inotify_init1 = inotify.found()
+    endif
   endif
 endif
 config_host_data.set('CONFIG_INOTIFY', have_inotify_init)

---
base-commit: 0b91040d23dc8820724a60c811223b777f3bc6b7
change-id: 20260210-freebsd-inotify-8bd07b2c84d1

Best regards,
-- 
Warner Losh <[email protected]>


Reply via email to