1 |
AC_INIT(lib/fuse.c) |
2 |
AM_INIT_AUTOMAKE(fuse, 1.1) |
3 |
AM_CONFIG_HEADER(include/config.h) |
4 |
|
5 |
m4_ifdef([LT_INIT], |
6 |
[LT_INIT], |
7 |
[AC_PROG_LIBTOOL]) |
8 |
AC_PROG_CC |
9 |
|
10 |
if test -z "$LD"; then |
11 |
LD=ld |
12 |
fi |
13 |
AC_SUBST(LD) |
14 |
|
15 |
# compatibility for automake < 1.8 |
16 |
if test -z "$mkdir_p"; then |
17 |
mkdir_p="../mkinstalldirs" |
18 |
AC_SUBST(mkdir_p) |
19 |
fi |
20 |
|
21 |
CFLAGS="-Wall -W -g -O2" |
22 |
CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64" |
23 |
|
24 |
AC_ARG_ENABLE(kernel-module, |
25 |
[ --enable-kernel-module Compile kernel module, requires --with-kernel option ]) |
26 |
AC_ARG_ENABLE(lib, |
27 |
[ --enable-lib Compile with library ]) |
28 |
AC_ARG_ENABLE(util, |
29 |
[ --enable-util Compile with util ]) |
30 |
AC_ARG_ENABLE(example, |
31 |
[ --enable-example Compile with examples ]) |
32 |
AC_ARG_ENABLE(auto-modprobe, |
33 |
[ --enable-auto-modprobe Automatically insert kernel module]) |
34 |
|
35 |
subdirs="include patch" |
36 |
|
37 |
if test "$enable_kernel_module" != "no"; then |
38 |
AC_MSG_CHECKING([kernel source directory]) |
39 |
kernelsrc= |
40 |
AC_ARG_WITH(kernel, |
41 |
[ --with-kernel Specify location of kernel source ], |
42 |
[kernelsrc="$withval"]) |
43 |
|
44 |
if test -z "$kernelsrc"; then |
45 |
buildlink=/lib/modules/`uname -r`/build |
46 |
if test -e $buildlink; then |
47 |
kernelsrc=`(cd $buildlink; /bin/pwd)` |
48 |
else |
49 |
AC_MSG_RESULT([Not found]) |
50 |
AC_MSG_ERROR([ |
51 |
*** Please specify the location of the kernel source with |
52 |
*** the '--with-kernel=SRCDIR' option]) |
53 |
fi |
54 |
fi |
55 |
AC_MSG_RESULT([$kernelsrc]) |
56 |
|
57 |
AC_MSG_CHECKING([kernel source version]) |
58 |
if test -r $kernelsrc/include/linux/version.h; then |
59 |
kernsrcver=`(echo "#include <linux/version.h>"; echo "kernsrcver=UTS_RELEASE") | cpp -I $kernelsrc/include | grep "^kernsrcver=" | cut -d \" -f 2` |
60 |
fi |
61 |
if test -z "$kernsrcver"; then |
62 |
AC_MSG_RESULT([Not found]) |
63 |
AC_MSG_ERROR([ |
64 |
*** Cannot determine the version of the linux kernel source. Please |
65 |
*** configure the kernel before running this script]) |
66 |
fi |
67 |
AC_MSG_RESULT([$kernsrcver]) |
68 |
majver=`echo "$kernsrcver" | cut -f-2 -d.` |
69 |
kmoduledir=/lib/modules/$kernsrcver |
70 |
AC_SUBST(kernelsrc) |
71 |
AC_SUBST(majver) |
72 |
AC_SUBST(kmoduledir) |
73 |
subdirs="$subdirs kernel" |
74 |
|
75 |
if echo "$kernsrcver" | grep -q "^2.4"; then |
76 |
old_cflags="$CFLAGS" |
77 |
CFLAGS="-I${kernelsrc}/include -Wall -O2 -fno-strict-aliasing -D__KERNEL__" |
78 |
AC_CHECK_DECL(i_size_read, |
79 |
AC_DEFINE(HAVE_I_SIZE_FUNC, 1, |
80 |
[Kernel has i_size_read() and i_size_write() functions]),, |
81 |
[#include <linux/fs.h>]) |
82 |
CFLAGS="$old_cflags" |
83 |
fi |
84 |
AC_MSG_CHECKING([if kernel has extended attribute support]) |
85 |
if test -f $kernelsrc/include/linux/xattr.h; then |
86 |
AC_DEFINE(HAVE_KERNEL_XATTR, 1, [Kernel has xattr support],,) |
87 |
AC_MSG_RESULT([yes]) |
88 |
else |
89 |
AC_MSG_RESULT([no]) |
90 |
fi |
91 |
|
92 |
isuml=no |
93 |
KERNELMAKE_PARAMS= |
94 |
AC_MSG_CHECKING([if this is user mode linux]) |
95 |
if test -f $kernelsrc/include/linux/autoconf.h && grep -q "^#define CONFIG_USERMODE 1" $kernelsrc/include/linux/autoconf.h; then |
96 |
isuml=yes |
97 |
KERNELMAKE_PARAMS="ARCH=um" |
98 |
fi |
99 |
AC_MSG_RESULT([$isuml]) |
100 |
AC_SUBST(KERNELMAKE_PARAMS) |
101 |
fi |
102 |
|
103 |
if test "$enable_lib" != "no"; then |
104 |
subdirs="$subdirs lib"; |
105 |
fi |
106 |
if test "$enable_util" != "no"; then |
107 |
subdirs="$subdirs util"; |
108 |
fi |
109 |
if test "$enable_example" != "no"; then |
110 |
subdirs="$subdirs example"; |
111 |
fi |
112 |
if test "$enable_auto_modprobe" = "yes"; then |
113 |
AC_DEFINE(AUTO_MODPROBE, 1, [Automatically insert kernel module]) |
114 |
fi |
115 |
|
116 |
AC_CHECK_FUNCS([setxattr]) |
117 |
AC_CHECK_MEMBERS([struct stat.st_atim]) |
118 |
|
119 |
AC_SUBST(subdirs) |
120 |
|
121 |
AC_OUTPUT([Makefile kernel/Makefile lib/Makefile util/Makefile example/Makefile include/Makefile include/linux/Makefile patch/Makefile]) |
122 |
|