2010-08-26 22:22:58 +04:00
|
|
|
dnl #
|
|
|
|
dnl # Default ZFS kernel configuration
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
|
|
|
|
ZFS_AC_KERNEL
|
|
|
|
ZFS_AC_SPL
|
2012-07-17 12:36:43 +04:00
|
|
|
ZFS_AC_TEST_MODULE
|
2010-08-26 22:22:58 +04:00
|
|
|
ZFS_AC_KERNEL_CONFIG
|
|
|
|
ZFS_AC_KERNEL_BDEV_BLOCK_DEVICE_OPERATIONS
|
|
|
|
ZFS_AC_KERNEL_TYPE_FMODE_T
|
|
|
|
ZFS_AC_KERNEL_KOBJ_NAME_LEN
|
2012-07-11 17:06:32 +04:00
|
|
|
ZFS_AC_KERNEL_3ARG_BLKDEV_GET
|
2011-02-23 01:55:35 +03:00
|
|
|
ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH
|
2010-08-26 22:22:58 +04:00
|
|
|
ZFS_AC_KERNEL_OPEN_BDEV_EXCLUSIVE
|
|
|
|
ZFS_AC_KERNEL_INVALIDATE_BDEV_ARGS
|
|
|
|
ZFS_AC_KERNEL_BDEV_LOGICAL_BLOCK_SIZE
|
|
|
|
ZFS_AC_KERNEL_BIO_EMPTY_BARRIER
|
2010-10-01 21:57:56 +04:00
|
|
|
ZFS_AC_KERNEL_BIO_FAILFAST
|
2010-11-11 01:40:38 +03:00
|
|
|
ZFS_AC_KERNEL_BIO_FAILFAST_DTD
|
|
|
|
ZFS_AC_KERNEL_REQ_FAILFAST_MASK
|
2010-08-26 22:22:58 +04:00
|
|
|
ZFS_AC_KERNEL_BIO_END_IO_T_ARGS
|
2010-11-11 02:49:40 +03:00
|
|
|
ZFS_AC_KERNEL_BIO_RW_SYNC
|
2010-08-26 22:22:58 +04:00
|
|
|
ZFS_AC_KERNEL_BIO_RW_SYNCIO
|
2010-11-11 02:49:40 +03:00
|
|
|
ZFS_AC_KERNEL_REQ_SYNC
|
2010-08-26 22:22:58 +04:00
|
|
|
ZFS_AC_KERNEL_BLK_END_REQUEST
|
2011-09-05 13:11:38 +04:00
|
|
|
ZFS_AC_KERNEL_BLK_QUEUE_FLUSH
|
2011-09-05 17:15:45 +04:00
|
|
|
ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS
|
|
|
|
ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS
|
|
|
|
ZFS_AC_KERNEL_BLK_QUEUE_PHYSICAL_BLOCK_SIZE
|
|
|
|
ZFS_AC_KERNEL_BLK_QUEUE_IO_OPT
|
|
|
|
ZFS_AC_KERNEL_BLK_QUEUE_NONROT
|
2011-09-02 17:23:12 +04:00
|
|
|
ZFS_AC_KERNEL_BLK_QUEUE_DISCARD
|
2010-08-26 22:22:58 +04:00
|
|
|
ZFS_AC_KERNEL_BLK_FETCH_REQUEST
|
|
|
|
ZFS_AC_KERNEL_BLK_REQUEUE_REQUEST
|
|
|
|
ZFS_AC_KERNEL_BLK_RQ_BYTES
|
|
|
|
ZFS_AC_KERNEL_BLK_RQ_POS
|
|
|
|
ZFS_AC_KERNEL_BLK_RQ_SECTORS
|
|
|
|
ZFS_AC_KERNEL_GET_DISK_RO
|
2012-07-11 17:06:32 +04:00
|
|
|
ZFS_AC_KERNEL_GET_GENDISK
|
2010-08-26 22:22:58 +04:00
|
|
|
ZFS_AC_KERNEL_RQ_IS_SYNC
|
|
|
|
ZFS_AC_KERNEL_RQ_FOR_EACH_SEGMENT
|
2012-08-01 12:29:59 +04:00
|
|
|
ZFS_AC_KERNEL_DISCARD_GRANULARITY
|
2011-02-11 03:16:52 +03:00
|
|
|
ZFS_AC_KERNEL_CONST_XATTR_HANDLER
|
2011-02-11 21:33:01 +03:00
|
|
|
ZFS_AC_KERNEL_XATTR_HANDLER_GET
|
|
|
|
ZFS_AC_KERNEL_XATTR_HANDLER_SET
|
2012-02-02 23:55:48 +04:00
|
|
|
ZFS_AC_KERNEL_SHOW_OPTIONS
|
2011-11-10 08:47:59 +04:00
|
|
|
ZFS_AC_KERNEL_FSYNC
|
2011-02-12 00:46:10 +03:00
|
|
|
ZFS_AC_KERNEL_EVICT_INODE
|
2011-12-23 00:20:43 +04:00
|
|
|
ZFS_AC_KERNEL_NR_CACHED_OBJECTS
|
|
|
|
ZFS_AC_KERNEL_FREE_CACHED_OBJECTS
|
2011-09-02 11:42:07 +04:00
|
|
|
ZFS_AC_KERNEL_FALLOCATE
|
2012-07-23 22:11:25 +04:00
|
|
|
ZFS_AC_KERNEL_TRUNCATE_RANGE
|
2012-04-30 23:01:49 +04:00
|
|
|
ZFS_AC_KERNEL_CREATE_UMODE_T
|
2011-11-11 11:15:53 +04:00
|
|
|
ZFS_AC_KERNEL_AUTOMOUNT
|
2012-07-23 21:55:48 +04:00
|
|
|
ZFS_AC_KERNEL_ENCODE_FH_WITH_INODE
|
2012-07-23 22:39:25 +04:00
|
|
|
ZFS_AC_KERNEL_CLEAR_INODE
|
2011-03-22 19:55:09 +03:00
|
|
|
ZFS_AC_KERNEL_INSERT_INODE_LOCKED
|
2012-06-06 21:08:00 +04:00
|
|
|
ZFS_AC_KERNEL_D_MAKE_ROOT
|
2011-04-28 20:35:50 +04:00
|
|
|
ZFS_AC_KERNEL_D_OBTAIN_ALIAS
|
2011-02-25 10:36:01 +03:00
|
|
|
ZFS_AC_KERNEL_CHECK_DISK_SIZE_CHANGE
|
2011-06-25 16:30:29 +04:00
|
|
|
ZFS_AC_KERNEL_TRUNCATE_SETSIZE
|
2011-05-19 23:47:32 +04:00
|
|
|
ZFS_AC_KERNEL_6ARGS_SECURITY_INODE_INIT_SECURITY
|
2012-01-13 01:59:44 +04:00
|
|
|
ZFS_AC_KERNEL_CALLBACK_SECURITY_INODE_INIT_SECURITY
|
2011-05-19 22:44:07 +04:00
|
|
|
ZFS_AC_KERNEL_MOUNT_NODEV
|
2011-12-23 00:20:43 +04:00
|
|
|
ZFS_AC_KERNEL_SHRINK
|
2011-08-02 05:24:40 +04:00
|
|
|
ZFS_AC_KERNEL_BDI
|
2011-11-08 04:39:03 +04:00
|
|
|
ZFS_AC_KERNEL_BDI_SETUP_AND_REGISTER
|
2011-12-17 01:15:12 +04:00
|
|
|
ZFS_AC_KERNEL_SET_NLINK
|
2010-08-26 22:22:58 +04:00
|
|
|
|
2011-08-24 20:52:16 +04:00
|
|
|
AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
|
2010-09-05 00:26:23 +04:00
|
|
|
KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
2010-09-05 00:26:23 +04:00
|
|
|
AC_SUBST(KERNELMAKE_PARAMS)
|
|
|
|
|
|
|
|
|
2010-08-26 22:22:58 +04:00
|
|
|
dnl # -Wall -fno-strict-aliasing -Wstrict-prototypes and other
|
|
|
|
dnl # compiler options are added by the kernel build system.
|
2011-06-14 22:02:13 +04:00
|
|
|
KERNELCPPFLAGS="$KERNELCPPFLAGS $NO_UNUSED_BUT_SET_VARIABLE"
|
2010-08-26 22:22:58 +04:00
|
|
|
KERNELCPPFLAGS="$KERNELCPPFLAGS -DHAVE_SPL -D_KERNEL"
|
|
|
|
KERNELCPPFLAGS="$KERNELCPPFLAGS -DTEXT_DOMAIN=\\\"zfs-linux-kernel\\\""
|
|
|
|
|
|
|
|
AC_SUBST(KERNELCPPFLAGS)
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # Detect name used for Module.symvers file in kernel
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_AC_MODULE_SYMVERS], [
|
|
|
|
modpost=$LINUX/scripts/Makefile.modpost
|
|
|
|
AC_MSG_CHECKING([kernel file name for module symbols])
|
2012-07-17 12:36:43 +04:00
|
|
|
AS_IF([test "x$enable_linux_builtin" != xyes -a -f "$modpost"], [
|
2011-08-24 20:52:16 +04:00
|
|
|
AS_IF([grep -q Modules.symvers $modpost], [
|
2010-08-26 22:22:58 +04:00
|
|
|
LINUX_SYMBOLS=Modules.symvers
|
2011-08-24 20:52:16 +04:00
|
|
|
], [
|
2010-08-26 22:22:58 +04:00
|
|
|
LINUX_SYMBOLS=Module.symvers
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
2011-03-08 00:03:48 +03:00
|
|
|
|
2011-08-24 20:52:16 +04:00
|
|
|
AS_IF([test ! -f "$LINUX_OBJ/$LINUX_SYMBOLS"], [
|
2011-03-08 00:03:48 +03:00
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** Please make sure the kernel devel package for your distribution
|
|
|
|
*** is installed. If your building with a custom kernel make sure the
|
|
|
|
*** kernel is configured, built, and the '--with-linux=PATH' configure
|
|
|
|
*** option refers to the location of the kernel source.])
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
|
|
|
], [
|
2010-08-26 22:22:58 +04:00
|
|
|
LINUX_SYMBOLS=NONE
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
2010-08-26 22:22:58 +04:00
|
|
|
AC_MSG_RESULT($LINUX_SYMBOLS)
|
|
|
|
AC_SUBST(LINUX_SYMBOLS)
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # Detect the kernel to be built against
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_AC_KERNEL], [
|
|
|
|
AC_ARG_WITH([linux],
|
|
|
|
AS_HELP_STRING([--with-linux=PATH],
|
|
|
|
[Path to kernel source]),
|
|
|
|
[kernelsrc="$withval"])
|
|
|
|
|
|
|
|
AC_ARG_WITH(linux-obj,
|
|
|
|
AS_HELP_STRING([--with-linux-obj=PATH],
|
|
|
|
[Path to kernel build objects]),
|
|
|
|
[kernelbuild="$withval"])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([kernel source directory])
|
2011-08-24 20:52:16 +04:00
|
|
|
AS_IF([test -z "$kernelsrc"], [
|
|
|
|
AS_IF([test -e "/lib/modules/$(uname -r)/source"], [
|
2011-02-11 01:54:33 +03:00
|
|
|
headersdir="/lib/modules/$(uname -r)/source"
|
|
|
|
sourcelink=$(readlink -f "$headersdir")
|
2011-08-24 20:52:16 +04:00
|
|
|
], [test -e "/lib/modules/$(uname -r)/build"], [
|
2011-02-11 01:54:33 +03:00
|
|
|
headersdir="/lib/modules/$(uname -r)/build"
|
2010-08-26 22:22:58 +04:00
|
|
|
sourcelink=$(readlink -f "$headersdir")
|
2011-08-24 20:52:16 +04:00
|
|
|
], [
|
2010-08-26 22:22:58 +04:00
|
|
|
sourcelink=$(ls -1d /usr/src/kernels/* \
|
2011-08-24 20:52:16 +04:00
|
|
|
/usr/src/linux-* \
|
2010-08-26 22:22:58 +04:00
|
|
|
2>/dev/null | grep -v obj | tail -1)
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
2010-08-26 22:22:58 +04:00
|
|
|
|
2011-08-24 20:52:16 +04:00
|
|
|
AS_IF([test -n "$sourcelink" && test -e ${sourcelink}], [
|
2010-08-26 22:22:58 +04:00
|
|
|
kernelsrc=`readlink -f ${sourcelink}`
|
2011-08-24 20:52:16 +04:00
|
|
|
], [
|
2010-08-26 22:22:58 +04:00
|
|
|
AC_MSG_RESULT([Not found])
|
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** Please make sure the kernel devel package for your distribution
|
|
|
|
*** is installed then try again. If that fails you can specify the
|
|
|
|
*** location of the kernel source with the '--with-linux=PATH' option.])
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
|
|
|
], [
|
|
|
|
AS_IF([test "$kernelsrc" = "NONE"], [
|
2010-08-26 22:22:58 +04:00
|
|
|
kernsrcver=NONE
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
|
|
|
])
|
2010-08-26 22:22:58 +04:00
|
|
|
|
|
|
|
AC_MSG_RESULT([$kernelsrc])
|
|
|
|
AC_MSG_CHECKING([kernel build directory])
|
2011-08-24 20:52:16 +04:00
|
|
|
AS_IF([test -z "$kernelbuild"], [
|
|
|
|
AS_IF([test -e "/lib/modules/$(uname -r)/build"], [
|
2011-02-11 01:54:33 +03:00
|
|
|
kernelbuild=`readlink -f /lib/modules/$(uname -r)/build`
|
2011-08-24 20:52:16 +04:00
|
|
|
], [test -d ${kernelsrc}-obj/${target_cpu}/${target_cpu}], [
|
2010-08-26 22:22:58 +04:00
|
|
|
kernelbuild=${kernelsrc}-obj/${target_cpu}/${target_cpu}
|
2011-08-24 20:52:16 +04:00
|
|
|
], [test -d ${kernelsrc}-obj/${target_cpu}/default], [
|
2012-07-26 01:38:58 +04:00
|
|
|
kernelbuild=${kernelsrc}-obj/${target_cpu}/default
|
2011-08-24 20:52:16 +04:00
|
|
|
], [test -d `dirname ${kernelsrc}`/build-${target_cpu}], [
|
2010-08-26 22:22:58 +04:00
|
|
|
kernelbuild=`dirname ${kernelsrc}`/build-${target_cpu}
|
2011-08-24 20:52:16 +04:00
|
|
|
], [
|
2010-08-26 22:22:58 +04:00
|
|
|
kernelbuild=${kernelsrc}
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
|
|
|
])
|
2010-08-26 22:22:58 +04:00
|
|
|
AC_MSG_RESULT([$kernelbuild])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([kernel source version])
|
|
|
|
utsrelease1=$kernelbuild/include/linux/version.h
|
|
|
|
utsrelease2=$kernelbuild/include/linux/utsrelease.h
|
|
|
|
utsrelease3=$kernelbuild/include/generated/utsrelease.h
|
2011-08-24 20:52:16 +04:00
|
|
|
AS_IF([test -r $utsrelease1 && fgrep -q UTS_RELEASE $utsrelease1], [
|
2010-08-26 22:22:58 +04:00
|
|
|
utsrelease=linux/version.h
|
2011-08-24 20:52:16 +04:00
|
|
|
], [test -r $utsrelease2 && fgrep -q UTS_RELEASE $utsrelease2], [
|
2010-08-26 22:22:58 +04:00
|
|
|
utsrelease=linux/utsrelease.h
|
2011-08-24 20:52:16 +04:00
|
|
|
], [test -r $utsrelease3 && fgrep -q UTS_RELEASE $utsrelease3], [
|
2010-08-26 22:22:58 +04:00
|
|
|
utsrelease=generated/utsrelease.h
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
2010-08-26 22:22:58 +04:00
|
|
|
|
2011-08-24 20:52:16 +04:00
|
|
|
AS_IF([test "$utsrelease"], [
|
2010-08-26 22:22:58 +04:00
|
|
|
kernsrcver=`(echo "#include <$utsrelease>";
|
|
|
|
echo "kernsrcver=UTS_RELEASE") |
|
|
|
|
cpp -I $kernelbuild/include |
|
|
|
|
grep "^kernsrcver=" | cut -d \" -f 2`
|
|
|
|
|
2011-08-24 20:52:16 +04:00
|
|
|
AS_IF([test -z "$kernsrcver"], [
|
2010-08-26 22:22:58 +04:00
|
|
|
AC_MSG_RESULT([Not found])
|
|
|
|
AC_MSG_ERROR([*** Cannot determine kernel version.])
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
|
|
|
], [
|
2010-08-26 22:22:58 +04:00
|
|
|
AC_MSG_RESULT([Not found])
|
2012-07-17 12:36:43 +04:00
|
|
|
if test "x$enable_linux_builtin" != xyes; then
|
|
|
|
AC_MSG_ERROR([*** Cannot find UTS_RELEASE definition.])
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** Cannot find UTS_RELEASE definition.
|
|
|
|
*** Please run 'make prepare' inside the kernel source tree.])
|
|
|
|
fi
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
2010-08-26 22:22:58 +04:00
|
|
|
|
|
|
|
AC_MSG_RESULT([$kernsrcver])
|
|
|
|
|
|
|
|
LINUX=${kernelsrc}
|
|
|
|
LINUX_OBJ=${kernelbuild}
|
|
|
|
LINUX_VERSION=${kernsrcver}
|
|
|
|
|
|
|
|
AC_SUBST(LINUX)
|
|
|
|
AC_SUBST(LINUX_OBJ)
|
|
|
|
AC_SUBST(LINUX_VERSION)
|
|
|
|
|
|
|
|
ZFS_AC_MODULE_SYMVERS
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # Detect name used for the additional SPL Module.symvers file. If one
|
|
|
|
dnl # does not exist this is likely because the SPL has been configured
|
2012-08-08 04:07:55 +04:00
|
|
|
dnl # but not built. The '--with-spl-timeout' option can be passed
|
|
|
|
dnl # to pause here, waiting for the file to appear from a concurrently
|
|
|
|
dnl # building SPL package. If the file does not appear in time, a good
|
|
|
|
dnl # guess is made as to what this file will be named based on what it
|
|
|
|
dnl # is named in the kernel build products. This file will first be
|
|
|
|
dnl # used at link time so if the guess is wrong the build will fail
|
|
|
|
dnl # then. This unfortunately means the ZFS package does not contain a
|
|
|
|
dnl # reliable mechanism to detect symbols exported by the SPL at
|
|
|
|
dnl # configure time.
|
2010-08-26 22:22:58 +04:00
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_AC_SPL_MODULE_SYMVERS], [
|
2012-08-08 04:07:55 +04:00
|
|
|
AC_ARG_WITH([spl-timeout],
|
|
|
|
AS_HELP_STRING([--with-spl-timeout=SECS],
|
|
|
|
[Wait SECS for symvers file to appear @<:@default=0@:>@]),
|
|
|
|
[timeout="$withval"], [timeout=0])
|
|
|
|
|
2010-08-26 22:22:58 +04:00
|
|
|
AC_MSG_CHECKING([spl file name for module symbols])
|
2012-08-08 04:07:55 +04:00
|
|
|
SPL_SYMBOLS=NONE
|
|
|
|
|
|
|
|
while true; do
|
|
|
|
AS_IF([test -r $SPL_OBJ/Module.symvers], [
|
|
|
|
SPL_SYMBOLS=Module.symvers
|
|
|
|
], [test -r $SPL_OBJ/Modules.symvers], [
|
|
|
|
SPL_SYMBOLS=Modules.symvers
|
|
|
|
], [test -r $SPL_OBJ/module/Module.symvers], [
|
|
|
|
SPL_SYMBOLS=Module.symvers
|
|
|
|
], [test -r $SPL_OBJ/module/Modules.symvers], [
|
|
|
|
SPL_SYMBOLS=Modules.symvers
|
|
|
|
])
|
|
|
|
|
|
|
|
AS_IF([test $SPL_SYMBOLS != NONE -o $timeout -le 0], [
|
|
|
|
break;
|
|
|
|
], [
|
|
|
|
sleep 1
|
|
|
|
timeout=$((timeout-1))
|
|
|
|
])
|
|
|
|
done
|
|
|
|
|
|
|
|
AS_IF([test "$SPL_SYMBOLS" = NONE], [
|
2010-08-26 22:22:58 +04:00
|
|
|
SPL_SYMBOLS=$LINUX_SYMBOLS
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
2010-08-26 22:22:58 +04:00
|
|
|
|
|
|
|
AC_MSG_RESULT([$SPL_SYMBOLS])
|
|
|
|
AC_SUBST(SPL_SYMBOLS)
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # Detect the SPL module to be built against
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_AC_SPL], [
|
|
|
|
AC_ARG_WITH([spl],
|
|
|
|
AS_HELP_STRING([--with-spl=PATH],
|
|
|
|
[Path to spl source]),
|
|
|
|
[splsrc="$withval"])
|
|
|
|
|
|
|
|
AC_ARG_WITH([spl-obj],
|
|
|
|
AS_HELP_STRING([--with-spl-obj=PATH],
|
|
|
|
[Path to spl build objects]),
|
|
|
|
[splbuild="$withval"])
|
|
|
|
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([spl source directory])
|
2011-08-24 20:52:16 +04:00
|
|
|
AS_IF([test -z "$splsrc"], [
|
2012-08-08 00:13:17 +04:00
|
|
|
dnl #
|
|
|
|
dnl # Look in the standard development package location
|
|
|
|
dnl #
|
2010-08-26 22:22:58 +04:00
|
|
|
sourcelink=`ls -1d /usr/src/spl-*/${LINUX_VERSION} \
|
|
|
|
2>/dev/null | tail -1`
|
|
|
|
|
2012-08-08 00:13:17 +04:00
|
|
|
dnl #
|
|
|
|
dnl # Look in the DKMS source location
|
|
|
|
dnl #
|
|
|
|
AS_IF([test -z "$sourcelink" || test ! -e $sourcelink/spl_config.h], [
|
|
|
|
sourcelink=`ls -1d /var/lib/dkms/spl/*/build \
|
|
|
|
2>/dev/null | tail -1`
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # Look in the parent directory
|
|
|
|
dnl #
|
|
|
|
AS_IF([test -z "$sourcelink" || test ! -e $sourcelink/spl_config.h], [
|
2010-08-26 22:22:58 +04:00
|
|
|
sourcelink=../spl
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
2010-08-26 22:22:58 +04:00
|
|
|
|
2012-08-26 02:32:54 +04:00
|
|
|
dnl #
|
|
|
|
dnl # Look in the kernel directory
|
|
|
|
dnl #
|
|
|
|
AS_IF([test -z "$sourcelink" || test ! -e $sourcelink/spl_config.h], [
|
|
|
|
sourcelink="$LINUX"
|
|
|
|
])
|
|
|
|
|
2012-08-08 00:13:17 +04:00
|
|
|
AS_IF([test -e $sourcelink/spl_config.h], [
|
2010-08-26 22:22:58 +04:00
|
|
|
splsrc=`readlink -f ${sourcelink}`
|
2011-08-24 20:52:16 +04:00
|
|
|
], [
|
2010-08-26 22:22:58 +04:00
|
|
|
AC_MSG_RESULT([Not found])
|
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** Please make sure the spl devel package for your distribution
|
|
|
|
*** is installed then try again. If that fails you can specify the
|
|
|
|
*** location of the spl source with the '--with-spl=PATH' option.])
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
|
|
|
], [
|
|
|
|
AS_IF([test "$splsrc" = "NONE"], [
|
2010-08-26 22:22:58 +04:00
|
|
|
splbuild=NONE
|
|
|
|
splsrcver=NONE
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
|
|
|
])
|
2010-08-26 22:22:58 +04:00
|
|
|
|
|
|
|
AC_MSG_RESULT([$splsrc])
|
|
|
|
AC_MSG_CHECKING([spl build directory])
|
2011-08-24 20:52:16 +04:00
|
|
|
AS_IF([test -z "$splbuild"], [
|
2010-09-05 00:26:23 +04:00
|
|
|
splbuild=${splsrc}
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
2010-08-26 22:22:58 +04:00
|
|
|
AC_MSG_RESULT([$splbuild])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([spl source version])
|
2011-08-24 20:52:16 +04:00
|
|
|
AS_IF([test -r $splbuild/spl_config.h &&
|
|
|
|
fgrep -q SPL_META_VERSION $splbuild/spl_config.h], [
|
2010-08-26 22:22:58 +04:00
|
|
|
|
|
|
|
splsrcver=`(echo "#include <spl_config.h>";
|
2012-01-18 04:19:43 +04:00
|
|
|
echo "splsrcver=SPL_META_VERSION-SPL_META_RELEASE") |
|
2010-09-03 07:44:41 +04:00
|
|
|
cpp -I $splbuild |
|
2012-01-18 04:19:43 +04:00
|
|
|
grep "^splsrcver=" | tr -d \" | cut -d= -f2`
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
2010-08-26 22:22:58 +04:00
|
|
|
|
2011-08-24 20:52:16 +04:00
|
|
|
AS_IF([test -z "$splsrcver"], [
|
2010-08-26 22:22:58 +04:00
|
|
|
AC_MSG_RESULT([Not found])
|
|
|
|
AC_MSG_ERROR([
|
2011-08-24 20:23:44 +04:00
|
|
|
*** Cannot determine the version of the spl source.
|
|
|
|
*** Please prepare the spl source before running this script])
|
2011-08-24 20:52:16 +04:00
|
|
|
])
|
2010-08-26 22:22:58 +04:00
|
|
|
|
|
|
|
AC_MSG_RESULT([$splsrcver])
|
|
|
|
|
|
|
|
SPL=${splsrc}
|
|
|
|
SPL_OBJ=${splbuild}
|
|
|
|
SPL_VERSION=${splsrcver}
|
|
|
|
|
|
|
|
AC_SUBST(SPL)
|
|
|
|
AC_SUBST(SPL_OBJ)
|
|
|
|
AC_SUBST(SPL_VERSION)
|
|
|
|
|
|
|
|
ZFS_AC_SPL_MODULE_SYMVERS
|
|
|
|
])
|
|
|
|
|
2012-07-17 12:36:43 +04:00
|
|
|
dnl #
|
|
|
|
dnl # Basic toolchain sanity check.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_AC_TEST_MODULE],
|
|
|
|
[AC_MSG_CHECKING([whether modules can be built])
|
|
|
|
ZFS_LINUX_TRY_COMPILE([],[],[
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
if test "x$enable_linux_builtin" != xyes; then
|
|
|
|
AC_MSG_ERROR([*** Unable to build an empty module.])
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** Unable to build an empty module.
|
|
|
|
*** Please run 'make scripts' inside the kernel source tree.])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2011-03-07 21:59:26 +03:00
|
|
|
dnl #
|
|
|
|
dnl # Certain kernel build options are not supported. These must be
|
|
|
|
dnl # detected at configure time and cause a build failure. Otherwise
|
|
|
|
dnl # modules may be successfully built that behave incorrectly.
|
|
|
|
dnl #
|
2012-05-21 23:59:58 +04:00
|
|
|
AC_DEFUN([ZFS_AC_KERNEL_CONFIG], [
|
|
|
|
|
|
|
|
AS_IF([test "$ZFS_META_LICENSE" = GPL], [
|
|
|
|
AC_DEFINE([HAVE_GPL_ONLY_SYMBOLS], [1],
|
|
|
|
[Define to 1 if licensed under the GPL])
|
|
|
|
])
|
|
|
|
|
|
|
|
ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # Check CONFIG_DEBUG_LOCK_ALLOC
|
|
|
|
dnl #
|
|
|
|
dnl # This is typically only set for debug kernels because it comes with
|
|
|
|
dnl # a performance penalty. However, when it is set it maps the non-GPL
|
|
|
|
dnl # symbol mutex_lock() to the GPL-only mutex_lock_nested() symbol.
|
|
|
|
dnl # This will cause a failure at link time which we'd rather know about
|
|
|
|
dnl # at compile time.
|
|
|
|
dnl #
|
|
|
|
dnl # Since we plan to pursue making mutex_lock_nested() a non-GPL symbol
|
|
|
|
dnl # with the upstream community we add a check to detect this case.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC], [
|
|
|
|
|
|
|
|
ZFS_LINUX_CONFIG([DEBUG_LOCK_ALLOC], [
|
|
|
|
AC_MSG_CHECKING([whether mutex_lock() is GPL-only])
|
|
|
|
tmp_flags="$EXTRA_KCFLAGS"
|
|
|
|
ZFS_LINUX_TRY_COMPILE([
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/mutex.h>
|
|
|
|
|
|
|
|
MODULE_LICENSE("$ZFS_META_LICENSE");
|
|
|
|
],[
|
|
|
|
struct mutex lock;
|
|
|
|
|
|
|
|
mutex_init(&lock);
|
|
|
|
mutex_lock(&lock);
|
|
|
|
mutex_unlock(&lock);
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_MSG_ERROR([
|
|
|
|
*** Kernel built with CONFIG_DEBUG_LOCK_ALLOC which is incompatible
|
2012-06-05 23:45:37 +04:00
|
|
|
*** with the CDDL license and will prevent the module linking stage
|
|
|
|
*** from succeeding. You must rebuild your kernel without this
|
|
|
|
*** option enabled.])
|
2012-05-21 23:59:58 +04:00
|
|
|
])
|
|
|
|
EXTRA_KCFLAGS="$tmp_flags"
|
|
|
|
], [])
|
2010-08-26 22:22:58 +04:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # ZFS_LINUX_CONFTEST
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_LINUX_CONFTEST], [
|
|
|
|
cat confdefs.h - <<_ACEOF >conftest.c
|
|
|
|
$1
|
|
|
|
_ACEOF
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # ZFS_LANG_PROGRAM(C)([PROLOGUE], [BODY])
|
|
|
|
dnl #
|
|
|
|
m4_define([ZFS_LANG_PROGRAM], [
|
|
|
|
$1
|
|
|
|
int
|
|
|
|
main (void)
|
|
|
|
{
|
|
|
|
dnl Do *not* indent the following line: there may be CPP directives.
|
|
|
|
dnl Don't move the `;' right after for the same reason.
|
|
|
|
$2
|
|
|
|
;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # ZFS_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_LINUX_COMPILE_IFELSE], [
|
|
|
|
m4_ifvaln([$1], [ZFS_LINUX_CONFTEST([$1])])
|
Fake modpost stage for LINUX_COMPILE.
Currently, when building a test case, we're compiling an entire Linux
module from beginning to end. This includes the MODPOST stage, which
generates a "conftest.mod.c" file with some boilerplate module
declaration code.
This poses a problem when configuring for built-in on kernels which have
loadable module support disabled. In this case conftest.mod.c is
referencing disabled code, resulting in a compilation failure, thus
breaking the tests.
This patch fixes the issue by faking the modpost stage when the
--enable-linux-builtin option is provided. It does so by forcing the
modpost command to be /bin/true, and using an empty conftest.mod.c file.
The test module still compiles fine, although the result isn't loadable,
but we don't really care at this point.
Note it is important to preserve the modpost stage when building out of
tree. The ZFS_AC_KERNEL_BLK_END_REQUEST, ZFS_AC_KERNEL_BLK_QUEUE_FLUSH,
and ZFS_AC_KERNEL_BLK_RQ_BYTES configure checks all depend on it to
identify GPL-only symbols.
Signed-off-by: Prakash Surya <surya1@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #851
2012-07-16 11:37:38 +04:00
|
|
|
rm -Rf build && mkdir -p build && touch build/conftest.mod.c
|
2010-08-26 22:22:58 +04:00
|
|
|
echo "obj-m := conftest.o" >build/Makefile
|
Fake modpost stage for LINUX_COMPILE.
Currently, when building a test case, we're compiling an entire Linux
module from beginning to end. This includes the MODPOST stage, which
generates a "conftest.mod.c" file with some boilerplate module
declaration code.
This poses a problem when configuring for built-in on kernels which have
loadable module support disabled. In this case conftest.mod.c is
referencing disabled code, resulting in a compilation failure, thus
breaking the tests.
This patch fixes the issue by faking the modpost stage when the
--enable-linux-builtin option is provided. It does so by forcing the
modpost command to be /bin/true, and using an empty conftest.mod.c file.
The test module still compiles fine, although the result isn't loadable,
but we don't really care at this point.
Note it is important to preserve the modpost stage when building out of
tree. The ZFS_AC_KERNEL_BLK_END_REQUEST, ZFS_AC_KERNEL_BLK_QUEUE_FLUSH,
and ZFS_AC_KERNEL_BLK_RQ_BYTES configure checks all depend on it to
identify GPL-only symbols.
Signed-off-by: Prakash Surya <surya1@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #851
2012-07-16 11:37:38 +04:00
|
|
|
modpost_flag=''
|
|
|
|
test "x$enable_linux_builtin" = xyes && modpost_flag='modpost=true' # fake modpost stage
|
2010-08-26 22:22:58 +04:00
|
|
|
AS_IF(
|
Fake modpost stage for LINUX_COMPILE.
Currently, when building a test case, we're compiling an entire Linux
module from beginning to end. This includes the MODPOST stage, which
generates a "conftest.mod.c" file with some boilerplate module
declaration code.
This poses a problem when configuring for built-in on kernels which have
loadable module support disabled. In this case conftest.mod.c is
referencing disabled code, resulting in a compilation failure, thus
breaking the tests.
This patch fixes the issue by faking the modpost stage when the
--enable-linux-builtin option is provided. It does so by forcing the
modpost command to be /bin/true, and using an empty conftest.mod.c file.
The test module still compiles fine, although the result isn't loadable,
but we don't really care at this point.
Note it is important to preserve the modpost stage when building out of
tree. The ZFS_AC_KERNEL_BLK_END_REQUEST, ZFS_AC_KERNEL_BLK_QUEUE_FLUSH,
and ZFS_AC_KERNEL_BLK_RQ_BYTES configure checks all depend on it to
identify GPL-only symbols.
Signed-off-by: Prakash Surya <surya1@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #851
2012-07-16 11:37:38 +04:00
|
|
|
[AC_TRY_COMMAND(cp conftest.c build && make [$2] -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build $modpost_flag) >/dev/null && AC_TRY_COMMAND([$3])],
|
2010-08-26 22:22:58 +04:00
|
|
|
[$4],
|
|
|
|
[_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])]
|
|
|
|
)
|
|
|
|
rm -Rf build
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # ZFS_LINUX_TRY_COMPILE like AC_TRY_COMPILE
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_LINUX_TRY_COMPILE],
|
|
|
|
[ZFS_LINUX_COMPILE_IFELSE(
|
|
|
|
[AC_LANG_SOURCE([ZFS_LANG_PROGRAM([[$1]], [[$2]])])],
|
|
|
|
[modules],
|
|
|
|
[test -s build/conftest.o],
|
|
|
|
[$3], [$4])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # ZFS_LINUX_CONFIG
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_LINUX_CONFIG],
|
|
|
|
[AC_MSG_CHECKING([whether Linux was built with CONFIG_$1])
|
|
|
|
ZFS_LINUX_TRY_COMPILE([
|
2011-07-23 01:10:38 +04:00
|
|
|
#include <linux/module.h>
|
2010-08-26 22:22:58 +04:00
|
|
|
],[
|
|
|
|
#ifndef CONFIG_$1
|
|
|
|
#error CONFIG_$1 not #defined
|
|
|
|
#endif
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
$2
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
$3
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # ZFS_CHECK_SYMBOL_EXPORT
|
|
|
|
dnl # check symbol exported or not
|
|
|
|
dnl #
|
2012-07-26 01:38:58 +04:00
|
|
|
AC_DEFUN([ZFS_CHECK_SYMBOL_EXPORT], [
|
2010-08-26 22:22:58 +04:00
|
|
|
grep -q -E '[[[:space:]]]$1[[[:space:]]]' \
|
|
|
|
$LINUX_OBJ/$LINUX_SYMBOLS 2>/dev/null
|
|
|
|
rc=$?
|
2012-07-26 01:38:58 +04:00
|
|
|
if test $rc -ne 0; then
|
2010-08-26 22:22:58 +04:00
|
|
|
export=0
|
|
|
|
for file in $2; do
|
2012-07-26 01:38:58 +04:00
|
|
|
grep -q -E "EXPORT_SYMBOL.*($1)" \
|
|
|
|
"$LINUX/$file" 2>/dev/null
|
2010-08-26 22:22:58 +04:00
|
|
|
rc=$?
|
2012-07-26 01:38:58 +04:00
|
|
|
if test $rc -eq 0; then
|
2011-08-24 20:52:16 +04:00
|
|
|
export=1
|
|
|
|
break;
|
2012-07-26 01:38:58 +04:00
|
|
|
fi
|
2010-08-26 22:22:58 +04:00
|
|
|
done
|
2012-07-26 01:38:58 +04:00
|
|
|
if test $export -eq 0; then :
|
2010-08-26 22:22:58 +04:00
|
|
|
$4
|
2012-07-26 01:38:58 +04:00
|
|
|
else :
|
2010-08-26 22:22:58 +04:00
|
|
|
$3
|
2012-07-26 01:38:58 +04:00
|
|
|
fi
|
|
|
|
else :
|
2010-08-26 22:22:58 +04:00
|
|
|
$3
|
2012-07-26 01:38:58 +04:00
|
|
|
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
|
2010-08-26 22:22:58 +04:00
|
|
|
])
|