summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorEtienne Dechamps <[email protected]>2012-07-25 14:38:58 -0700
committerBrian Behlendorf <[email protected]>2012-07-26 13:42:57 -0700
commit705741827ab55e7d92c3eb74f332a5ddd24971b5 (patch)
tree1b8ca75c3355fb84cba4fddd0c7b4852be95d763 /config
parentfc88a6dda92a4fc00491a8afa24d144cc94063e4 (diff)
When checking for symbol exports, try compiling.
This patch adds a new autoconf function: ZFS_LINUX_TRY_COMPILE_SYMBOL. This new function does the following: - Call LINUX_TRY_COMPILE with the specified parameters. - If unsuccessful, return false. - If successful and we're configuring with --enable-linux-builtin, return true. - Else, call CHECK_SYMBOL_EXPORT with the specified parameters and return the result. All calls to CHECK_SYMBOL_EXPORT are converted to LINUX_TRY_COMPILE_SYMBOL so that the tests work even when configuring for builtin on a kernel which doesn't have loadable module support, or hasn't been built yet. Signed-off-by: Brian Behlendorf <[email protected]> Issue #851
Diffstat (limited to 'config')
-rw-r--r--config/kernel-bdi-setup-and-register.m420
-rw-r--r--config/kernel-blkdev-get-by-path.m420
-rw-r--r--config/kernel-check-disk-size-change.m420
-rw-r--r--config/kernel-clear-inode.m419
-rw-r--r--config/kernel-d-make-root.m419
-rw-r--r--config/kernel-d-obtain-alias.m420
-rw-r--r--config/kernel-get-gendisk.m420
-rw-r--r--config/kernel-insert-inode-locked.m420
-rw-r--r--config/kernel-mount-nodev.m419
-rw-r--r--config/kernel-open-bdev-exclusive.m420
-rw-r--r--config/kernel-truncate-setsize.m420
-rw-r--r--config/kernel.m448
12 files changed, 173 insertions, 92 deletions
diff --git a/config/kernel-bdi-setup-and-register.m4 b/config/kernel-bdi-setup-and-register.m4
index 56fab8757..4196091e9 100644
--- a/config/kernel-bdi-setup-and-register.m4
+++ b/config/kernel-bdi-setup-and-register.m4
@@ -5,11 +5,17 @@ dnl # exported by the kernel. This is a trivial helper function but
dnl # using it significantly simplifies the code surrounding setting
dnl # up and tearing down the bdi structure.
dnl #
-AC_DEFUN([ZFS_AC_KERNEL_BDI_SETUP_AND_REGISTER], [
- ZFS_CHECK_SYMBOL_EXPORT(
- [bdi_setup_and_register],
- [mm/backing-dev.c],
- [AC_DEFINE(HAVE_BDI_SETUP_AND_REGISTER, 1,
- [bdi_setup_and_register() is available])],
- [])
+AC_DEFUN([ZFS_AC_KERNEL_BDI_SETUP_AND_REGISTER],
+ [AC_MSG_CHECKING([whether bdi_setup_and_register() is available])
+ ZFS_LINUX_TRY_COMPILE_SYMBOL([
+ #include <linux/backing-dev.h>
+ ], [
+ bdi_setup_and_register(NULL, NULL, 0);
+ ], [bdi_setup_and_register], [mm/backing-dev.c], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_BDI_SETUP_AND_REGISTER, 1,
+ [bdi_setup_and_register() is available])
+ ], [
+ AC_MSG_RESULT(no)
+ ])
])
diff --git a/config/kernel-blkdev-get-by-path.m4 b/config/kernel-blkdev-get-by-path.m4
index 0d5d2b120..40ecc06b6 100644
--- a/config/kernel-blkdev-get-by-path.m4
+++ b/config/kernel-blkdev-get-by-path.m4
@@ -3,11 +3,17 @@ dnl # 2.6.38 API change
dnl # open_bdev_exclusive() changed to blkdev_get_by_path()
dnl # close_bdev_exclusive() changed to blkdev_put()
dnl #
-AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH], [
- ZFS_CHECK_SYMBOL_EXPORT(
- [blkdev_get_by_path],
- [fs/block_dev.c],
- [AC_DEFINE(HAVE_BLKDEV_GET_BY_PATH, 1,
- [blkdev_get_by_path() is available])],
- [])
+AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH],
+ [AC_MSG_CHECKING([whether blkdev_get_by_path() is available])
+ ZFS_LINUX_TRY_COMPILE_SYMBOL([
+ #include <linux/fs.h>
+ ], [
+ blkdev_get_by_path(NULL, 0, NULL);
+ ], [blkdev_get_by_path], [fs/block_dev.c], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_BLKDEV_GET_BY_PATH, 1,
+ [blkdev_get_by_path() is available])
+ ], [
+ AC_MSG_RESULT(no)
+ ])
])
diff --git a/config/kernel-check-disk-size-change.m4 b/config/kernel-check-disk-size-change.m4
index 1a730c0c5..ea5c75f39 100644
--- a/config/kernel-check-disk-size-change.m4
+++ b/config/kernel-check-disk-size-change.m4
@@ -2,11 +2,17 @@ dnl #
dnl # 2.6.28 API change
dnl # Added check_disk_size_change() helper function.
dnl #
-AC_DEFUN([ZFS_AC_KERNEL_CHECK_DISK_SIZE_CHANGE], [
- ZFS_CHECK_SYMBOL_EXPORT(
- [check_disk_size_change],
- [fs/block_dev.c],
- [AC_DEFINE(HAVE_CHECK_DISK_SIZE_CHANGE, 1,
- [check_disk_size_change() is available])],
- [])
+AC_DEFUN([ZFS_AC_KERNEL_CHECK_DISK_SIZE_CHANGE],
+ [AC_MSG_CHECKING([whether check_disk_size_change() is available])
+ ZFS_LINUX_TRY_COMPILE_SYMBOL([
+ #include <linux/fs.h>
+ ], [
+ check_disk_size_change(NULL, NULL);
+ ], [check_disk_size_change], [fs/block_dev.c], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_CHECK_DISK_SIZE_CHANGE, 1,
+ [check_disk_size_change() is available])
+ ], [
+ AC_MSG_RESULT(no)
+ ])
])
diff --git a/config/kernel-clear-inode.m4 b/config/kernel-clear-inode.m4
index e3eace2b2..8d880fcd8 100644
--- a/config/kernel-clear-inode.m4
+++ b/config/kernel-clear-inode.m4
@@ -19,11 +19,16 @@ dnl # Therefore, to ensure we have the correct API we only allow the
dnl # clear_inode() compatibility code to be defined iff the evict_inode()
dnl # functionality is also detected.
dnl #
-AC_DEFUN([ZFS_AC_KERNEL_CLEAR_INODE], [
- ZFS_CHECK_SYMBOL_EXPORT(
- [clear_inode],
- [fs/inode.c],
- [AC_DEFINE(HAVE_CLEAR_INODE, 1,
- [clear_inode() is available])],
- [])
+AC_DEFUN([ZFS_AC_KERNEL_CLEAR_INODE],
+ [AC_MSG_CHECKING([whether clear_inode() is available])
+ ZFS_LINUX_TRY_COMPILE_SYMBOL([
+ #include <linux/fs.h>
+ ], [
+ clear_inode(NULL);
+ ], [clear_inode], [fs/inode.c], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_CLEAR_INODE, 1, [clear_inode() is available])
+ ], [
+ AC_MSG_RESULT(no)
+ ])
])
diff --git a/config/kernel-d-make-root.m4 b/config/kernel-d-make-root.m4
index fd2c52d74..9c2b73dcb 100644
--- a/config/kernel-d-make-root.m4
+++ b/config/kernel-d-make-root.m4
@@ -2,11 +2,16 @@ dnl #
dnl # 3.4.0 API change
dnl # Added d_make_root() to replace previous d_alloc_root() function.
dnl #
-AC_DEFUN([ZFS_AC_KERNEL_D_MAKE_ROOT], [
- ZFS_CHECK_SYMBOL_EXPORT(
- [d_make_root],
- [fs/dcache.c],
- [AC_DEFINE(HAVE_D_MAKE_ROOT, 1,
- [d_make_root() is available])],
- [])
+AC_DEFUN([ZFS_AC_KERNEL_D_MAKE_ROOT],
+ [AC_MSG_CHECKING([whether d_make_root() is available])
+ ZFS_LINUX_TRY_COMPILE_SYMBOL([
+ #include <linux/dcache.h>
+ ], [
+ d_make_root(NULL);
+ ], [d_make_root], [fs/dcache.c], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_D_MAKE_ROOT, 1, [d_make_root() is available])
+ ], [
+ AC_MSG_RESULT(no)
+ ])
])
diff --git a/config/kernel-d-obtain-alias.m4 b/config/kernel-d-obtain-alias.m4
index d80a1c89c..2b4b11ecc 100644
--- a/config/kernel-d-obtain-alias.m4
+++ b/config/kernel-d-obtain-alias.m4
@@ -2,11 +2,17 @@ dnl #
dnl # 2.6.28 API change
dnl # Added d_obtain_alias() helper function.
dnl #
-AC_DEFUN([ZFS_AC_KERNEL_D_OBTAIN_ALIAS], [
- ZFS_CHECK_SYMBOL_EXPORT(
- [d_obtain_alias],
- [fs/dcache.c],
- [AC_DEFINE(HAVE_D_OBTAIN_ALIAS, 1,
- [d_obtain_alias() is available])],
- [])
+AC_DEFUN([ZFS_AC_KERNEL_D_OBTAIN_ALIAS],
+ [AC_MSG_CHECKING([whether d_obtain_alias() is available])
+ ZFS_LINUX_TRY_COMPILE_SYMBOL([
+ #include <linux/dcache.h>
+ ], [
+ d_obtain_alias(NULL);
+ ], [d_obtain_alias], [fs/dcache.c], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_D_OBTAIN_ALIAS, 1,
+ [d_obtain_alias() is available])
+ ], [
+ AC_MSG_RESULT(no)
+ ])
])
diff --git a/config/kernel-get-gendisk.m4 b/config/kernel-get-gendisk.m4
index 8cd725f0e..b0913770e 100644
--- a/config/kernel-get-gendisk.m4
+++ b/config/kernel-get-gendisk.m4
@@ -1,11 +1,17 @@
dnl #
dnl # 2.6.34 API change
-dnl # Verify the get_gendisk() symbol is exported.
+dnl # Verify the get_gendisk() symbol is available.
dnl #
-AC_DEFUN([ZFS_AC_KERNEL_GET_GENDISK], [
- ZFS_CHECK_SYMBOL_EXPORT(
- [get_gendisk],
- [block/genhd.c],
- [AC_DEFINE(HAVE_GET_GENDISK, 1, [get_gendisk() is available])],
- [])
+AC_DEFUN([ZFS_AC_KERNEL_GET_GENDISK],
+ [AC_MSG_CHECKING([whether get_gendisk() is available])
+ ZFS_LINUX_TRY_COMPILE_SYMBOL([
+ #include <linux/genhd.h>
+ ], [
+ get_gendisk(0, NULL);
+ ], [get_gendisk], [block/genhd.c], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_GET_GENDISK, 1, [get_gendisk() is available])
+ ], [
+ AC_MSG_RESULT(no)
+ ])
])
diff --git a/config/kernel-insert-inode-locked.m4 b/config/kernel-insert-inode-locked.m4
index 1faff7e64..da141d180 100644
--- a/config/kernel-insert-inode-locked.m4
+++ b/config/kernel-insert-inode-locked.m4
@@ -2,11 +2,17 @@ dnl #
dnl # 2.6.28 API change
dnl # Added insert_inode_locked() helper function.
dnl #
-AC_DEFUN([ZFS_AC_KERNEL_INSERT_INODE_LOCKED], [
- ZFS_CHECK_SYMBOL_EXPORT(
- [insert_inode_locked],
- [fs/inode.c],
- [AC_DEFINE(HAVE_INSERT_INODE_LOCKED, 1,
- [insert_inode_locked() is available])],
- [])
+AC_DEFUN([ZFS_AC_KERNEL_INSERT_INODE_LOCKED],
+ [AC_MSG_CHECKING([whether insert_inode_locked() is available])
+ ZFS_LINUX_TRY_COMPILE_SYMBOL([
+ #include <linux/fs.h>
+ ], [
+ insert_inode_locked(NULL);
+ ], [insert_inode_locked], [fs/inode.c], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_INSERT_INODE_LOCKED, 1,
+ [insert_inode_locked() is available])
+ ], [
+ AC_MSG_RESULT(no)
+ ])
])
diff --git a/config/kernel-mount-nodev.m4 b/config/kernel-mount-nodev.m4
index 9229d5b1b..28a45157e 100644
--- a/config/kernel-mount-nodev.m4
+++ b/config/kernel-mount-nodev.m4
@@ -5,11 +5,16 @@ dnl # in the file_system_type structure. When using the new
dnl # interface the caller must now use the mount_nodev() helper.
dnl # This updated callback and helper no longer pass the vfsmount.
dnl #
-AC_DEFUN([ZFS_AC_KERNEL_MOUNT_NODEV], [
- ZFS_CHECK_SYMBOL_EXPORT(
- [mount_nodev],
- [fs/super.c],
- [AC_DEFINE(HAVE_MOUNT_NODEV, 1,
- [mount_nodev() is available])],
- [])
+AC_DEFUN([ZFS_AC_KERNEL_MOUNT_NODEV],
+ [AC_MSG_CHECKING([whether mount_nodev() is available])
+ ZFS_LINUX_TRY_COMPILE_SYMBOL([
+ #include <linux/fs.h>
+ ], [
+ mount_nodev(NULL, 0, NULL, NULL);
+ ], [mount_nodev], [fs/super.c], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_MOUNT_NODEV, 1, [mount_nodev() is available])
+ ], [
+ AC_MSG_RESULT(no)
+ ])
])
diff --git a/config/kernel-open-bdev-exclusive.m4 b/config/kernel-open-bdev-exclusive.m4
index 734b2134c..0661315a6 100644
--- a/config/kernel-open-bdev-exclusive.m4
+++ b/config/kernel-open-bdev-exclusive.m4
@@ -2,11 +2,17 @@ dnl #
dnl # 2.6.28 API change
dnl # open/close_bdev_excl() renamed to open/close_bdev_exclusive()
dnl #
-AC_DEFUN([ZFS_AC_KERNEL_OPEN_BDEV_EXCLUSIVE], [
- ZFS_CHECK_SYMBOL_EXPORT(
- [open_bdev_exclusive],
- [fs/block_dev.c],
- [AC_DEFINE(HAVE_OPEN_BDEV_EXCLUSIVE, 1,
- [open_bdev_exclusive() is available])],
- [])
+AC_DEFUN([ZFS_AC_KERNEL_OPEN_BDEV_EXCLUSIVE],
+ [AC_MSG_CHECKING([whether open_bdev_exclusive() is available])
+ ZFS_LINUX_TRY_COMPILE_SYMBOL([
+ #include <linux/fs.h>
+ ], [
+ open_bdev_exclusive(NULL, 0, NULL);
+ ], [open_bdev_exclusive], [fs/block_dev.c], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_OPEN_BDEV_EXCLUSIVE, 1,
+ [open_bdev_exclusive() is available])
+ ], [
+ AC_MSG_RESULT(no)
+ ])
])
diff --git a/config/kernel-truncate-setsize.m4 b/config/kernel-truncate-setsize.m4
index d8b2b47bd..7e4aff479 100644
--- a/config/kernel-truncate-setsize.m4
+++ b/config/kernel-truncate-setsize.m4
@@ -2,11 +2,17 @@ dnl #
dnl # 2.6.35 API change
dnl # Added truncate_setsize() helper function.
dnl #
-AC_DEFUN([ZFS_AC_KERNEL_TRUNCATE_SETSIZE], [
- ZFS_CHECK_SYMBOL_EXPORT(
- [truncate_setsize],
- [mm/truncate.c],
- [AC_DEFINE(HAVE_TRUNCATE_SETSIZE, 1,
- [truncate_setsize() is available])],
- [])
+AC_DEFUN([ZFS_AC_KERNEL_TRUNCATE_SETSIZE],
+ [AC_MSG_CHECKING([whether truncate_setsize() is available])
+ ZFS_LINUX_TRY_COMPILE_SYMBOL([
+ #include <linux/mm.h>
+ ], [
+ truncate_setsize(NULL, 0);
+ ], [truncate_setsize], [mm/truncate.c], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_TRUNCATE_SETSIZE, 1,
+ [truncate_setsize() is available])
+ ], [
+ AC_MSG_RESULT(no)
+ ])
])
diff --git a/config/kernel.m4 b/config/kernel.m4
index b9c9fb982..a40bb5b6c 100644
--- a/config/kernel.m4
+++ b/config/kernel.m4
@@ -159,7 +159,7 @@ AC_DEFUN([ZFS_AC_KERNEL], [
], [test -d ${kernelsrc}-obj/${target_cpu}/${target_cpu}], [
kernelbuild=${kernelsrc}-obj/${target_cpu}/${target_cpu}
], [test -d ${kernelsrc}-obj/${target_cpu}/default], [
- kernelbuild=${kernelsrc}-obj/${target_cpu}/default
+ kernelbuild=${kernelsrc}-obj/${target_cpu}/default
], [test -d `dirname ${kernelsrc}`/build-${target_cpu}], [
kernelbuild=`dirname ${kernelsrc}`/build-${target_cpu}
], [
@@ -491,30 +491,48 @@ dnl #
dnl # ZFS_CHECK_SYMBOL_EXPORT
dnl # check symbol exported or not
dnl #
-AC_DEFUN([ZFS_CHECK_SYMBOL_EXPORT],
- [AC_MSG_CHECKING([whether symbol $1 is exported])
+AC_DEFUN([ZFS_CHECK_SYMBOL_EXPORT], [
grep -q -E '[[[:space:]]]$1[[[:space:]]]' \
$LINUX_OBJ/$LINUX_SYMBOLS 2>/dev/null
rc=$?
- AS_IF([test $rc -ne 0], [
+ if test $rc -ne 0; then
export=0
for file in $2; do
- grep -q -E "EXPORT_SYMBOL.*($1)" "$LINUX/$file" 2>/dev/null
+ grep -q -E "EXPORT_SYMBOL.*($1)" \
+ "$LINUX/$file" 2>/dev/null
rc=$?
- AS_IF([test $rc -eq 0], [
+ if test $rc -eq 0; then
export=1
break;
- ])
+ fi
done
- AS_IF([test $export -eq 0], [
- AC_MSG_RESULT([no])
+ if test $export -eq 0; then :
$4
- ], [
- AC_MSG_RESULT([yes])
+ else :
$3
- ])
- ], [
- AC_MSG_RESULT([yes])
+ fi
+ else :
$3
- ])
+ fi
+])
+
+dnl #
+dnl # ZFS_LINUX_TRY_COMPILE_SYMBOL
+dnl # like ZFS_LINUX_TRY_COMPILE, except ZFS_CHECK_SYMBOL_EXPORT
+dnl # is called if not compiling for builtin
+dnl #
+AC_DEFUN([ZFS_LINUX_TRY_COMPILE_SYMBOL], [
+ ZFS_LINUX_TRY_COMPILE([$1], [$2], [rc=0], [rc=1])
+ if test $rc -ne 0; then :
+ $6
+ else
+ if test "x$enable_linux_builtin" != xyes; then
+ ZFS_CHECK_SYMBOL_EXPORT([$3], [$4], [rc=0], [rc=1])
+ fi
+ if test $rc -ne 0; then :
+ $6
+ else :
+ $5
+ fi
+ fi
])