Convert 'if' statements to AS_IF in kernel.m4
[zfs.git] / config / kernel-blk-rq-bytes.m4
1 dnl #
2 dnl # 2.6.29 API change
3 dnl # In the 2.6.29 kernel blk_rq_bytes() was available as a GPL-only symbol.
4 dnl # So we need to check the symbol license as well.  As of 2.6.31 the
5 dnl blk_rq_bytes() helper was changed to a static inline which we can use.
6 dnl #
7 AC_DEFUN([ZFS_AC_KERNEL_BLK_RQ_BYTES], [
8         AC_MSG_CHECKING([whether blk_rq_bytes() is available])
9         ZFS_LINUX_TRY_COMPILE([
10                 #include <linux/blkdev.h>
11         ],[
12                 struct request *req = NULL;
13                 (void) blk_rq_bytes(req);
14         ],[
15                 AC_MSG_RESULT(yes)
16                 AC_DEFINE(HAVE_BLK_RQ_BYTES, 1,
17                           [blk_rq_bytes() is available])
18         ],[
19                 AC_MSG_RESULT(no)
20         ])
21
22         AC_MSG_CHECKING([whether blk_rq_bytes() is GPL-only])
23         ZFS_LINUX_TRY_COMPILE([
24                 #include <linux/module.h>
25                 #include <linux/blkdev.h>
26
27                 MODULE_LICENSE("CDDL");
28         ],[
29                 struct request *req = NULL;
30                 (void) blk_rq_bytes(req);
31         ],[
32                 AC_MSG_RESULT(no)
33         ],[
34                 AC_MSG_RESULT(yes)
35                 AC_DEFINE(HAVE_BLK_RQ_BYTES_GPL_ONLY, 1,
36                           [blk_rq_bytes() is GPL-only])
37         ])
38 ])