summaryrefslogtreecommitdiff
path: root/src/external/inotify.m4
blob: 9572f6d2fefedf8a1d6a2468c712a83e7db2969f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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 <sys/inotify.h>,
#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)
])