-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
-
- AC_MSG_RESULT([$splsymvers])
- AC_SUBST(splsrc)
- AC_SUBST(splsymvers)
-])
+dnl #
+dnl # Check for rpm+rpmbuild to build RPM packages. If these tools
+dnl # are missing it is non-fatal but you will not be able to build
+dnl # RPM packages and will be warned if you try too.
+dnl #
+AC_DEFUN([ZFS_AC_RPM], [
+ RPM=rpm
+ RPMBUILD=rpmbuild
+
+ AC_MSG_CHECKING([whether $RPM is available])
+ AS_IF([tmp=$($RPM --version 2>/dev/null)], [
+ RPM_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }')
+ HAVE_RPM=yes
+ AC_MSG_RESULT([$HAVE_RPM ($RPM_VERSION)])
+ ],[
+ HAVE_RPM=no
+ AC_MSG_RESULT([$HAVE_RPM])
+ ])