configure.ac
2.99 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
AC_PREREQ(2.68)
AC_INIT([checkout_files],
[0.0.1],
[georg@steffers.org])
LT_INIT
AM_INIT_AUTOMAKE
AM_SILENT_RULES([no])
AC_COPYRIGHT([Copyright © 2000 Georg Hopp])
AC_REVISION([0.0.1])
AC_CONFIG_SRCDIR([inotify1.c])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_HOST
use_inotify="yes"
# Checks for programs.
AC_PROG_CC
AC_PROG_MAKE_SET
# Checks for header files.
AC_HEADER_STDC
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
# Checks for library functions.
AC_CHECK_FUNCS([memset malloc free read ioctl syscall select perror printf])
dnl We need to check if the right inotify version is accessible
AC_MSG_CHECKING([whether inotify is to be used for filemonitoring])
AC_ARG_ENABLE(inotify,
[ --disable-inotify disable inotify in the ecore_file module],
[
if test "$enableval" == "yes"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no - but we need it])
use_inotify="no"
fi
], [
AC_MSG_RESULT([yes])
]
)
dnl It's hard to find a good test on how to check the correct
dnl inotify version. They changed the headers a lot.
dnl in kernel 2.6.13 __NR_inotify_init was added to the defined syscalls
dnl in asm/unistd.h and IN_MOVE_SELF was added to linux/inotify.h
dnl so with this check you need a very new kernel and kernel-headers!
dnl On my gentoo, /usr/include/asm and /usr/include/linux are no symlinks
dnl into the current kernel tree....so i also try to find the includes
dnl under /usr/src/linux or under /usr/include/linux-`uname -r`
linux_rev=`uname -r`
INOTIFY_INCLUDES=
if test "x$use_inotify" = "xyes"; then
AC_MSG_CHECKING([for sufficient inotify includes])
AC_TRY_COMPILE(
[
#include <asm/unistd.h>
#include <linux/inotify.h>
],
[ int a = __NR_inotify_init; int b = IN_MOVE_SELF; ],
[
AC_DEFINE(HAVE_INOTIFY, 1, [ File monitoring with Inotify ])
an_inc=/usr/include
],
[
AC_TRY_COMPILE(
[
#include "/usr/src/linux/include/asm/unistd.h"
#include "/usr/src/linux/include/linux/inotify.h"
],
[ int a = __NR_inotify_init; int b = IN_MOVE_SELF; ],
[
AC_DEFINE(HAVE_INOTIFY, 1, [ File monitoring with Inotify ])
AC_DEFINE(IN_KERNEL, 1, [ blablabla ])
INOTIFY_INCLUDES=-I/usr/src/linux/include
an_inc=/usr/src/linux/include
],
[
AC_TRY_COMPILE(
[
#include </usr/src/linux-$linux_rev/include/asm/unistd.h>
#include </usr/src/linux-$linux_rev/include/linux/inotify.h>
],
[ int a = __NR_inotify_init; int b = IN_MOVE_SELF; ],
[
AC_DEFINE(HAVE_INOTIFY, 1, [ File monitoring with Inotify ])
AC_DEFINE(IN_KERNEL_UNAME, 1, [ blablabla ])
INOTIFY_INCLUDES=-I/usr/src/linux-$linux_rev/include
an_inc=/usr/src/linux-$linux_rev/include
],
[
use_inotify="no"
an_inc="not found"
]
)
]
)
]
)
AC_MSG_RESULT([$an_inc])
test "x$an_inc" == "xnot found" && exit
else
exit
fi
AC_SUBST(INOTIFY_INCLUDES)
AC_CONFIG_FILES([Makefile])
AC_OUTPUT