-AC_DEFUN([ZFS_AC_SPL], [
-
- AC_ARG_WITH([spl],
- AS_HELP_STRING([--with-spl=PATH],
- [Path to spl source]),
- [splsrc="$withval"; splbuild="$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])
- if test -z "$splsrc"; then
- splbuild=
- sourcelink=/tmp/`whoami`/spl
- buildlink=/tmp/`whoami`/spl
-
- if test -e $sourcelink; then
- splsrc=`(cd $sourcelink; /bin/pwd)`
- fi
- if test -e $buildlink; then
- splbuild=`(cd $buildlink; /bin/pwd)`
- fi
- if test -z "$splsrc"; then
- splsrc=$splbuild
- fi
- fi
-
- if test -z "$splsrc" -o -z "$splbuild"; then
- sourcelink=/lib/modules/${ver}/source
- buildlink=/lib/modules/${ver}/build
-
- if test -e $sourcelink; then
- splsrc=`(cd $sourcelink; /bin/pwd)`
- fi
- if test -e $buildlink; then
- splbuild=`(cd $buildlink; /bin/pwd)`
- fi
- if test -z "$splsrc"; then
- splsrc=$splbuild
- fi
- if test -z "$splsrc" -o -z "$splbuild"; then
- AC_MSG_RESULT([Not found])
- AC_MSG_ERROR([
- *** Please specify the location of the spl source
- *** with the '--with-spl=PATH' option])
- fi
- fi
-
- AC_MSG_RESULT([$splsrc])
- AC_MSG_CHECKING([spl build directory])
- AC_MSG_RESULT([$splbuild])
-
- AC_MSG_CHECKING([spl source version])
- if test -r $splbuild/spl_config.h &&
- fgrep -q VERSION $splbuild/spl_config.h; then
-
- splsrcver=`(echo "#include <spl_config.h>";
- echo "splsrcver=VERSION") |
- cpp -I $splbuild |
- grep "^splsrcver=" | cut -d \" -f 2`
- fi
-
- if test -z "$splsrcver"; then
- AC_MSG_RESULT([Not found])
- AC_MSG_ERROR([
- *** Cannot determine the version of the spl source.
- *** Please prepare the spl source before running this script])
- fi
-
- AC_MSG_RESULT([$splsrcver])
-
- AC_MSG_CHECKING([spl Module.symvers])
- if test -r $splbuild/modules/Module.symvers; then
- splsymvers=$splbuild/modules/Module.symvers
- elif test -r $kernelbuild/Module.symvers; then
- splsymvers=$kernelbuild/Module.symvers
- fi
-
- if test -z "$splsymvers"; then
- AC_MSG_RESULT([Not found])
- AC_MSG_ERROR([
- *** Cannot find extra Module.symvers in the spl source.
- *** Please prepare the spl source before running this script])
- fi