From 9917c138d9a270deb5820915384fbde751190c2a Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Fri, 30 Aug 2013 23:13:26 +0200 Subject: AUTOTOOLS: More robust detection of inotify. We checked only header file "sys/inotify" for detection whether inotify works. Some platforms do not have built in inotify, but contain library, which provides inotify-compatible interface. This patch adds more robust detection of inotify in configuration time and appends linker flags to Makefile if inotify is provided by library. --- src/external/inotify.m4 | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/external/inotify.m4 (limited to 'src/external') diff --git a/src/external/inotify.m4 b/src/external/inotify.m4 new file mode 100644 index 000000000..9572f6d2f --- /dev/null +++ b/src/external/inotify.m4 @@ -0,0 +1,32 @@ +dnl A macro to check if inotify works +AC_DEFUN([AM_CHECK_INOTIFY], +[ + AC_CHECK_HEADERS([sys/inotify.h]) + + AC_MSG_CHECKING([whether sys/inotify.h actually works]) + AC_LINK_IFELSE( + [AC_LANG_SOURCE([ +#ifdef HAVE_SYS_INOTITY_H +#include , +#endif +int main () { + return (-1 == inotify_init()); +}])], + [AC_MSG_RESULT([yes]); inotify_works=yes], + [AC_MSG_RESULT([no])] + ) + + SSS_AC_EXPAND_LIB_DIR() + AS_IF([test x"$inotify_works" != xyes], + [AC_CHECK_LIB([inotify], + [inotify_init], + [INOTIFY_LIBS="$sss_extra_libdir -linotify" + inotify_works=yes], + [inotify_works=no], + [$sss_extra_libdir])] + ) + + AS_IF([test x"$inotify_works" = xyes], + [AC_DEFINE_UNQUOTED([HAVE_INOTIFY], [1], [Inotify works])]) + AC_SUBST(INOTIFY_LIBS) +]) -- cgit