mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Add build system
Add autoconf style build infrastructure to the ZFS tree. This includes autogen.sh, configure.ac, m4 macros, some scripts/*, and makefiles for all the core ZFS components.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
EXTRA_DIST = *.m4 Rules.am
|
||||
@@ -0,0 +1,7 @@
|
||||
DEFAULT_INCLUDES = -include ${top_srcdir}/zfs_config.h
|
||||
|
||||
AM_LIBTOOLFLAGS = --silent
|
||||
AM_CFLAGS = -Wall -Wstrict-prototypes -fno-strict-aliasing ${DEBUG_CFLAGS}
|
||||
AM_CFLAGS += -D_GNU_SOURCE -D__EXTENSIONS__ -D_REENTRANT
|
||||
AM_CFLAGS += -D_POSIX_PTHREAD_SEMANTICS -D_FILE_OFFSET_BITS=64
|
||||
AM_CFLAGS += -D_LARGEFILE64_SOURCE -DTEXT_DOMAIN=\"zfs-linux-user\"
|
||||
@@ -0,0 +1,15 @@
|
||||
# Remove default preprocessor define's from config.h
|
||||
# PACKAGE
|
||||
# PACKAGE_BUGREPORT
|
||||
# PACKAGE_NAME
|
||||
# PACKAGE_STRING
|
||||
# PACKAGE_TARNAME
|
||||
# PACKAGE_VERSION
|
||||
# STDC_HEADERS
|
||||
# VERSION
|
||||
|
||||
BEGIN { RS = "" ; FS = "\n" } \
|
||||
!/.#define PACKAGE./ && \
|
||||
!/.#define VERSION./ && \
|
||||
!/.#define STDC_HEADERS./ \
|
||||
{ print $0"\n" }
|
||||
@@ -0,0 +1,37 @@
|
||||
deb-local:
|
||||
@(if test "${HAVE_DPKGBUILD}" = "no"; then \
|
||||
echo -e "\n" \
|
||||
"*** Required util ${DPKGBUILD} missing. Please install the\n" \
|
||||
"*** package for your distribution which provides ${DPKGBUILD},\n" \
|
||||
"*** re-run configure, and try again.\n"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
if test "${HAVE_ALIEN}" = "no"; then \
|
||||
echo -e "\n" \
|
||||
"*** Required util ${ALIEN} missing. Please install the\n" \
|
||||
"*** package for your distribution which provides ${ALIEN},\n" \
|
||||
"*** re-run configure, and try again.\n"; \
|
||||
exit 1; \
|
||||
fi)
|
||||
|
||||
deb-modules: deb-local rpm-modules
|
||||
name=${PACKAGE}-modules; \
|
||||
version=${ZFS_META_VERSION}-${ZFS_META_RELEASE}; \
|
||||
release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \
|
||||
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch}`; \
|
||||
pkg1=$${name}-$${version}_$${release}.$${arch}.rpm; \
|
||||
pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \
|
||||
fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2; \
|
||||
$(RM) $$pkg1 $$pkg2
|
||||
|
||||
deb-utils: deb-local rpm-utils
|
||||
name=${PACKAGE}; \
|
||||
version=${ZFS_META_VERSION}-${ZFS_META_RELEASE}; \
|
||||
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch}`; \
|
||||
pkg1=$${name}-$${version}.$${arch}.rpm; \
|
||||
pkg2=$${name}-devel-$${version}.$${arch}.rpm; \
|
||||
pkg3=$${name}-test-$${version}.$${arch}.rpm; \
|
||||
fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2 $$pkg3; \
|
||||
$(RM) $$pkg1 $$pkg2 $$pkg3
|
||||
|
||||
deb: deb-modules deb-utils
|
||||
@@ -0,0 +1,33 @@
|
||||
dnl #
|
||||
dnl # 2.6.x API change
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BDEV_BLOCK_DEVICE_OPERATIONS], [
|
||||
AC_MSG_CHECKING([block device operation prototypes])
|
||||
ZFS_LINUX_TRY_COMPILE([
|
||||
#include <linux/blkdev.h>
|
||||
],[
|
||||
int (*blk_open) (struct block_device *, fmode_t) = NULL;
|
||||
int (*blk_release) (struct gendisk *, fmode_t) = NULL;
|
||||
int (*blk_ioctl) (struct block_device *, fmode_t,
|
||||
unsigned, unsigned long) = NULL;
|
||||
int (*blk_compat_ioctl) (struct block_device *, fmode_t,
|
||||
unsigned, unsigned long) = NULL;
|
||||
struct block_device_operations blk_ops = {
|
||||
.open = blk_open,
|
||||
.release = blk_release,
|
||||
.ioctl = blk_ioctl,
|
||||
.compat_ioctl = blk_compat_ioctl,
|
||||
};
|
||||
|
||||
blk_ops.open(NULL, 0);
|
||||
blk_ops.release(NULL, 0);
|
||||
blk_ops.ioctl(NULL, 0, 0, 0);
|
||||
blk_ops.compat_ioctl(NULL, 0, 0, 0);
|
||||
],[
|
||||
AC_MSG_RESULT(struct block_device)
|
||||
AC_DEFINE(HAVE_BDEV_BLOCK_DEVICE_OPERATIONS, 1,
|
||||
[struct block_device_operations use bdevs])
|
||||
],[
|
||||
AC_MSG_RESULT(struct inode)
|
||||
])
|
||||
])
|
||||
@@ -0,0 +1,22 @@
|
||||
dnl #
|
||||
dnl # 2.6.30 API change
|
||||
dnl # bdev_hardsect_size() replaced with bdev_logical_block_size(). While
|
||||
dnl # it has been true for a while that there was no strict 1:1 mapping
|
||||
dnl # between physical sector size and logical block size this change makes
|
||||
dnl # it explicit.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BDEV_LOGICAL_BLOCK_SIZE], [
|
||||
AC_MSG_CHECKING([whether bdev_logical_block_size() is available])
|
||||
ZFS_LINUX_TRY_COMPILE([
|
||||
#include <linux/blkdev.h>
|
||||
],[
|
||||
struct block_device *bdev = NULL;
|
||||
bdev_logical_block_size(bdev);
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_BDEV_LOGICAL_BLOCK_SIZE, 1,
|
||||
[bdev_logical_block_size() is available])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
@@ -0,0 +1,20 @@
|
||||
dnl #
|
||||
dnl # 2.6.24 API change
|
||||
dnl # Empty write barriers are now supported and we should use them.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BIO_EMPTY_BARRIER], [
|
||||
AC_MSG_CHECKING([whether bio_empty_barrier() is defined])
|
||||
EXTRA_KCFLAGS="-Werror"
|
||||
ZFS_LINUX_TRY_COMPILE([
|
||||
#include <linux/bio.h>
|
||||
],[
|
||||
struct bio bio;
|
||||
(void)bio_empty_barrier(&bio);
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_BIO_EMPTY_BARRIER, 1,
|
||||
[bio_empy_barrier() is defined])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
@@ -0,0 +1,29 @@
|
||||
dnl #
|
||||
dnl # 2.6.24 API change
|
||||
dnl # Size argument dropped from bio_endio and bi_end_io, because the
|
||||
dnl # bi_end_io is only called once now when the request is complete.
|
||||
dnl # There is no longer any need for a size argument. This also means
|
||||
dnl # that partial IO's are no longer possibe and the end_io callback
|
||||
dnl # should not check bi->bi_size. Finally, the return type was updated
|
||||
dnl # to void.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BIO_END_IO_T_ARGS], [
|
||||
AC_MSG_CHECKING([whether bio_end_io_t wants 2 args])
|
||||
tmp_flags="$EXTRA_KCFLAGS"
|
||||
EXTRA_KCFLAGS="-Werror"
|
||||
ZFS_LINUX_TRY_COMPILE([
|
||||
#include <linux/bio.h>
|
||||
],[
|
||||
void (*wanted_end_io)(struct bio *, int) = NULL;
|
||||
bio_end_io_t *local_end_io;
|
||||
|
||||
local_end_io = wanted_end_io;
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_2ARGS_BIO_END_IO_T, 1,
|
||||
[bio_end_io_t wants 2 args])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
EXTRA_KCFLAGS="$tmp_flags"
|
||||
])
|
||||
@@ -0,0 +1,19 @@
|
||||
dnl #
|
||||
dnl # 2.6.29 API change
|
||||
dnl # BIO_RW_SYNC renamed to BIO_RW_SYNCIO
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BIO_RW_SYNCIO], [
|
||||
AC_MSG_CHECKING([whether BIO_RW_SYNCIO is defined])
|
||||
ZFS_LINUX_TRY_COMPILE([
|
||||
#include <linux/bio.h>
|
||||
],[
|
||||
int flags;
|
||||
flags = BIO_RW_SYNCIO;
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_BIO_RW_SYNCIO, 1,
|
||||
[BIO_RW_SYNCIO is defined])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
@@ -0,0 +1,37 @@
|
||||
dnl #
|
||||
dnl # 2.6.31 API change
|
||||
dnl # In 2.6.29 kernels blk_end_request() was a GPL-only symbol, this was
|
||||
dnl # changed in 2.6.31 so it may be used by non-GPL modules.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BLK_END_REQUEST], [
|
||||
AC_MSG_CHECKING([whether blk_end_request() is available])
|
||||
ZFS_LINUX_TRY_COMPILE([
|
||||
#include <linux/blkdev.h>
|
||||
],[
|
||||
struct request *req = NULL;
|
||||
(void) blk_end_request(req, 0, 0);
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_BLK_END_REQUEST, 1,
|
||||
[blk_end_request() is available])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([whether blk_end_request() is GPL-only])
|
||||
ZFS_LINUX_TRY_COMPILE([
|
||||
#include <linux/module.h>
|
||||
#include <linux/blkdev.h>
|
||||
|
||||
MODULE_LICENSE("CDDL");
|
||||
],[
|
||||
struct request *req = NULL;
|
||||
(void) blk_end_request(req, 0, 0);
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_BLK_END_REQUEST_GPL_ONLY, 1,
|
||||
[blk_end_request() is GPL-only])
|
||||
])
|
||||
])
|
||||
@@ -0,0 +1,22 @@
|
||||
dnl #
|
||||
dnl # 2.6.31 API change
|
||||
dnl # Request queue peek/retrieval interface cleanup, the blk_fetch_request()
|
||||
dnl # function replaces the elv_next_request() and blk_fetch_request()
|
||||
dnl # functions. The updated blk_fetch_request() function returns the
|
||||
dnl # next available request and removed it from the request queue.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BLK_FETCH_REQUEST], [
|
||||
AC_MSG_CHECKING([whether blk_fetch_request() is available])
|
||||
ZFS_LINUX_TRY_COMPILE([
|
||||
#include <linux/blkdev.h>
|
||||
],[
|
||||
struct request_queue *q = NULL;
|
||||
(void) blk_fetch_request(q);
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_BLK_FETCH_REQUEST, 1,
|
||||
[blk_fetch_request() is available])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
@@ -0,0 +1,22 @@
|
||||
dnl #
|
||||
dnl # 2.6.31 API change
|
||||
dnl # Request queue peek/retrieval interface cleanup, the
|
||||
dnl # elv_requeue_request() function has been replaced with the
|
||||
dnl # blk_requeue_request() function.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BLK_REQUEUE_REQUEST], [
|
||||
AC_MSG_CHECKING([whether blk_requeue_request() is available])
|
||||
ZFS_LINUX_TRY_COMPILE([
|
||||
#include <linux/blkdev.h>
|
||||
],[
|
||||
struct request_queue *q = NULL;
|
||||
struct request *req = NULL;
|
||||
blk_requeue_request(q, req);
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_BLK_REQUEUE_REQUEST, 1,
|
||||
[blk_requeue_request() is available])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
@@ -0,0 +1,38 @@
|
||||
dnl #
|
||||
dnl # 2.6.29 API change
|
||||
dnl # In the 2.6.29 kernel blk_rq_bytes() was available as a GPL-only symbol.
|
||||
dnl # So we need to check the symbol license as well. As of 2.6.31 the
|
||||
dnl blk_rq_bytes() helper was changed to a static inline which we can use.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BLK_RQ_BYTES], [
|
||||
AC_MSG_CHECKING([whether blk_rq_bytes() is available])
|
||||
ZFS_LINUX_TRY_COMPILE([
|
||||
#include <linux/blkdev.h>
|
||||
],[
|
||||
struct request *req = NULL;
|
||||
(void) blk_rq_bytes(req);
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_BLK_RQ_BYTES, 1,
|
||||
[blk_rq_bytes() is available])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([whether blk_rq_bytes() is GPL-only])
|
||||
ZFS_LINUX_TRY_COMPILE([
|
||||
#include <linux/module.h>
|
||||
#include <linux/blkdev.h>
|
||||
|
||||
MODULE_LICENSE("CDDL");
|
||||
],[
|
||||
struct request *req = NULL;
|
||||
(void) blk_rq_bytes(req);
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_BLK_RQ_BYTES_GPL_ONLY, 1,
|
||||
[blk_rq_bytes() is GPL-only])
|
||||
])
|
||||
])
|
||||
@@ -0,0 +1,18 @@
|
||||
dnl #
|
||||
dnl # 2.6.31 API change
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BLK_RQ_POS], [
|
||||
AC_MSG_CHECKING([whether blk_rq_pos() is available])
|
||||
ZFS_LINUX_TRY_COMPILE([
|
||||
#include <linux/blkdev.h>
|
||||
],[
|
||||
struct request *req = NULL;
|
||||
(void) blk_rq_pos(req);
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_BLK_RQ_POS, 1,
|
||||
[blk_rq_pos() is available])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
@@ -0,0 +1,18 @@
|
||||
dnl #
|
||||
dnl # 2.6.31 API change
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BLK_RQ_SECTORS], [
|
||||
AC_MSG_CHECKING([whether blk_rq_sectors() is available])
|
||||
ZFS_LINUX_TRY_COMPILE([
|
||||
#include <linux/blkdev.h>
|
||||
],[
|
||||
struct request *req = NULL;
|
||||
(void) blk_rq_sectors(req);
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_BLK_RQ_SECTORS, 1,
|
||||
[blk_rq_sectors() is available])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
@@ -0,0 +1,18 @@
|
||||
dnl #
|
||||
dnl # 2.6.28 API change,
|
||||
dnl # check if fmode_t typedef is defined
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_TYPE_FMODE_T],
|
||||
[AC_MSG_CHECKING([whether kernel defines fmode_t])
|
||||
ZFS_LINUX_TRY_COMPILE([
|
||||
#include <linux/types.h>
|
||||
],[
|
||||
fmode_t *ptr;
|
||||
],[
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(HAVE_FMODE_T, 1,
|
||||
[kernel defines fmode_t])
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
])
|
||||
@@ -0,0 +1,18 @@
|
||||
dnl #
|
||||
dnl # 2.6.x API change
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_GET_DISK_RO], [
|
||||
AC_MSG_CHECKING([whether get_disk_ro() is available])
|
||||
ZFS_LINUX_TRY_COMPILE([
|
||||
#include <linux/blkdev.h>
|
||||
],[
|
||||
struct gendisk *disk = NULL;
|
||||
(void) get_disk_ro(disk);
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_GET_DISK_RO, 1,
|
||||
[blk_disk_ro() is available])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
@@ -0,0 +1,19 @@
|
||||
dnl #
|
||||
dnl # 2.6.22 API change
|
||||
dnl # Unused destroy_dirty_buffers arg removed from prototype.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_INVALIDATE_BDEV_ARGS], [
|
||||
AC_MSG_CHECKING([whether invalidate_bdev() wants 1 arg])
|
||||
ZFS_LINUX_TRY_COMPILE([
|
||||
#include <linux/buffer_head.h>
|
||||
],[
|
||||
struct block_device *bdev;
|
||||
invalidate_bdev(bdev);
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_1ARG_INVALIDATE_BDEV, 1,
|
||||
[invalidate_bdev() wants 1 arg])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
@@ -0,0 +1,21 @@
|
||||
dnl #
|
||||
dnl # 2.6.27 API change,
|
||||
dnl # kobject KOBJ_NAME_LEN static limit removed. All users of this
|
||||
dnl # constant were removed prior to 2.6.27, but to be on the safe
|
||||
dnl # side this check ensures the constant is undefined.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_KOBJ_NAME_LEN], [
|
||||
AC_MSG_CHECKING([whether kernel defines KOBJ_NAME_LEN])
|
||||
ZFS_LINUX_TRY_COMPILE([
|
||||
#include <linux/kobject.h>
|
||||
],[
|
||||
int val;
|
||||
val = KOBJ_NAME_LEN;
|
||||
],[
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(HAVE_KOBJ_NAME_LEN, 1,
|
||||
[kernel defines KOBJ_NAME_LEN])
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
])
|
||||
@@ -0,0 +1,12 @@
|
||||
dnl #
|
||||
dnl # 2.6.28 API change
|
||||
dnl # open/close_bdev_excl() renamed to open/close_bdev_exclusive()
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_OPEN_BDEV_EXCLUSIVE], [
|
||||
ZFS_CHECK_SYMBOL_EXPORT(
|
||||
[open_bdev_exclusive],
|
||||
[fs/block_dev.c],
|
||||
[AC_DEFINE(HAVE_OPEN_BDEV_EXCLUSIVE, 1,
|
||||
[open_bdev_exclusive() is available])],
|
||||
[])
|
||||
])
|
||||
@@ -0,0 +1,20 @@
|
||||
dnl #
|
||||
dnl # 2.6.x API change
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_RQ_FOR_EACH_SEGMENT], [
|
||||
AC_MSG_CHECKING([whether rq_for_each_segment() is available])
|
||||
ZFS_LINUX_TRY_COMPILE([
|
||||
#include <linux/blkdev.h>
|
||||
],[
|
||||
struct bio_vec *bv;
|
||||
struct req_iterator iter;
|
||||
struct request *req = NULL;
|
||||
rq_for_each_segment(bv, req, iter) { }
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_RQ_FOR_EACH_SEGMENT, 1,
|
||||
[rq_for_each_segment() is available])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
@@ -0,0 +1,18 @@
|
||||
dnl #
|
||||
dnl # 2.6.x API change
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_RQ_IS_SYNC], [
|
||||
AC_MSG_CHECKING([whether rq_is_sync() is available])
|
||||
ZFS_LINUX_TRY_COMPILE([
|
||||
#include <linux/blkdev.h>
|
||||
],[
|
||||
struct request *req = NULL;
|
||||
(void) rq_is_sync(req);
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_RQ_IS_SYNC, 1,
|
||||
[rq_is_sync() is available])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
@@ -0,0 +1,390 @@
|
||||
dnl #
|
||||
dnl # Default ZFS kernel configuration
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
|
||||
ZFS_AC_KERNEL
|
||||
ZFS_AC_SPL
|
||||
ZFS_AC_KERNEL_CONFIG
|
||||
ZFS_AC_KERNEL_BDEV_BLOCK_DEVICE_OPERATIONS
|
||||
ZFS_AC_KERNEL_TYPE_FMODE_T
|
||||
ZFS_AC_KERNEL_KOBJ_NAME_LEN
|
||||
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
|
||||
ZFS_AC_KERNEL_BIO_END_IO_T_ARGS
|
||||
ZFS_AC_KERNEL_BIO_RW_SYNCIO
|
||||
ZFS_AC_KERNEL_BLK_END_REQUEST
|
||||
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
|
||||
ZFS_AC_KERNEL_RQ_IS_SYNC
|
||||
ZFS_AC_KERNEL_RQ_FOR_EACH_SEGMENT
|
||||
|
||||
dnl # -Wall -fno-strict-aliasing -Wstrict-prototypes and other
|
||||
dnl # compiler options are added by the kernel build system.
|
||||
KERNELCPPFLAGS="$KERNELCPPFLAGS -DHAVE_SPL -D_KERNEL"
|
||||
KERNELCPPFLAGS="$KERNELCPPFLAGS -DTEXT_DOMAIN=\\\"zfs-linux-kernel\\\""
|
||||
KERNELCPPFLAGS="$KERNELCPPFLAGS -I$SPL"
|
||||
KERNELCPPFLAGS="$KERNELCPPFLAGS -I$SPL/include"
|
||||
KERNELCPPFLAGS="$KERNELCPPFLAGS -include $SPL/spl_config.h"
|
||||
KERNELCPPFLAGS="$KERNELCPPFLAGS -include $TOPDIR/zfs_config.h"
|
||||
|
||||
if test "$LINUX_OBJ" != "$LINUX"; then
|
||||
KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
|
||||
fi
|
||||
|
||||
AC_SUBST(KERNELMAKE_PARAMS)
|
||||
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])
|
||||
if test -f "$modpost"; then
|
||||
if grep -q Modules.symvers $modpost; then
|
||||
LINUX_SYMBOLS=Modules.symvers
|
||||
else
|
||||
LINUX_SYMBOLS=Module.symvers
|
||||
fi
|
||||
else
|
||||
LINUX_SYMBOLS=NONE
|
||||
fi
|
||||
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])
|
||||
if test -z "$kernelsrc"; then
|
||||
headersdir="/lib/modules/$(uname -r)/build"
|
||||
if test -e "$headersdir"; then
|
||||
sourcelink=$(readlink -f "$headersdir")
|
||||
else
|
||||
sourcelink=$(ls -1d /usr/src/kernels/* \
|
||||
/usr/src/linux-* \
|
||||
2>/dev/null | grep -v obj | tail -1)
|
||||
fi
|
||||
|
||||
if test -n "$sourcelink" && test -e ${sourcelink}; then
|
||||
kernelsrc=`readlink -f ${sourcelink}`
|
||||
else
|
||||
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.])
|
||||
fi
|
||||
else
|
||||
if test "$kernelsrc" = "NONE"; then
|
||||
kernsrcver=NONE
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_MSG_RESULT([$kernelsrc])
|
||||
AC_MSG_CHECKING([kernel build directory])
|
||||
if test -z "$kernelbuild"; then
|
||||
if test -d ${kernelsrc}-obj/${target_cpu}/${target_cpu}; then
|
||||
kernelbuild=${kernelsrc}-obj/${target_cpu}/${target_cpu}
|
||||
elif test -d ${kernelsrc}-obj/${target_cpu}/default; then
|
||||
kernelbuild=${kernelsrc}-obj/${target_cpu}/default
|
||||
elif test -d `dirname ${kernelsrc}`/build-${target_cpu}; then
|
||||
kernelbuild=`dirname ${kernelsrc}`/build-${target_cpu}
|
||||
else
|
||||
kernelbuild=${kernelsrc}
|
||||
fi
|
||||
fi
|
||||
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
|
||||
if test -r $utsrelease1 && fgrep -q UTS_RELEASE $utsrelease1; then
|
||||
utsrelease=linux/version.h
|
||||
elif test -r $utsrelease2 && fgrep -q UTS_RELEASE $utsrelease2; then
|
||||
utsrelease=linux/utsrelease.h
|
||||
elif test -r $utsrelease3 && fgrep -q UTS_RELEASE $utsrelease3; then
|
||||
utsrelease=generated/utsrelease.h
|
||||
fi
|
||||
|
||||
if test "$utsrelease"; then
|
||||
kernsrcver=`(echo "#include <$utsrelease>";
|
||||
echo "kernsrcver=UTS_RELEASE") |
|
||||
cpp -I $kernelbuild/include |
|
||||
grep "^kernsrcver=" | cut -d \" -f 2`
|
||||
|
||||
if test -z "$kernsrcver"; then
|
||||
AC_MSG_RESULT([Not found])
|
||||
AC_MSG_ERROR([*** Cannot determine kernel version.])
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([Not found])
|
||||
AC_MSG_ERROR([*** Cannot find UTS_RELEASE definition.])
|
||||
fi
|
||||
|
||||
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
|
||||
dnl # but not built. To allow recursive builds a good guess is made as to
|
||||
dnl # what this file will be named based on what it is named in the kernel
|
||||
dnl # build products. This file will first be used at link time so if
|
||||
dnl # the guess is wrong the build will fail then. This unfortunately
|
||||
dnl # means the ZFS package does not contain a reliable mechanism to
|
||||
dnl # detect symbols exported by the SPL at configure time.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_SPL_MODULE_SYMVERS], [
|
||||
AC_MSG_CHECKING([spl file name for module symbols])
|
||||
if test -r $SPL_OBJ/Module.symvers; then
|
||||
SPL_SYMBOLS=Module.symvers
|
||||
elif test -r $SPL_OBJ/Modules.symvers; then
|
||||
SPL_SYMBOLS=Modules.symvers
|
||||
else
|
||||
SPL_SYMBOLS=$LINUX_SYMBOLS
|
||||
fi
|
||||
|
||||
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])
|
||||
if test -z "$splsrc"; then
|
||||
sourcelink=`ls -1d /usr/src/spl-*/${LINUX_VERSION} \
|
||||
2>/dev/null | tail -1`
|
||||
|
||||
if test -z "$sourcelink" || test ! -e $sourcelink; then
|
||||
sourcelink=../spl
|
||||
fi
|
||||
|
||||
if test -e $sourcelink; then
|
||||
splsrc=`readlink -f ${sourcelink}`
|
||||
else
|
||||
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.])
|
||||
fi
|
||||
else
|
||||
if test "$splsrc" = "NONE"; then
|
||||
splbuild=NONE
|
||||
splsrcver=NONE
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_MSG_RESULT([$splsrc])
|
||||
AC_MSG_CHECKING([spl build directory])
|
||||
if test -z "$splbuild"; then
|
||||
if test -d ${splsrc}/module; then
|
||||
splbuild=${splsrc}/module
|
||||
else
|
||||
splbuild=${splsrc}
|
||||
fi
|
||||
fi
|
||||
AC_MSG_RESULT([$splbuild])
|
||||
|
||||
AC_MSG_CHECKING([spl source version])
|
||||
if test -r $splsrc/spl_config.h &&
|
||||
fgrep -q SPL_META_VERSION $splsrc/spl_config.h; then
|
||||
|
||||
splsrcver=`(echo "#include <spl_config.h>";
|
||||
echo "splsrcver=SPL_META_VERSION") |
|
||||
cpp -I $splsrc |
|
||||
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])
|
||||
|
||||
SPL=${splsrc}
|
||||
SPL_OBJ=${splbuild}
|
||||
SPL_VERSION=${splsrcver}
|
||||
|
||||
AC_SUBST(SPL)
|
||||
AC_SUBST(SPL_OBJ)
|
||||
AC_SUBST(SPL_VERSION)
|
||||
|
||||
ZFS_AC_SPL_MODULE_SYMVERS
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # There are certain kernel build options which when enabled are
|
||||
dnl # completely incompatible with non GPL kernel modules. It is best
|
||||
dnl # to detect these at configure time and fail with a clear error
|
||||
dnl # rather than build everything and fail during linking.
|
||||
dnl #
|
||||
dnl # CONFIG_DEBUG_LOCK_ALLOC - Maps mutex_lock() to mutex_lock_nested()
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_CONFIG], [
|
||||
|
||||
if test "$ZFS_META_LICENSE" = CDDL; then
|
||||
ZFS_LINUX_CONFIG([DEBUG_LOCK_ALLOC],
|
||||
AC_MSG_ERROR([
|
||||
*** Kernel built with CONFIG_DEBUG_LOCK_ALLOC which is
|
||||
*** incompatible with the CDDL license. You must rebuild
|
||||
*** your kernel without this option.]), [])
|
||||
fi
|
||||
|
||||
if test "$ZFS_META_LICENSE" = GPL; then
|
||||
AC_DEFINE([HAVE_GPL_ONLY_SYMBOLS], [1],
|
||||
[Define to 1 if licensed under the GPL])
|
||||
fi
|
||||
])
|
||||
|
||||
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])])
|
||||
rm -Rf build && mkdir -p build
|
||||
echo "obj-m := conftest.o" >build/Makefile
|
||||
AS_IF(
|
||||
[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) >/dev/null && AC_TRY_COMMAND([$3])],
|
||||
[$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([
|
||||
#ifndef AUTOCONF_INCLUDED
|
||||
#include <linux/config.h>
|
||||
#endif
|
||||
],[
|
||||
#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 #
|
||||
AC_DEFUN([ZFS_CHECK_SYMBOL_EXPORT],
|
||||
[AC_MSG_CHECKING([whether symbol $1 is exported])
|
||||
grep -q -E '[[[:space:]]]$1[[[:space:]]]' \
|
||||
$LINUX_OBJ/$LINUX_SYMBOLS 2>/dev/null
|
||||
rc=$?
|
||||
if test $rc -ne 0; then
|
||||
export=0
|
||||
for file in $2; do
|
||||
grep -q -E "EXPORT_SYMBOL.*($1)" "$LINUX/$file" 2>/dev/null
|
||||
rc=$?
|
||||
if test $rc -eq 0; then
|
||||
export=1
|
||||
break;
|
||||
fi
|
||||
done
|
||||
if test $export -eq 0; then
|
||||
AC_MSG_RESULT([no])
|
||||
$4
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
$3
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
$3
|
||||
fi
|
||||
])
|
||||
@@ -0,0 +1,73 @@
|
||||
srpm-modules:
|
||||
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" srpm-common
|
||||
|
||||
srpm-utils:
|
||||
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" srpm-common
|
||||
|
||||
srpm: srpm-modules srpm-utils
|
||||
|
||||
rpm-modules: srpm-modules
|
||||
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" rpm-common
|
||||
|
||||
rpm-utils: srpm-utils
|
||||
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" rpm-common
|
||||
|
||||
rpm-modules: srpm-modules
|
||||
|
||||
rpm: rpm-modules rpm-utils
|
||||
|
||||
rpm-local:
|
||||
@(if test "${HAVE_RPMBUILD}" = "no"; then \
|
||||
echo -e "\n" \
|
||||
"*** Required util ${RPMBUILD} missing. Please install the\n" \
|
||||
"*** package for your distribution which provides ${RPMBUILD},\n" \
|
||||
"*** re-run configure, and try again.\n"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
mkdir -p $(rpmbuild)/TMP && \
|
||||
mkdir -p $(rpmbuild)/BUILD && \
|
||||
mkdir -p $(rpmbuild)/RPMS && \
|
||||
mkdir -p $(rpmbuild)/SRPMS && \
|
||||
mkdir -p $(rpmbuild)/SPECS && \
|
||||
cp $(rpmspec) $(rpmbuild)/SPECS && \
|
||||
mkdir -p $(rpmbuild)/SOURCES && \
|
||||
cp $(distdir).tar.gz $(rpmbuild)/SOURCES)
|
||||
|
||||
srpm-common: dist
|
||||
rpmpkg=$(pkg)-$(ZFS_META_VERSION)-$(ZFS_META_RELEASE).src.rpm; \
|
||||
rpmspec=$(pkg).spec; \
|
||||
rpmbuild=`mktemp -t -d $(PACKAGE)-build-$$USER-XXXXXXXX`; \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
rpmbuild="$$rpmbuild" \
|
||||
rpmspec="$$rpmspec" \
|
||||
rpm-local || exit 1; \
|
||||
$(RPMBUILD) \
|
||||
--define "_tmppath $$rpmbuild/TMP" \
|
||||
--define "_topdir $$rpmbuild" \
|
||||
--define "build_src_rpm 1" \
|
||||
--define "dist %{nil}" \
|
||||
--nodeps -bs $$rpmbuild/SPECS/$$rpmspec || exit 1; \
|
||||
cp $$rpmbuild/SRPMS/$$rpmpkg . || exit 1; \
|
||||
$(RM) -R $$rpmbuild
|
||||
|
||||
rpm-common:
|
||||
rpmpkg=$(pkg)-$(ZFS_META_VERSION)-$(ZFS_META_RELEASE).src.rpm; \
|
||||
rpmspec=$(pkg).spec; \
|
||||
rpmbuild=`mktemp -t -d $(PACKAGE)-build-$$USER-XXXXXXXX`; \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
rpmbuild="$$rpmbuild" \
|
||||
rpmspec="$$rpmspec" \
|
||||
rpm-local || exit 1; \
|
||||
$(RPMBUILD) \
|
||||
--define "_tmppath $$rpmbuild/TMP" \
|
||||
--define "_topdir $$rpmbuild" \
|
||||
--define "dist %{nil}" \
|
||||
--define "require_kdir $(LINUX)" \
|
||||
--define "require_kobj $(LINUX_OBJ)" \
|
||||
--define "require_kver $(LINUX_VERSION)" \
|
||||
--define "require_spldir $(SPL)" \
|
||||
--define "require_splobj $(SPL_OBJ)" \
|
||||
--define "require_splver $(SPL_VERSION)" \
|
||||
--nodeps --rebuild $$rpmpkg || exit 1; \
|
||||
cp $$rpmbuild/RPMS/*/* . || exit 1; \
|
||||
$(RM) -R $$rpmbuild
|
||||
@@ -0,0 +1,30 @@
|
||||
tgz-local:
|
||||
@(if test "${HAVE_ALIEN}" = "no"; then \
|
||||
echo -e "\n" \
|
||||
"*** Required util ${ALIEN} missing. Please install the\n" \
|
||||
"*** package for your distribution which provides ${ALIEN},\n" \
|
||||
"*** re-run configure, and try again.\n"; \
|
||||
exit 1; \
|
||||
fi)
|
||||
|
||||
tgz-modules: tgz-local rpm-modules
|
||||
name=${PACKAGE}-modules; \
|
||||
version=${ZFS_META_VERSION}-${ZFS_META_RELEASE}; \
|
||||
release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \
|
||||
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch}`; \
|
||||
pkg1=$${name}-$${version}_$${release}.$${arch}.rpm; \
|
||||
pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \
|
||||
fakeroot $(ALIEN) --scripts --to-tgz $$pkg1 $$pkg2; \
|
||||
$(RM) $$pkg1 $$pkg2
|
||||
|
||||
tgz-utils: tgz-local rpm-utils
|
||||
name=${PACKAGE}; \
|
||||
version=${ZFS_META_VERSION}-${ZFS_META_RELEASE}; \
|
||||
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch}`; \
|
||||
pkg1=$${name}-$${version}.$${arch}.rpm; \
|
||||
pkg2=$${name}-devel-$${version}.$${arch}.rpm; \
|
||||
pkg3=$${name}-test-$${version}.$${arch}.rpm; \
|
||||
fakeroot $(ALIEN) --scripts --to-tgz $$pkg1 $$pkg2 $$pkg3; \
|
||||
$(RM) $$pkg1 $$pkg2 $$pkg3
|
||||
|
||||
tgz: tgz-modules tgz-utils
|
||||
@@ -0,0 +1,19 @@
|
||||
dnl #
|
||||
dnl # Set the target arch for libspl atomic implementation
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_CONFIG_USER_ARCH], [
|
||||
AC_MSG_CHECKING(for target asm dir)
|
||||
TARGET_ARCH=`echo ${target_cpu} | sed -e s/i.86/i386/`
|
||||
|
||||
case $TARGET_ARCH in
|
||||
i386|x86_64)
|
||||
TARGET_ASM_DIR=asm-${TARGET_ARCH}
|
||||
;;
|
||||
*)
|
||||
TARGET_ASM_DIR=asm-generic
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST([TARGET_ASM_DIR])
|
||||
AC_MSG_RESULT([$TARGET_ASM_DIR])
|
||||
])
|
||||
@@ -0,0 +1,22 @@
|
||||
dnl #
|
||||
dnl # Check if gcc supports -Wframe-larger-than=<size> option.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_CONFIG_USER_FRAME_LARGER_THAN], [
|
||||
AC_MSG_CHECKING([for -Wframe-larger-than=<size> support])
|
||||
|
||||
saved_flags="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -Wframe-larger-than=1024"
|
||||
|
||||
AC_RUN_IFELSE(AC_LANG_PROGRAM( [], []),
|
||||
[
|
||||
FRAME_LARGER_THAN=-Wframe-larger-than=1024
|
||||
AC_MSG_RESULT([yes])
|
||||
],
|
||||
[
|
||||
FRAME_LARGER_THAN=
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
|
||||
CFLAGS="$saved_flags"
|
||||
AC_SUBST([FRAME_LARGER_THAN])
|
||||
])
|
||||
@@ -0,0 +1,35 @@
|
||||
dnl #
|
||||
dnl # Check for ioctl()
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_CONFIG_USER_IOCTL], [
|
||||
AC_MSG_CHECKING(for ioctl())
|
||||
AC_EGREP_HEADER(ioctl, unistd.h, is_unistd=yes, is_unistd=no)
|
||||
AC_EGREP_HEADER(ioctl, sys/ioctl.h, is_sys_ioctl=yes, is_sys_ioctl=no)
|
||||
AC_EGREP_HEADER(ioctl, stropts.h, is_stropts=yes, is_stropts=no)
|
||||
|
||||
if test $is_unistd = yes; then
|
||||
result=unistd.h
|
||||
AC_DEFINE([HAVE_IOCTL_IN_UNISTD_H], 1,
|
||||
[Define to 1 if ioctl() defined in <unistd.h>])
|
||||
else
|
||||
|
||||
if test $is_sys_ioctl = yes; then
|
||||
result=sys/ioctl.h
|
||||
AC_DEFINE([HAVE_IOCTL_IN_SYS_IOCTL_H], 1,
|
||||
[Define to 1 if ioctl() defined in <sys/ioctl.h>])
|
||||
elif test $is_stropts = yes; then
|
||||
AC_DEFINE([HAVE_IOCTL_IN_STROPTS_H], 1,
|
||||
result=stropts.h
|
||||
[Define to 1 if ioctl() defined in <stropts.h>])
|
||||
else
|
||||
result=no
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $result = no; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([*** Cannot locate ioctl() definition])
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
fi
|
||||
])
|
||||
@@ -0,0 +1,94 @@
|
||||
dnl #
|
||||
dnl # Check for ZFS support in libblkid. This test needs to check
|
||||
dnl # more than if the library exists because we expect there are
|
||||
dnl # at least 3 flavors of the library out in the wild:
|
||||
dnl #
|
||||
dnl # 1) blkid which has no ZFS support
|
||||
dnl # 2) blkid with ZFS support and a flawed method of probing
|
||||
dnl # 3) blkid with ZFS support and a working method of probing
|
||||
dnl #
|
||||
dnl # To handle this the check first validates that there is a version
|
||||
dnl # of the library installed. If there is it creates a simulated
|
||||
dnl # ZFS filesystem and then links a small test app which attempts
|
||||
dnl # to detect the simualated filesystem type. If it correctly
|
||||
dnl # identifies the filesystem as ZFS we can safely assume case 3).
|
||||
dnl # Otherwise we disable blkid support and resort to manual probing.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_CONFIG_USER_LIBBLKID], [
|
||||
AC_ARG_WITH([blkid],
|
||||
[AS_HELP_STRING([--with-blkid],
|
||||
[support blkid caching @<:@default=check@:>@])],
|
||||
[],
|
||||
[with_blkid=check])
|
||||
|
||||
LIBBLKID=
|
||||
AS_IF([test "x$with_blkid" != xno],
|
||||
[
|
||||
AC_CHECK_LIB([blkid], [blkid_get_cache],
|
||||
[
|
||||
AC_MSG_CHECKING([for blkid zfs support])
|
||||
|
||||
ZFS_DEV=`mktemp`
|
||||
dd if=/dev/zero of=$ZFS_DEV bs=1024k count=8 \
|
||||
>/dev/null 2>/dev/null
|
||||
echo -en "\x0c\xb1\xba\0\0\0\0\0" | \
|
||||
dd of=$ZFS_DEV bs=1k count=8 \
|
||||
seek=132 conv=notrunc &>/dev/null \
|
||||
>/dev/null 2>/dev/null
|
||||
|
||||
saved_LDFLAGS="$LDFLAGS"
|
||||
LDFLAGS="-lblkid"
|
||||
|
||||
AC_RUN_IFELSE(AC_LANG_PROGRAM(
|
||||
[
|
||||
#include <stdio.h>
|
||||
#include <blkid/blkid.h>
|
||||
],
|
||||
[
|
||||
blkid_cache cache;
|
||||
char *value;
|
||||
|
||||
if (blkid_get_cache(&cache, NULL) < 0)
|
||||
return 1;
|
||||
|
||||
value = blkid_get_tag_value(cache, "TYPE",
|
||||
"$ZFS_DEV");
|
||||
if (!value) {
|
||||
blkid_put_cache(cache);
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (strcmp(value, "zfs")) {
|
||||
free(value);
|
||||
blkid_put_cache(cache);
|
||||
return 3;
|
||||
}
|
||||
|
||||
free(value);
|
||||
blkid_put_cache(cache);
|
||||
]),
|
||||
[
|
||||
rm -f $ZFS_DEV
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_SUBST([LIBBLKID], ["-lblkid"])
|
||||
AC_DEFINE([HAVE_LIBBLKID], 1,
|
||||
[Define if you have libblkid])
|
||||
],
|
||||
[
|
||||
rm -f $ZFS_DEV
|
||||
AC_MSG_RESULT([no])
|
||||
AS_IF([test "x$with_blkid" != xcheck],
|
||||
[AC_MSG_FAILURE(
|
||||
[--with-blkid given but unavailable])])
|
||||
])
|
||||
|
||||
LDFLAGS="$saved_LDFLAGS"
|
||||
],
|
||||
[
|
||||
AS_IF([test "x$with_blkid" != xcheck],
|
||||
[AC_MSG_FAILURE(
|
||||
[--with-blkid given but unavailable])])
|
||||
]
|
||||
[])
|
||||
])
|
||||
])
|
||||
@@ -0,0 +1,8 @@
|
||||
dnl #
|
||||
dnl # Check for libshare
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_CONFIG_USER_LIBSHARE], [
|
||||
AC_CHECK_LIB([share], [sa_init],
|
||||
[AC_DEFINE([HAVE_LIBSHARE], 1,
|
||||
[Define to 1 if 'libshare' library available])])
|
||||
])
|
||||
@@ -0,0 +1,18 @@
|
||||
dnl #
|
||||
dnl # Check for libuuid
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_CONFIG_USER_LIBUUID], [
|
||||
LIBUUID=
|
||||
|
||||
AC_CHECK_HEADER([uuid/uuid.h], [], [AC_MSG_FAILURE([
|
||||
*** uuid/uuid.h missing, libuuid-devel package required])])
|
||||
|
||||
AC_CHECK_LIB([uuid], [uuid_generate], [], [AC_MSG_FAILURE([
|
||||
*** uuid_generate() missing, libuuid-devel package required])])
|
||||
|
||||
AC_CHECK_LIB([uuid], [uuid_is_null], [], [AC_MSG_FAILURE([
|
||||
*** uuid_is_null() missing, libuuid-devel package required])])
|
||||
|
||||
AC_SUBST([LIBUUID], ["-luuid"])
|
||||
AC_DEFINE([HAVE_LIBUUID], 1, [Define if you have libuuid])
|
||||
])
|
||||
@@ -0,0 +1,56 @@
|
||||
dnl #
|
||||
dnl # Check if the glibc NPTL threading implementation includes the guard area
|
||||
dnl # within the stack size allocation, rather than allocating extra space at
|
||||
dnl # the end of the stack, as POSIX.1 requires.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_CONFIG_USER_STACK_GUARD], [
|
||||
|
||||
AC_MSG_CHECKING([whether pthread stack includes guard])
|
||||
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
CFLAGS="-fstack-check"
|
||||
saved_LDFLAGS="$LDFLAGS"
|
||||
LDFLAGS="-lpthread"
|
||||
|
||||
AC_RUN_IFELSE(AC_LANG_PROGRAM(
|
||||
[
|
||||
#include <pthread.h>
|
||||
#include <sys/resource.h>
|
||||
#include <unistd.h>
|
||||
#include <bits/local_lim.h>
|
||||
|
||||
#define PAGESIZE (sysconf(_SC_PAGESIZE))
|
||||
#define STACK_SIZE 8192
|
||||
#define BUFSIZE 4096
|
||||
|
||||
void * func(void *arg)
|
||||
{
|
||||
char buf[[[BUFSIZE]]];
|
||||
}
|
||||
],
|
||||
[
|
||||
pthread_t tid;
|
||||
pthread_attr_t attr;
|
||||
struct rlimit l;
|
||||
|
||||
l.rlim_cur = 0;
|
||||
l.rlim_max = 0;
|
||||
setrlimit(RLIMIT_CORE, &l);
|
||||
pthread_attr_init(&attr);
|
||||
pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN + STACK_SIZE);
|
||||
pthread_attr_setguardsize(&attr, PAGESIZE);
|
||||
pthread_create(&tid, &attr, func, NULL);
|
||||
pthread_join(tid, NULL);
|
||||
]),
|
||||
[
|
||||
AC_MSG_RESULT([no])
|
||||
],
|
||||
[
|
||||
AC_DEFINE([NPTL_GUARD_WITHIN_STACK], 1,
|
||||
[Define to 1 if NPTL threading implementation includes
|
||||
guard area in stack allocation])
|
||||
AC_MSG_RESULT([yes])
|
||||
])
|
||||
CFLAGS="$saved_CFLAGS"
|
||||
LDFLAGS="$saved_LDFLAGS"
|
||||
])
|
||||
@@ -0,0 +1,21 @@
|
||||
dnl #
|
||||
dnl # Check for zlib
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_CONFIG_USER_ZLIB], [
|
||||
ZLIB=
|
||||
|
||||
AC_CHECK_HEADER([zlib.h], [], [AC_MSG_FAILURE([
|
||||
*** zlib.h missing, zlib-devel package required])])
|
||||
|
||||
AC_CHECK_LIB([z], [compress2], [], [AC_MSG_FAILURE([
|
||||
*** compress2() missing, zlib-devel package required])])
|
||||
|
||||
AC_CHECK_LIB([z], [uncompress], [], [AC_MSG_FAILURE([
|
||||
*** uncompress() missing, zlib-devel package required])])
|
||||
|
||||
AC_CHECK_LIB([z], [crc32], [], [AC_MSG_FAILURE([
|
||||
*** crc32() missing, zlib-devel package required])])
|
||||
|
||||
AC_SUBST([ZLIB], ["-lz"])
|
||||
AC_DEFINE([HAVE_ZLIB], 1, [Define if you have zlib])
|
||||
])
|
||||
@@ -0,0 +1,13 @@
|
||||
dnl #
|
||||
dnl # Default ZFS user configuration
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_CONFIG_USER], [
|
||||
ZFS_AC_CONFIG_USER_ARCH
|
||||
ZFS_AC_CONFIG_USER_LIBSHARE
|
||||
ZFS_AC_CONFIG_USER_IOCTL
|
||||
ZFS_AC_CONFIG_USER_ZLIB
|
||||
ZFS_AC_CONFIG_USER_LIBUUID
|
||||
ZFS_AC_CONFIG_USER_LIBBLKID
|
||||
ZFS_AC_CONFIG_USER_FRAME_LARGER_THAN
|
||||
ZFS_AC_CONFIG_USER_STACK_GUARD
|
||||
])
|
||||
@@ -0,0 +1,295 @@
|
||||
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])
|
||||
])
|
||||
|
||||
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=no@:>@])],
|
||||
[],
|
||||
[enable_debug=no])
|
||||
|
||||
AS_IF([test "x$enable_debug" = xyes],
|
||||
[
|
||||
KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror"
|
||||
HOSTCFLAGS="${HOSTCFLAGS} -DDEBUG -Werror"
|
||||
DEBUG_CFLAGS="-DDEBUG -Werror"
|
||||
DEBUG_STACKFLAGS="-fstack-check"
|
||||
],
|
||||
[
|
||||
KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG "
|
||||
HOSTCFLAGS="${HOSTCFLAGS} -DNDEBUG "
|
||||
DEBUG_CFLAGS="-DNDEBUG"
|
||||
DEBUG_STACKFLAGS=""
|
||||
])
|
||||
|
||||
AC_SUBST(DEBUG_CFLAGS)
|
||||
AC_SUBST(DEBUG_STACKFLAGS)
|
||||
AC_MSG_RESULT([$enable_debug])
|
||||
])
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
COMMON_SH=\${SCRIPTDIR}/common.sh
|
||||
ZFS_SH=\${SCRIPTDIR}/zfs.sh
|
||||
ZPOOL_CREATE_SH=\${SCRIPTDIR}/zpool-create.sh
|
||||
|
||||
INTREE=1
|
||||
LDMOD=/sbin/insmod
|
||||
|
||||
KERNEL_MODULES=( \\
|
||||
\${KERNELMOD}/lib/zlib_deflate/zlib_deflate.ko \\
|
||||
)
|
||||
|
||||
SPL_MODULES=( \\
|
||||
\${SPLBUILD}/spl/spl.ko \\
|
||||
\${SPLBUILD}/splat/splat.ko \\
|
||||
)
|
||||
|
||||
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
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_CONFIG], [
|
||||
TOPDIR=`readlink -f ${srcdir}`
|
||||
BUILDDIR=$TOPDIR
|
||||
LIBDIR=$TOPDIR/lib
|
||||
CMDDIR=$TOPDIR/cmd
|
||||
MODDIR=$TOPDIR/module
|
||||
SCRIPTDIR=$TOPDIR/scripts
|
||||
TARGET_ASM_DIR=asm-generic
|
||||
|
||||
AC_SUBST(TOPDIR)
|
||||
AC_SUBST(BUILDDIR)
|
||||
AC_SUBST(LIBDIR)
|
||||
AC_SUBST(CMDDIR)
|
||||
AC_SUBST(MODDIR)
|
||||
AC_SUBST(SCRIPTDIR)
|
||||
AC_SUBST(TARGET_ASM_DIR)
|
||||
|
||||
ZFS_CONFIG=all
|
||||
AC_ARG_WITH([config],
|
||||
AS_HELP_STRING([--with-config=CONFIG],
|
||||
[Config file 'kernel|user|all|srpm']),
|
||||
[ZFS_CONFIG="$withval"])
|
||||
|
||||
AC_MSG_CHECKING([zfs config])
|
||||
AC_MSG_RESULT([$ZFS_CONFIG]);
|
||||
AC_SUBST(ZFS_CONFIG)
|
||||
|
||||
case "$ZFS_CONFIG" in
|
||||
kernel) ZFS_AC_CONFIG_KERNEL ;;
|
||||
user) ZFS_AC_CONFIG_USER ;;
|
||||
all) ZFS_AC_CONFIG_KERNEL
|
||||
ZFS_AC_CONFIG_USER ;;
|
||||
srpm) ;;
|
||||
*)
|
||||
AC_MSG_RESULT([Error!])
|
||||
AC_MSG_ERROR([Bad value "$ZFS_CONFIG" for --with-config,
|
||||
user kernel|user|all|srpm]) ;;
|
||||
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])
|
||||
|
||||
ZFS_AC_CONFIG_SCRIPT
|
||||
])
|
||||
|
||||
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], [
|
||||
AC_MSG_CHECKING([linux distribution])
|
||||
if test -f /etc/redhat-release ; then
|
||||
VENDOR=redhat ;
|
||||
elif test -f /etc/fedora-release ; then
|
||||
VENDOR=fedora ;
|
||||
elif test -f /etc/debian_version ; then
|
||||
VENDOR=debian ;
|
||||
elif test -f /etc/lsb-release ; then
|
||||
VENDOR=ubuntu ;
|
||||
elif test -f /etc/SuSE-release ; then
|
||||
VENDOR=sles ;
|
||||
elif test -f /etc/slackware-version ; then
|
||||
VENDOR=slackware ;
|
||||
elif test -f /etc/gentoo-release ; then
|
||||
VENDOR=gentoo ;
|
||||
else
|
||||
VENDOR= ;
|
||||
fi
|
||||
AC_MSG_RESULT([$VENDOR])
|
||||
AC_SUBST(VENDOR)
|
||||
|
||||
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
|
||||
])
|
||||
@@ -0,0 +1,131 @@
|
||||
dnl #
|
||||
dnl # ZFS_AC_META
|
||||
dnl # Read metadata from the META file.
|
||||
dnl #
|
||||
dnl # AUTHOR:
|
||||
dnl # Chris Dunlap <cdunlap@llnl.gov>
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_META], [
|
||||
|
||||
AH_BOTTOM([
|
||||
#undef PACKAGE
|
||||
#undef PACKAGE_BUGREPORT
|
||||
#undef PACKAGE_NAME
|
||||
#undef PACKAGE_STRING
|
||||
#undef PACKAGE_TARNAME
|
||||
#undef PACKAGE_VERSION
|
||||
#undef STDC_HEADERS
|
||||
#undef VERSION])
|
||||
|
||||
AC_MSG_CHECKING([metadata])
|
||||
|
||||
META="$srcdir/META"
|
||||
_zfs_ac_meta_got_file=no
|
||||
if test -f "$META"; then
|
||||
_zfs_ac_meta_got_file=yes
|
||||
|
||||
ZFS_META_NAME=_ZFS_AC_META_GETVAL([(?:NAME|PROJECT|PACKAGE)]);
|
||||
if test -n "$ZFS_META_NAME"; then
|
||||
AC_DEFINE_UNQUOTED([ZFS_META_NAME], ["$ZFS_META_NAME"],
|
||||
[Define the project name.]
|
||||
)
|
||||
AC_SUBST([ZFS_META_NAME])
|
||||
fi
|
||||
|
||||
ZFS_META_VERSION=_ZFS_AC_META_GETVAL([VERSION]);
|
||||
if test -n "$ZFS_META_VERSION"; then
|
||||
AC_DEFINE_UNQUOTED([ZFS_META_VERSION], ["$ZFS_META_VERSION"],
|
||||
[Define the project version.]
|
||||
)
|
||||
AC_SUBST([ZFS_META_VERSION])
|
||||
fi
|
||||
|
||||
ZFS_META_RELEASE=_ZFS_AC_META_GETVAL([RELEASE]);
|
||||
if test -n "$ZFS_META_RELEASE"; then
|
||||
AC_DEFINE_UNQUOTED([ZFS_META_RELEASE], ["$ZFS_META_RELEASE"],
|
||||
[Define the project release.]
|
||||
)
|
||||
AC_SUBST([ZFS_META_RELEASE])
|
||||
fi
|
||||
|
||||
ZFS_META_LICENSE=_ZFS_AC_META_GETVAL([LICENSE]);
|
||||
if test -n "$ZFS_META_LICENSE"; then
|
||||
AC_DEFINE_UNQUOTED([ZFS_META_LICENSE], ["$ZFS_META_LICENSE"],
|
||||
[Define the project license.]
|
||||
)
|
||||
AC_SUBST([ZFS_META_LICENSE])
|
||||
fi
|
||||
|
||||
if test -n "$ZFS_META_NAME" -a -n "$ZFS_META_VERSION"; then
|
||||
ZFS_META_ALIAS="$ZFS_META_NAME-$ZFS_META_VERSION"
|
||||
test -n "$ZFS_META_RELEASE" &&
|
||||
ZFS_META_ALIAS="$ZFS_META_ALIAS-$ZFS_META_RELEASE"
|
||||
AC_DEFINE_UNQUOTED([ZFS_META_ALIAS],
|
||||
["$ZFS_META_ALIAS"],
|
||||
[Define the project alias string.]
|
||||
)
|
||||
AC_SUBST([ZFS_META_ALIAS])
|
||||
fi
|
||||
|
||||
ZFS_META_DATA=_ZFS_AC_META_GETVAL([DATE]);
|
||||
if test -n "$ZFS_META_DATA"; then
|
||||
AC_DEFINE_UNQUOTED([ZFS_META_DATA], ["$ZFS_META_DATA"],
|
||||
[Define the project release date.]
|
||||
)
|
||||
AC_SUBST([ZFS_META_DATA])
|
||||
fi
|
||||
|
||||
ZFS_META_AUTHOR=_ZFS_AC_META_GETVAL([AUTHOR]);
|
||||
if test -n "$ZFS_META_AUTHOR"; then
|
||||
AC_DEFINE_UNQUOTED([ZFS_META_AUTHOR], ["$ZFS_META_AUTHOR"],
|
||||
[Define the project author.]
|
||||
)
|
||||
AC_SUBST([ZFS_META_AUTHOR])
|
||||
fi
|
||||
|
||||
m4_pattern_allow([^LT_(CURRENT|REVISION|AGE)$])
|
||||
ZFS_META_LT_CURRENT=_ZFS_AC_META_GETVAL([LT_CURRENT]);
|
||||
ZFS_META_LT_REVISION=_ZFS_AC_META_GETVAL([LT_REVISION]);
|
||||
ZFS_META_LT_AGE=_ZFS_AC_META_GETVAL([LT_AGE]);
|
||||
if test -n "$ZFS_META_LT_CURRENT" \
|
||||
-o -n "$ZFS_META_LT_REVISION" \
|
||||
-o -n "$ZFS_META_LT_AGE"; then
|
||||
test -n "$ZFS_META_LT_CURRENT" || ZFS_META_LT_CURRENT="0"
|
||||
test -n "$ZFS_META_LT_REVISION" || ZFS_META_LT_REVISION="0"
|
||||
test -n "$ZFS_META_LT_AGE" || ZFS_META_LT_AGE="0"
|
||||
AC_DEFINE_UNQUOTED([ZFS_META_LT_CURRENT],
|
||||
["$ZFS_META_LT_CURRENT"],
|
||||
[Define the libtool library 'current'
|
||||
version information.]
|
||||
)
|
||||
AC_DEFINE_UNQUOTED([ZFS_META_LT_REVISION],
|
||||
["$ZFS_META_LT_REVISION"],
|
||||
[Define the libtool library 'revision'
|
||||
version information.]
|
||||
)
|
||||
AC_DEFINE_UNQUOTED([ZFS_META_LT_AGE], ["$ZFS_META_LT_AGE"],
|
||||
[Define the libtool library 'age'
|
||||
version information.]
|
||||
)
|
||||
AC_SUBST([ZFS_META_LT_CURRENT])
|
||||
AC_SUBST([ZFS_META_LT_REVISION])
|
||||
AC_SUBST([ZFS_META_LT_AGE])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_MSG_RESULT([$_zfs_ac_meta_got_file])
|
||||
]
|
||||
)
|
||||
|
||||
AC_DEFUN([_ZFS_AC_META_GETVAL],
|
||||
[`perl -n\
|
||||
-e "BEGIN { \\$key=shift @ARGV; }"\
|
||||
-e "next unless s/^\s*\\$key@<:@:=@:>@//i;"\
|
||||
-e "s/^((?:@<:@^'\"#@:>@*(?:(@<:@'\"@:>@)@<:@^\2@:>@*\2)*)*)#.*/\\@S|@1/;"\
|
||||
-e "s/^\s+//;"\
|
||||
-e "s/\s+$//;"\
|
||||
-e "s/^(@<:@'\"@:>@)(.*)\1/\\@S|@2/;"\
|
||||
-e "\\$val=\\$_;"\
|
||||
-e "END { print \\$val if defined \\$val; }"\
|
||||
'$1' $META`]dnl
|
||||
)
|
||||
Reference in New Issue
Block a user