Whamcloud - gitweb
LU-4748 test: get one single qos_threshold_rr number
[fs/lustre-release.git] / config / lustre-build-ldiskfs.m4
1 AC_DEFUN([LDISKFS_LINUX_SERIES],
2 [
3 LDISKFS_SERIES=
4 AC_MSG_CHECKING([which ldiskfs series to use])
5
6 SER=
7 AS_IF([test x$RHEL_KERNEL = xyes], [
8         AS_VERSION_COMPARE([$RHEL_KERNEL_VERSION],[2.6.32-431],[
9         AS_VERSION_COMPARE([$RHEL_KERNEL_VERSION],[2.6.32-343],[
10         AS_VERSION_COMPARE([$RHEL_KERNEL_VERSION],[2.6.32],[],
11         [SER="2.6-rhel6.series"],[SER="2.6-rhel6.series"])],
12         [SER="2.6-rhel6.4.series"],[SER="2.6-rhel6.4.series"])],
13         [SER="2.6-rhel6.5.series"],[SER="2.6-rhel6.5.series"])
14 ], [test x$SUSE_KERNEL = xyes], [
15         AS_VERSION_COMPARE([$LINUXRELEASE],[3.0.0],[
16         AS_VERSION_COMPARE([$LINUXRELEASE],[2.6.32],[],
17         [SER="2.6-sles11.series"],[SER="2.6-sles11.series"])],
18         [SER="3.0-sles11.series"],[
19                 PLEV=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
20                 case $PLEV in
21                 2) SER="3.0-sles11.series"
22                         ;;
23                 3) SER="3.0-sles11sp3.series"
24                         ;;
25                 esac
26         ])
27 ])
28 LDISKFS_SERIES=$SER
29
30 AS_IF([test -z "$LDISKFS_SERIES"],
31         [AC_MSG_WARN([Unknown kernel version $LDISKFS_VERSIONRELEASE])])
32 AC_MSG_RESULT([$LDISKFS_SERIES])
33
34 AC_SUBST(LDISKFS_SERIES)
35 ])
36
37 #
38 # 2.6.32-rc7 ext4_free_blocks requires struct buffer_head
39 #
40 AC_DEFUN([LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD],
41 [AC_MSG_CHECKING([if ext4_free_blocks needs struct buffer_head])
42  LB_LINUX_TRY_COMPILE([
43         #include <linux/fs.h>
44         #include "$EXT4_SRC_DIR/ext4.h"
45 ],[
46         ext4_free_blocks(NULL, NULL, NULL, 0, 0, 0);
47 ],[
48         AC_MSG_RESULT([yes])
49         AC_DEFINE(HAVE_EXT_FREE_BLOCK_WITH_BUFFER_HEAD, 1,
50                   [ext4_free_blocks do not require struct buffer_head])
51 ],[
52         AC_MSG_RESULT([no])
53 ])
54 ])
55
56 #
57 # 2.6.35 renamed ext_pblock to ext4_ext_pblock(ex)
58 #
59 AC_DEFUN([LB_EXT_PBLOCK],
60 [AC_MSG_CHECKING([if kernel has ext_pblocks])
61  LB_LINUX_TRY_COMPILE([
62         #include <linux/fs.h>
63         #include "$EXT4_SRC_DIR/ext4_extents.h"
64 ],[
65         ext_pblock(NULL);
66 ],[
67         AC_MSG_RESULT([yes])
68         AC_DEFINE(HAVE_EXT_PBLOCK, 1,
69                   [kernel has ext_pblocks])
70 ],[
71         AC_MSG_RESULT([no])
72 ])
73 ])
74
75 #
76 # LDISKFS_AC_PATCH_PROGRAM
77 #
78 # Determine which program should be used to apply the patches to
79 # the ext4 source code to produce the ldiskfs source code.
80 #
81 AC_DEFUN([LDISKFS_AC_PATCH_PROGRAM], [
82         AC_ARG_ENABLE([quilt],
83                 [AC_HELP_STRING([--disable-quilt],
84                         [disable use of quilt for ldiskfs])],
85                 [AS_IF([test "x$enableval" = xno],
86                         [use_quilt=no],
87                         [use_quilt=maybe])],
88                 [use_quilt=maybe]
89         )
90
91         AS_IF([test x$use_quilt = xmaybe], [
92                 AC_PATH_PROG([quilt_avail], [quilt], [no])
93                 AS_IF([test x$quilt_avail = xno], [
94                         use_quilt=no
95                 ], [
96                         use_quilt=yes
97                 ])
98         ])
99
100         AS_IF([test x$use_quilt = xno], [
101                 AC_PATH_PROG([patch_avail], [patch], [no])
102                 AS_IF([test x$patch_avail = xno], [
103                         AC_MSG_ERROR([*** Need "quilt" or "patch" command])
104                 ])
105         ])
106 ])
107
108 #
109 # LB_CONDITIONAL_LDISKFS
110 #
111 AC_DEFUN([LB_CONFIG_LDISKFS],
112 [
113 # --with-ldiskfs is deprecated now that ldiskfs is fully merged with lustre.
114 # However we continue to support this option through Lustre 2.5.
115 AC_ARG_WITH([ldiskfs],
116         [],
117         [AC_MSG_WARN([--with-ldiskfs is deprecated, please use --enable-ldiskfs])
118         AS_IF([test x$withval != xyes -a x$withval != xno],
119                 [AC_MSG_ERROR([
120
121 The ldiskfs option is deprecated,
122 and no longer supports paths to external ldiskfs source
123 ])])
124         ]
125 )
126
127 AC_ARG_ENABLE([ldiskfs],
128         [AS_HELP_STRING([--disable-ldiskfs],
129                 [disable ldiskfs osd (default is enable)])],
130         [AS_IF([test x$enable_ldiskfs != xyes -a x$enable_ldiskfs != xno],
131                 [AC_MSG_ERROR([ldiskfs valid options are "yes" or "no"])])],
132         [AS_IF([test "${with_ldiskfs+set}" = set],
133                 [enable_ldiskfs=$with_ldiskfs],
134                 [enable_ldiskfs=maybe])
135         ]
136 )
137
138 AS_IF([test x$enable_server = xno],
139         [AS_CASE([$enable_ldiskfs],
140                 [maybe], [enable_ldiskfs=no],
141                 [yes], [AC_MSG_ERROR([cannot build ldiskfs when servers are disabled])]
142         )]
143 )
144
145 AS_IF([test x$enable_ldiskfs != xno],[
146         # In the future, we chould change enable_ldiskfs from maybe to
147         # either yes or no based on additional tests, e.g.  whether a patch
148         # set is available for the detected kernel.  For now, we just always
149         # set it to "yes".
150         AS_IF([test x$enable_ldiskfs = xmaybe], [enable_ldiskfs=yes])
151
152         LDISKFS_LINUX_SERIES
153         LDISKFS_AC_PATCH_PROGRAM
154         LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
155         LB_EXT_PBLOCK
156         AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1, [posix acls for ldiskfs])
157         AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1, [fs security for ldiskfs])
158         AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1, [extened attributes for ldiskfs])
159         AC_DEFINE(CONFIG_LDISKFS_FS_RW, 1, [enable rw access for ldiskfs])
160         AC_SUBST(LDISKFS_SUBDIR, ldiskfs)
161         AC_DEFINE(HAVE_LDISKFS_OSD, 1, Enable ldiskfs osd)
162 ])
163
164 AC_MSG_CHECKING([whether to build ldiskfs])
165 AC_MSG_RESULT([$enable_ldiskfs])
166
167 AM_CONDITIONAL([LDISKFS_ENABLED], [test x$enable_ldiskfs = xyes])
168 ])
169
170 #
171 # LB_VALIDATE_EXT4_SRC_DIR
172 #
173 # Spot check the existance of several source files common to ext4.
174 # Detecting this at configure time allows us to avoid a potential build
175 # failure and provide a useful error message to explain what is wrong.
176 #
177 AC_DEFUN([LB_VALIDATE_EXT4_SRC_DIR],
178 [
179 if test x$EXT4_SRC_DIR = x; then
180         enable_ldiskfs_build='no'
181 else
182         LB_CHECK_FILE([$EXT4_SRC_DIR/dir.c], [], [
183                 enable_ldiskfs_build='no'
184                 AC_MSG_WARN([ext4 must exist for ldiskfs build])])
185         LB_CHECK_FILE([$EXT4_SRC_DIR/file.c], [], [
186                 enable_ldiskfs_build='no'
187                 AC_MSG_WARN([ext4 must exist for ldiskfs build])])
188         LB_CHECK_FILE([$EXT4_SRC_DIR/inode.c], [], [
189                 enable_ldiskfs_build='no'
190                 AC_MSG_WARN([ext4 must exist for ldiskfs build])])
191         LB_CHECK_FILE([$EXT4_SRC_DIR/super.c], [], [
192                 enable_ldiskfs_build='no'
193                 AC_MSG_WARN([ext4 must exist for ldiskfs build])])
194 fi
195
196 if test x$enable_ldiskfs_build = xno; then
197         enable_ldiskfs='no'
198
199         AC_MSG_WARN([
200
201 Disabling ldiskfs support because complete ext4 source does not exist.
202
203 If you are building using kernel-devel packages and require ldiskfs
204 server support then ensure that the matching kernel-debuginfo-common
205 and kernel-debuginfo-common-<arch> packages are installed.
206 ])
207
208 fi
209 ])
210
211 #
212 # LB_EXT4_SRC_DIR
213 #
214 # Determine the location of the ext4 source code.  It it required
215 # for several configure tests and to build ldiskfs.
216 #
217 AC_DEFUN([LB_EXT4_SRC_DIR],
218 [
219 # Kernel ext source located with devel headers
220 linux_src=$LINUX
221 if test -e "$linux_src/fs/ext4/super.c"; then
222         EXT4_SRC_DIR=$linux_src/fs/ext4
223 else
224         # Kernel ext source provided by kernel-debuginfo-common package
225         linux_src=$(ls -1d /usr/src/debug/*/linux-$LINUXRELEASE \
226                 2>/dev/null | tail -1)
227         if test -e "$linux_src/fs/ext4/super.c"; then
228                 EXT4_SRC_DIR=$linux_src/fs/ext4
229         else
230                 EXT4_SRC_DIR=
231         fi
232 fi
233
234 AC_MSG_CHECKING([ext4 source directory])
235 AC_MSG_RESULT([$EXT4_SRC_DIR])
236 AC_SUBST(EXT4_SRC_DIR)
237
238 LB_VALIDATE_EXT4_SRC_DIR
239 ])
240
241 #
242 # LB_DEFINE_E2FSPROGS_NAMES
243 #
244 # Enable the use of alternate naming of ldiskfs-enabled e2fsprogs package.
245 #
246 AC_DEFUN([LB_DEFINE_E2FSPROGS_NAMES],
247 [
248 AC_ARG_WITH([ldiskfsprogs],
249         AC_HELP_STRING([--with-ldiskfsprogs],
250                        [use alternate names for ldiskfs-enabled e2fsprogs]),
251         [],[withval='no'])
252
253 AC_MSG_CHECKING([whether to use alternate names for e2fsprogs])
254 if test x$withval = xyes ; then
255         AC_DEFINE(HAVE_LDISKFSPROGS, 1, [enable use of ldiskfsprogs package])
256         E2FSPROGS="ldiskfsprogs"
257         MKE2FS="mkfs.ldiskfs"
258         DEBUGFS="debugfs.ldiskfs"
259         TUNE2FS="tunefs.ldiskfs"
260         E2LABEL="label.ldiskfs"
261         DUMPE2FS="dumpfs.ldiskfs"
262         E2FSCK="fsck.ldiskfs"
263         PFSCK="pfsck.ldiskfs"
264         AC_MSG_RESULT([enabled])
265 else
266         E2FSPROGS="e2fsprogs"
267         MKE2FS="mke2fs"
268         DEBUGFS="debugfs"
269         TUNE2FS="tune2fs"
270         E2LABEL="e2label"
271         DUMPE2FS="dumpe2fs"
272         E2FSCK="e2fsck"
273         PFSCK="fsck"
274         AC_MSG_RESULT([disabled])
275 fi
276
277 AC_DEFINE_UNQUOTED(E2FSPROGS, "$E2FSPROGS", [name of ldiskfs e2fsprogs package])
278 AC_DEFINE_UNQUOTED(MKE2FS, "$MKE2FS", [name of ldiskfs mkfs program])
279 AC_DEFINE_UNQUOTED(DEBUGFS, "$DEBUGFS", [name of ldiskfs debug program])
280 AC_DEFINE_UNQUOTED(TUNE2FS, "$TUNE2FS", [name of ldiskfs tune program])
281 AC_DEFINE_UNQUOTED(E2LABEL, "$E2LABEL", [name of ldiskfs label program])
282 AC_DEFINE_UNQUOTED(DUMPE2FS,"$DUMPE2FS", [name of ldiskfs dump program])
283 AC_DEFINE_UNQUOTED(E2FSCK, "$E2FSCK", [name of ldiskfs fsck program])
284 AC_DEFINE_UNQUOTED(PFSCK, "$PFSCK", [name of parallel fsck program])
285
286 AC_SUBST([E2FSPROGS], [$E2FSPROGS])
287 AC_SUBST([MKE2FS], [$MKE2FS])
288 AC_SUBST([DEBUGFS], [$DEBUGFS])
289 AC_SUBST([TUNE2FS], [$TUNE2FS])
290 AC_SUBST([E2LABEL], [$E2LABEL])
291 AC_SUBST([DUMPE2FS], [$DUMPE2FS])
292 AC_SUBST([E2FSCK], [$E2FSCK])
293 AC_SUBST([PFSCK], [$PFSCK])
294 ])