2008-12-05 17:46:11 +00:00
|
|
|
AC_DEFUN([ZFS_AC_LICENSE], [
|
2010-03-08 18:27:42 +00:00
|
|
|
AC_MSG_CHECKING([zfs author])
|
|
|
|
AC_MSG_RESULT([$ZFS_META_AUTHOR])
|
2009-03-10 18:10:50 +00:00
|
|
|
|
2010-03-08 18:27:42 +00:00
|
|
|
AC_MSG_CHECKING([zfs license])
|
|
|
|
AC_MSG_RESULT([$ZFS_META_LICENSE])
|
2008-12-05 17:46:11 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN([ZFS_AC_DEBUG], [
|
2010-05-18 22:05:44 +00:00
|
|
|
AC_MSG_CHECKING([whether debugging is enabled])
|
2010-07-14 17:25:54 +00:00
|
|
|
AC_ARG_ENABLE([debug],
|
|
|
|
[AS_HELP_STRING([--enable-debug],
|
|
|
|
[Enable generic debug support @<:@default=no@:>@])],
|
|
|
|
[],
|
|
|
|
[enable_debug=no])
|
|
|
|
|
|
|
|
AS_IF([test "x$enable_debug" = xyes],
|
|
|
|
[
|
|
|
|
KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror"
|
|
|
|
HOSTCFLAGS="${HOSTCFLAGS} -DDEBUG -Werror"
|
2010-07-23 17:13:59 +00:00
|
|
|
DEBUG_CFLAGS="-DDEBUG -Werror"
|
|
|
|
DEBUG_STACKFLAGS="-fstack-check"
|
2010-07-14 17:25:54 +00:00
|
|
|
],
|
|
|
|
[
|
2010-05-18 22:05:44 +00:00
|
|
|
KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG "
|
2008-12-05 17:46:11 +00:00
|
|
|
HOSTCFLAGS="${HOSTCFLAGS} -DNDEBUG "
|
2010-07-14 17:25:54 +00:00
|
|
|
DEBUG_CFLAGS="-DNDEBUG"
|
2010-07-23 17:13:59 +00:00
|
|
|
DEBUG_STACKFLAGS=""
|
2010-07-14 17:25:54 +00:00
|
|
|
])
|
2010-05-18 22:05:44 +00:00
|
|
|
|
2010-07-14 17:25:54 +00:00
|
|
|
AC_SUBST(DEBUG_CFLAGS)
|
2010-07-23 17:13:59 +00:00
|
|
|
AC_SUBST(DEBUG_STACKFLAGS)
|
2010-07-14 17:25:54 +00:00
|
|
|
AC_MSG_RESULT([$enable_debug])
|
2008-12-05 17:46:11 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN([ZFS_AC_CONFIG_SCRIPT], [
|
2009-08-18 04:35:06 +00:00
|
|
|
cat >.script-config <<EOF
|
|
|
|
KERNELSRC=${LINUX}
|
|
|
|
KERNELBUILD=${LINUX_OBJ}
|
|
|
|
KERNELSRCVER=${LINUX_VERSION}
|
|
|
|
KERNELMOD=/lib/modules/\${KERNELSRCVER}/kernel
|
|
|
|
|
|
|
|
SPLSRC=${SPL}
|
|
|
|
SPLBUILD=${SPL_OBJ}
|
|
|
|
SPLSRCVER=${SPL_VERSION}
|
|
|
|
|
|
|
|
TOPDIR=${TOPDIR}
|
|
|
|
BUILDDIR=${BUILDDIR}
|
|
|
|
LIBDIR=${LIBDIR}
|
|
|
|
CMDDIR=${CMDDIR}
|
|
|
|
MODDIR=${MODDIR}
|
|
|
|
SCRIPTDIR=${SCRIPTDIR}
|
2010-03-02 00:45:31 +00:00
|
|
|
ETCDIR=\${TOPDIR}/etc
|
2010-03-11 21:56:20 +00:00
|
|
|
DEVDIR=\${TOPDIR}/dev
|
2009-08-18 04:35:06 +00:00
|
|
|
ZPOOLDIR=\${TOPDIR}/scripts/zpool-config
|
|
|
|
|
|
|
|
ZDB=\${CMDDIR}/zdb/zdb
|
|
|
|
ZFS=\${CMDDIR}/zfs/zfs
|
|
|
|
ZINJECT=\${CMDDIR}/zinject/zinject
|
|
|
|
ZPOOL=\${CMDDIR}/zpool/zpool
|
2010-03-02 00:45:31 +00:00
|
|
|
ZPOOL_ID=\${CMDDIR}/zpool_id/zpool_id
|
2009-08-18 04:35:06 +00:00
|
|
|
ZTEST=\${CMDDIR}/ztest/ztest
|
|
|
|
|
|
|
|
COMMON_SH=\${SCRIPTDIR}/common.sh
|
|
|
|
ZFS_SH=\${SCRIPTDIR}/zfs.sh
|
|
|
|
ZPOOL_CREATE_SH=\${SCRIPTDIR}/zpool-create.sh
|
|
|
|
|
2010-03-11 21:56:20 +00:00
|
|
|
INTREE=1
|
2009-08-18 04:35:06 +00:00
|
|
|
LDMOD=/sbin/insmod
|
|
|
|
|
|
|
|
KERNEL_MODULES=( \\
|
|
|
|
\${KERNELMOD}/lib/zlib_deflate/zlib_deflate.ko \\
|
|
|
|
)
|
|
|
|
|
|
|
|
SPL_MODULES=( \\
|
|
|
|
\${SPLBUILD}/spl/spl.ko \\
|
2010-07-28 22:02:27 +00:00
|
|
|
\${SPLBUILD}/splat/splat.ko \\
|
2009-08-18 04:35:06 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
ZFS_MODULES=( \\
|
|
|
|
\${MODDIR}/avl/zavl.ko \\
|
|
|
|
\${MODDIR}/nvpair/znvpair.ko \\
|
|
|
|
\${MODDIR}/unicode/zunicode.ko \\
|
|
|
|
\${MODDIR}/zcommon/zcommon.ko \\
|
|
|
|
\${MODDIR}/zfs/zfs.ko \\
|
|
|
|
)
|
|
|
|
|
|
|
|
MODULES=( \\
|
|
|
|
\${KERNEL_MODULES[[*]]} \\
|
|
|
|
\${SPL_MODULES[[*]]} \\
|
|
|
|
\${ZFS_MODULES[[*]]} \\
|
|
|
|
)
|
|
|
|
EOF
|
2008-12-05 17:46:11 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN([ZFS_AC_CONFIG], [
|
2009-07-01 17:53:05 +00:00
|
|
|
TOPDIR=`readlink -f ${srcdir}`
|
2008-12-23 19:06:08 +00:00
|
|
|
BUILDDIR=$TOPDIR
|
|
|
|
LIBDIR=$TOPDIR/lib
|
|
|
|
CMDDIR=$TOPDIR/cmd
|
|
|
|
MODDIR=$TOPDIR/module
|
2009-08-18 04:35:06 +00:00
|
|
|
SCRIPTDIR=$TOPDIR/scripts
|
2009-11-24 22:13:25 +00:00
|
|
|
TARGET_ASM_DIR=asm-generic
|
2008-12-05 17:46:11 +00:00
|
|
|
|
|
|
|
AC_SUBST(TOPDIR)
|
|
|
|
AC_SUBST(BUILDDIR)
|
|
|
|
AC_SUBST(LIBDIR)
|
|
|
|
AC_SUBST(CMDDIR)
|
2008-12-23 19:06:08 +00:00
|
|
|
AC_SUBST(MODDIR)
|
2009-08-18 04:35:06 +00:00
|
|
|
AC_SUBST(SCRIPTDIR)
|
2009-11-24 22:13:25 +00:00
|
|
|
AC_SUBST(TARGET_ASM_DIR)
|
2008-12-05 17:46:11 +00:00
|
|
|
|
2009-07-01 17:53:05 +00:00
|
|
|
ZFS_CONFIG=all
|
|
|
|
AC_ARG_WITH([config],
|
2008-12-05 17:46:11 +00:00
|
|
|
AS_HELP_STRING([--with-config=CONFIG],
|
2009-11-24 22:13:25 +00:00
|
|
|
[Config file 'kernel|user|all|srpm']),
|
2009-03-10 18:10:50 +00:00
|
|
|
[ZFS_CONFIG="$withval"])
|
2008-12-05 17:46:11 +00:00
|
|
|
|
|
|
|
AC_MSG_CHECKING([zfs config])
|
2009-03-10 18:10:50 +00:00
|
|
|
AC_MSG_RESULT([$ZFS_CONFIG]);
|
2009-07-01 17:53:05 +00:00
|
|
|
AC_SUBST(ZFS_CONFIG)
|
2008-12-05 17:46:11 +00:00
|
|
|
|
2009-03-10 18:10:50 +00:00
|
|
|
case "$ZFS_CONFIG" in
|
2008-12-05 17:46:11 +00:00
|
|
|
kernel) ZFS_AC_CONFIG_KERNEL ;;
|
2008-12-15 18:28:14 +00:00
|
|
|
user) ZFS_AC_CONFIG_USER ;;
|
|
|
|
all) ZFS_AC_CONFIG_KERNEL
|
|
|
|
ZFS_AC_CONFIG_USER ;;
|
2009-11-24 22:13:25 +00:00
|
|
|
srpm) ;;
|
2008-12-05 17:46:11 +00:00
|
|
|
*)
|
|
|
|
AC_MSG_RESULT([Error!])
|
2009-03-10 18:10:50 +00:00
|
|
|
AC_MSG_ERROR([Bad value "$ZFS_CONFIG" for --with-config,
|
2009-11-24 22:13:25 +00:00
|
|
|
user kernel|user|all|srpm]) ;;
|
2008-12-05 17:46:11 +00:00
|
|
|
esac
|
|
|
|
|
2009-07-01 17:53:05 +00:00
|
|
|
AM_CONDITIONAL([CONFIG_USER],
|
|
|
|
[test "$ZFS_CONFIG" = user] ||
|
|
|
|
[test "$ZFS_CONFIG" = all])
|
|
|
|
AM_CONDITIONAL([CONFIG_KERNEL],
|
|
|
|
[test "$ZFS_CONFIG" = kernel] ||
|
|
|
|
[test "$ZFS_CONFIG" = all])
|
2008-12-05 17:46:11 +00:00
|
|
|
|
2009-07-01 17:53:05 +00:00
|
|
|
ZFS_AC_CONFIG_SCRIPT
|
2008-12-05 17:46:11 +00:00
|
|
|
])
|
2010-07-27 23:45:36 +00:00
|
|
|
|
|
|
|
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])
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([whether $RPMBUILD is available])
|
|
|
|
AS_IF([tmp=$($RPMBUILD --version 2>/dev/null)], [
|
|
|
|
RPMBUILD_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }')
|
|
|
|
HAVE_RPMBUILD=yes
|
|
|
|
AC_MSG_RESULT([$HAVE_RPMBUILD ($RPMBUILD_VERSION)])
|
|
|
|
],[
|
|
|
|
HAVE_RPMBUILD=no
|
|
|
|
AC_MSG_RESULT([$HAVE_RPMBUILD])
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_SUBST(HAVE_RPM)
|
|
|
|
AC_SUBST(RPM)
|
|
|
|
AC_SUBST(RPM_VERSION)
|
|
|
|
|
|
|
|
AC_SUBST(HAVE_RPMBUILD)
|
|
|
|
AC_SUBST(RPMBUILD)
|
|
|
|
AC_SUBST(RPMBUILD_VERSION)
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # Check for dpkg+dpkg-buildpackage to build DEB packages. If these
|
|
|
|
dnl # tools are missing it is non-fatal but you will not be able to build
|
|
|
|
dnl # DEB packages and will be warned if you try too.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_AC_DPKG], [
|
|
|
|
DPKG=dpkg
|
|
|
|
DPKGBUILD=dpkg-buildpackage
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([whether $DPKG is available])
|
|
|
|
AS_IF([tmp=$($DPKG --version 2>/dev/null)], [
|
|
|
|
DPKG_VERSION=$(echo $tmp | $AWK '/Debian/ { print $[7] }')
|
|
|
|
HAVE_DPKG=yes
|
|
|
|
AC_MSG_RESULT([$HAVE_DPKG ($DPKG_VERSION)])
|
|
|
|
],[
|
|
|
|
HAVE_DPKG=no
|
|
|
|
AC_MSG_RESULT([$HAVE_DPKG])
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([whether $DPKGBUILD is available])
|
|
|
|
AS_IF([tmp=$($DPKGBUILD --version 2>/dev/null)], [
|
|
|
|
DPKGBUILD_VERSION=$(echo $tmp | \
|
|
|
|
$AWK '/Debian/ { print $[4] }' | cut -f-4 -d'.')
|
|
|
|
HAVE_DPKGBUILD=yes
|
|
|
|
AC_MSG_RESULT([$HAVE_DPKGBUILD ($DPKGBUILD_VERSION)])
|
|
|
|
],[
|
|
|
|
HAVE_DPKGBUILD=no
|
|
|
|
AC_MSG_RESULT([$HAVE_DPKGBUILD])
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_SUBST(HAVE_DPKG)
|
|
|
|
AC_SUBST(DPKG)
|
|
|
|
AC_SUBST(DPKG_VERSION)
|
|
|
|
|
|
|
|
AC_SUBST(HAVE_DPKGBUILD)
|
|
|
|
AC_SUBST(DPKGBUILD)
|
|
|
|
AC_SUBST(DPKGBUILD_VERSION)
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # Until native packaging for various different packing systems
|
|
|
|
dnl # can be added the least we can do is attempt to use alien to
|
|
|
|
dnl # convert the RPM packages to the needed package type. This is
|
|
|
|
dnl # a hack but so far it has worked reasonable well.
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_AC_ALIEN], [
|
|
|
|
ALIEN=alien
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([whether $ALIEN is available])
|
|
|
|
AS_IF([tmp=$($ALIEN --version 2>/dev/null)], [
|
|
|
|
ALIEN_VERSION=$(echo $tmp | $AWK '{ print $[3] }')
|
|
|
|
HAVE_ALIEN=yes
|
|
|
|
AC_MSG_RESULT([$HAVE_ALIEN ($ALIEN_VERSION)])
|
|
|
|
],[
|
|
|
|
HAVE_ALIEN=no
|
|
|
|
AC_MSG_RESULT([$HAVE_ALIEN])
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_SUBST(HAVE_ALIEN)
|
|
|
|
AC_SUBST(ALIEN)
|
|
|
|
AC_SUBST(ALIEN_VERSION)
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # Using the VENDOR tag from config.guess set the default
|
|
|
|
dnl # package type for 'make pkg': (rpm | deb | tgz)
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [
|
|
|
|
VENDOR=$(echo $ac_build_alias | cut -f2 -d'-')
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([default package type])
|
|
|
|
case "$VENDOR" in
|
|
|
|
fedora) DEFAULT_PACKAGE=rpm ;;
|
|
|
|
redhat) DEFAULT_PACKAGE=rpm ;;
|
|
|
|
sles) DEFAULT_PACKAGE=rpm ;;
|
|
|
|
ubuntu) DEFAULT_PACKAGE=deb ;;
|
|
|
|
debian) DEFAULT_PACKAGE=deb ;;
|
|
|
|
slackware) DEFAULT_PACKAGE=tgz ;;
|
|
|
|
*) DEFAULT_PACKAGE=rpm ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
AC_MSG_RESULT([$DEFAULT_PACKAGE])
|
|
|
|
AC_SUBST(DEFAULT_PACKAGE)
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl #
|
|
|
|
dnl # Default ZFS package configuration
|
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_AC_PACKAGE], [
|
|
|
|
ZFS_AC_RPM
|
|
|
|
ZFS_AC_DPKG
|
|
|
|
ZFS_AC_ALIEN
|
|
|
|
ZFS_AC_DEFAULT_PACKAGE
|
|
|
|
])
|