configure.ac: tweak inotify check
authorRyan Lortie <desrt@desrt.ca>
Thu, 13 Feb 2014 23:26:07 +0000 (18:26 -0500)
committerRyan Lortie <desrt@desrt.ca>
Fri, 14 Feb 2014 15:42:40 +0000 (10:42 -0500)
Our check for inotify_init1() being defined is broken.  We happily
declare that inotify is supported, even if the check fails.

This was originally intended to check for inotify_init1 in the libc so
that we could fall back to inotify_init if it was not yet defined.

FreeBSD has a libinotify that emulates the inotify API via kqueue.  It
installs a <sys/inotify.h> header and requires linking to -linotify.  We
don't want to falsely detect working inotify in this case.

Treat the lack of inotify_init1() in the libc as a lack of inotify
support.  This requires only a new libc -- we still support old kernels:
in the case that inotify1_init() fails, we fall back to inotify_init().

https://bugzilla.gnome.org/show_bug.cgi?id=724330

configure.ac
gio/giomodule.c
gio/inotify/inotify-kernel.c

index 1c400ad..c38cd35 100644 (file)
@@ -1665,8 +1665,7 @@ dnl *****************************
 inotify_support=no
 AC_CHECK_HEADERS([sys/inotify.h],
 [
-       inotify_support=yes
-       AC_CHECK_FUNCS(inotify_init1)
+  AC_CHECK_FUNCS(inotify_init1, [inotify_support=yes], [inotify_support=no])
 ])
 
 AM_CONDITIONAL(HAVE_INOTIFY, [test "$inotify_support" = "yes"])
index 5876fc5..219a739 100644 (file)
@@ -1055,7 +1055,7 @@ _g_io_modules_ensure_loaded (void)
       /* Initialize types from built-in "modules" */
       g_type_ensure (g_null_settings_backend_get_type ());
       g_type_ensure (g_memory_settings_backend_get_type ());
-#if defined(HAVE_SYS_INOTIFY_H) || defined(HAVE_LINUX_INOTIFY_H)
+#if defined(HAVE_INOTIFY_INIT1)
       g_type_ensure (_g_inotify_directory_monitor_get_type ());
       g_type_ensure (_g_inotify_file_monitor_get_type ());
 #endif
index 81294fa..b672cb1 100644 (file)
@@ -196,11 +196,8 @@ gboolean _ik_startup (void (*cb)(ik_event_t *event))
 
   initialized = TRUE;
 
-#ifdef HAVE_INOTIFY_INIT1
   inotify_instance_fd = inotify_init1 (IN_CLOEXEC);
-#else
-  inotify_instance_fd = -1;
-#endif
+
   if (inotify_instance_fd < 0)
     inotify_instance_fd = inotify_init ();