5 # Determine the location of the ext4 source code. It is required
6 # for several configure tests and to build ldiskfs.
8 AC_DEFUN([LB_LDISKFS_EXT_DIR],
10 # Kernel ext source located with devel headers
12 if test -e "$linux_src/fs/ext4/super.c"; then
13 EXT_DIR=$linux_src/fs/ext4
15 # Kernel ext source provided by kernel-debuginfo-common package
16 linux_src=$(ls -1d /usr/src/debug/*/linux-$LINUXRELEASE \
17 2>/dev/null | tail -1)
18 if test -e "$linux_src/fs/ext4/super.c"; then
19 EXT_DIR=$linux_src/fs/ext4
25 AC_MSG_CHECKING([ext4 source directory])
26 AC_MSG_RESULT([$EXT_DIR])
31 # LB_LDISKFS_EXT_SOURCE
33 # Spot check the existance of several source files common to ext4.
34 # Detecting this at configure time allows us to avoid a potential build
35 # failure and provide a useful error message to explain what is wrong.
37 AC_DEFUN([LB_LDISKFS_EXT_SOURCE],
39 if test x$EXT_DIR = x; then
40 enable_ldiskfs_build='no'
42 LB_CHECK_FILE([$EXT_DIR/dir.c], [], [
43 enable_ldiskfs_build='no'
44 AC_MSG_WARN([ext4 must exist for ldiskfs build])])
45 LB_CHECK_FILE([$EXT_DIR/file.c], [], [
46 enable_ldiskfs_build='no'
47 AC_MSG_WARN([ext4 must exist for ldiskfs build])])
48 LB_CHECK_FILE([$EXT_DIR/inode.c], [], [
49 enable_ldiskfs_build='no'
50 AC_MSG_WARN([ext4 must exist for ldiskfs build])])
51 LB_CHECK_FILE([$EXT_DIR/super.c], [], [
52 enable_ldiskfs_build='no'
53 AC_MSG_WARN([ext4 must exist for ldiskfs build])])
56 if test x$enable_ldiskfs_build = xno; then
58 enable_ldiskfs_build='no'
64 Disabling server because complete ext4 source does not exist.
66 If you are building using kernel-devel packages and require ldiskfs
67 server support then ensure that the matching kernel-debuginfo-common
68 and kernel-debuginfo-common-<arch> packages are installed.
76 # LB_LDISKFS_DEFINE_OPTIONS
78 # Enable config options related to ldiskfs. These are used by ldiskfs,
79 # lvfs, and the osd-ldiskfs code (which includes ldiskfs headers.)
81 AC_DEFUN([LB_LDISKFS_DEFINE_OPTIONS],
83 AC_DEFINE(HAVE_LDISKFS_OSD, 1, Enable ldiskfs osd)
88 if test x$RHEL_KERNEL = xyes; then
90 AC_DEFINE(HAVE_LDISKFS_PDO, 1, [have ldiskfs PDO patch])
92 if test x$SUSE_KERNEL = xyes; then
94 AC_DEFINE(HAVE_LDISKFS_PDO, 1, [have ldiskfs PDO patch])
98 LB_LDISKFS_JBD2_JOURNAL_CALLBACK_SET
100 AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1,
101 [enable extended attributes for ldiskfs])
102 AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1,
103 [enable posix acls for ldiskfs])
104 AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1,
105 [enable fs security for ldiskfs])
106 AC_DEFINE(CONFIG_LDISKFSDEV_FS_POSIX_ACL, 1,
107 [enable posix acls for ldiskfs])
108 AC_DEFINE(CONFIG_LDISKFSDEV_FS_XATTR, 1,
109 [enable extented attributes for ldiskfs])
110 AC_DEFINE(CONFIG_LDISKFSDEV_FS_SECURITY, 1,
111 [enable fs security for ldiskfs])
115 # Check for jbd2_journal_callback_set(), which is needed for commit
116 # callbacks. When LU-433 lands jbd2_journal_callback_set() will only
117 # remain for legacy reasons and AC_MSG_ERROR can be removed.
119 AC_DEFUN([LB_LDISKFS_JBD2_JOURNAL_CALLBACK_SET],
121 LB_CHECK_SYMBOL_EXPORT([jbd2_journal_callback_set],
123 [AC_DEFINE(HAVE_JBD2_JOURNAL_CALLBACK_SET, 1,
124 [kernel exports jbd2_journal_callback_set])])
128 AC_DEFUN([LB_LDISKFS_SYMVERS],
130 AC_MSG_CHECKING([ldiskfs module symbols])
131 if test -r $LDISKFS_OBJ/Module.symvers; then
132 LDISKFS_SYMBOLS=Module.symvers
133 elif test -r $LDISKFS_OBJ/Modules.symvers; then
134 LDISKFS_SYMBOLS=Modules.symvers
135 elif test -r $LDISKFS_OBJ/ldiskfs/Module.symvers; then
136 LDISKFS_SYMBOLS=Module.symvers
137 elif test -r $LDISKFS_OBJ/ldiskfs/Modules.symvers; then
138 LDISKFS_SYMBOLS=Modules.symvers
140 LDISKFS_SYMBOLS=$SYMVERFILE
143 AC_MSG_RESULT([$LDISKFS_SYMBOLS])
144 AC_SUBST(LDISKFS_SYMBOLS)
147 AC_DEFUN([LB_LDISKFS_RELEASE],
149 AC_MSG_CHECKING([ldiskfs source release])
150 if test -r $LDISKFS_OBJ/config.h; then
151 tmp_flags="$EXTRA_KCFLAGS"
152 EXTRA_KCFLAGS="-I$LDISKFS_DIR $EXTRA_KCFLAGS"
155 #undef PACKAGE_TARNAME
156 #undef PACKAGE_VERSION
157 #undef PACKAGE_STRING
158 #undef PACKAGE_BUGREPORT
163 #include <$LDISKFS_OBJ/config.h>
165 char *LDISKFS_RELEASE;
166 LDISKFS_RELEASE=VERSION;
168 $makerule LUSTRE_KERNEL_TEST=conftest.i
170 test -s build/conftest.i
172 eval $(grep "LDISKFS_RELEASE=" build/conftest.i)
174 AC_MSG_RESULT([unknown])
175 AC_MSG_ERROR([Could not preprocess test program.])
177 EXTRA_KCFLAGS="$tmp_flags"
179 elif test -r $LDISKFS_DIR/configure.ac; then
180 LDISKFS_RELEASE=$(awk '/AC\_INIT/ { print [$]3 }' \
181 $LDISKFS_DIR/configure.ac | tr ',' '\n')
183 AC_MSG_RESULT([unknown])
184 AC_MSG_ERROR([Could not locate config.h, META, or configure.ac to check release.])
187 if test x$LDISKFS_RELEASE = x; then
188 AC_MSG_RESULT([unknown])
189 AC_MSG_ERROR([Could not determine ldiskfs release.])
192 AC_MSG_RESULT([$LDISKFS_RELEASE])
193 AC_SUBST(LDISKFS_RELEASE)
196 AC_DEFUN([LB_LDISKFS_SERIES],
199 AC_MSG_CHECKING([which ldiskfs series to use])
200 case $LINUXRELEASE in
202 if test x$RHEL_KERNEL = xyes; then
203 LDISKFS_SERIES="2.6-rhel5-ext4.series"
207 if test x$RHEL_KERNEL = xyes; then
208 LDISKFS_SERIES="2.6-rhel6.series"
210 if test x$SUSE_KERNEL = xyes; then
211 LDISKFS_SERIES="2.6-sles11.series"
215 AC_MSG_WARN([Unknown kernel version $LINUXRELEASE])
219 AC_MSG_RESULT([$LDISKFS_SERIES])
223 AC_SUBST(LDISKFS_SERIES)