zfs/config/zfs-build.m4

156 lines
4.0 KiB
Plaintext
Raw Normal View History

2008-12-05 17:46:11 +00:00
AC_DEFUN([ZFS_AC_LICENSE], [
AC_MSG_CHECKING([zfs author])
AC_MSG_RESULT([$ZFS_META_AUTHOR])
AC_MSG_CHECKING([zfs license])
AC_MSG_RESULT([$ZFS_META_LICENSE])
2008-12-05 17:46:11 +00:00
])
AC_DEFUN([ZFS_AC_DEBUG], [
AC_MSG_CHECKING([whether debugging is enabled])
AC_ARG_ENABLE( [debug],
AS_HELP_STRING([--enable-debug],
[Enable generic debug support (default off)]),
[ case "$enableval" in
yes) zfs_ac_debug=yes ;;
no) zfs_ac_debug=no ;;
*) AC_MSG_RESULT([Error!])
AC_MSG_ERROR([Bad value "$enableval" for --enable-debug]) ;;
esac ]
)
if test "$zfs_ac_debug" = yes; then
AC_MSG_RESULT([yes])
AC_DEFINE([DEBUG], [1],
[Define to 1 to enable debug tracing])
KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG "
2008-12-05 17:46:11 +00:00
HOSTCFLAGS="${HOSTCFLAGS} -DDEBUG "
USERDEBUG="-DDEBUG -fstack-check"
else
AC_MSG_RESULT([no])
AC_DEFINE([NDEBUG], [1],
[Define to 1 to disable debug tracing])
KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG "
2008-12-05 17:46:11 +00:00
HOSTCFLAGS="${HOSTCFLAGS} -DNDEBUG "
USERDEBUG="-DNDEBUG"
fi
AC_SUBST(USERDEBUG)
2008-12-05 17:46:11 +00:00
])
AC_DEFUN([ZFS_AC_CONFIG_SCRIPT], [
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}
ETCDIR=\${TOPDIR}/etc
DEVDIR=\${TOPDIR}/dev
ZPOOLDIR=\${TOPDIR}/scripts/zpool-config
ZPIOSDIR=\${TOPDIR}/scripts/zpios-test
ZPIOSPROFILEDIR=\${TOPDIR}/scripts/zpios-profile
ZDB=\${CMDDIR}/zdb/zdb
ZFS=\${CMDDIR}/zfs/zfs
ZINJECT=\${CMDDIR}/zinject/zinject
ZPOOL=\${CMDDIR}/zpool/zpool
ZPOOL_ID=\${CMDDIR}/zpool_id/zpool_id
ZTEST=\${CMDDIR}/ztest/ztest
ZPIOS=\${CMDDIR}/zpios/zpios
COMMON_SH=\${SCRIPTDIR}/common.sh
ZFS_SH=\${SCRIPTDIR}/zfs.sh
ZPOOL_CREATE_SH=\${SCRIPTDIR}/zpool-create.sh
ZPIOS_SH=\${SCRIPTDIR}/zpios.sh
ZPIOS_SURVEY_SH=\${SCRIPTDIR}/zpios-survey.sh
INTREE=1
LDMOD=/sbin/insmod
KERNEL_MODULES=( \\
\${KERNELMOD}/lib/zlib_deflate/zlib_deflate.ko \\
)
SPL_MODULES=( \\
\${SPLBUILD}/spl/spl.ko \\
)
ZFS_MODULES=( \\
\${MODDIR}/avl/zavl.ko \\
\${MODDIR}/nvpair/znvpair.ko \\
\${MODDIR}/unicode/zunicode.ko \\
\${MODDIR}/zcommon/zcommon.ko \\
\${MODDIR}/zfs/zfs.ko \\
)
ZPIOS_MODULES=( \\
\${MODDIR}/zpios/zpios.ko \\
)
MODULES=( \\
\${KERNEL_MODULES[[*]]} \\
\${SPL_MODULES[[*]]} \\
\${ZFS_MODULES[[*]]} \\
)
EOF
2008-12-05 17:46:11 +00:00
])
AC_DEFUN([ZFS_AC_CONFIG], [
TOPDIR=`readlink -f ${srcdir}`
2008-12-23 19:06:08 +00:00
BUILDDIR=$TOPDIR
LIBDIR=$TOPDIR/lib
CMDDIR=$TOPDIR/cmd
MODDIR=$TOPDIR/module
SCRIPTDIR=$TOPDIR/scripts
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)
AC_SUBST(SCRIPTDIR)
AC_SUBST(TARGET_ASM_DIR)
2008-12-05 17:46:11 +00:00
ZFS_CONFIG=all
AC_ARG_WITH([config],
2008-12-05 17:46:11 +00:00
AS_HELP_STRING([--with-config=CONFIG],
[Config file 'kernel|user|all|srpm']),
[ZFS_CONFIG="$withval"])
2008-12-05 17:46:11 +00:00
AC_MSG_CHECKING([zfs config])
AC_MSG_RESULT([$ZFS_CONFIG]);
AC_SUBST(ZFS_CONFIG)
2008-12-05 17:46:11 +00:00
case "$ZFS_CONFIG" in
2008-12-05 17:46:11 +00:00
kernel) ZFS_AC_CONFIG_KERNEL ;;
user) ZFS_AC_CONFIG_USER ;;
all) ZFS_AC_CONFIG_KERNEL
ZFS_AC_CONFIG_USER ;;
srpm) ;;
2008-12-05 17:46:11 +00:00
*)
AC_MSG_RESULT([Error!])
AC_MSG_ERROR([Bad value "$ZFS_CONFIG" for --with-config,
user kernel|user|all|srpm]) ;;
2008-12-05 17:46:11 +00:00
esac
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
ZFS_AC_CONFIG_SCRIPT
2008-12-05 17:46:11 +00:00
])