SUBDIRS := @LDISKFS_SUBDIR@ @SPL_SUBDIR@ @ZFS_SUBDIR@ . @LIBSYSIO_SUBDIR@ @SNMP_SUBDIR@ @LUSTREIOKIT_SUBDIR@ @LIBCFS_SUBDIR@ lnet lustre
DIST_SUBDIRS := @LDISKFS_DIST_SUBDIR@ @SNMP_DIST_SUBDIR@ libsysio lustre-iokit @LIBCFS_SUBDIR@ lnet lustre
-SOURCES_SUBDIRS := @LDISKFS_SUBDIR@ @LIBCFS_SUBDIR@ lnet lustre
+SOURCES_SUBDIRS := @LIBCFS_SUBDIR@ lnet lustre
RPM_SUBDIRS := @LDISKFS_SUBDIR@ @LUSTREIOKIT_SUBDIR@
MODULE_SYMVERS_DEPS = module-symvers
-/Rules
+/Makefile.in
/aclocal.m4
/autom4te.cache
/config.h
--- /dev/null
+AUTOMAKE_OPTIONS = foreign
+SUBDIRS = ldiskfs
+EXTRA_DIST = @PACKAGE_TARNAME@.spec
+EXTRA_DIST += kernel_patches
+EXTRA_DIST += config
+
+dist-hook:
+ find $(distdir) -name .deps -o \
+ -name .git -o \
+ -name .#* | xargs rm -rf
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" distdir="$(distdir)" \
+ module-dist-hook
+
+rpms: @PACKAGE_TARNAME@.spec dist Makefile
+ CONFIGURE_ARGS=$$(echo $$(eval echo $(ac_configure_args)) | \
+ sed -re 's/--(en|dis)able-tests//'); \
+ if [ -n "@LINUX@" ]; then \
+ CONFIGURE_ARGS=$$(echo $$(eval echo $$CONFIGURE_ARGS) | \
+ sed -re 's/--with-linux=[^ ][^ ]*//'); \
+ RPMARGS="--define \"kdir @LINUX@\""; \
+ CONFIGURE_ARGS=$$(echo $$(eval echo $$CONFIGURE_ARGS) | \
+ sed -re 's/--with-linux-obj=[^ ][^ ]*//'); \
+ if [ -n "@LINUX_OBJ@" -a "@LINUX_OBJ@" != "@LINUX@" ]; then \
+ RPMARGS="$$RPMARGS --define \"kobjdir @LINUX_OBJ@\""; \
+ fi; \
+ fi; \
+ CONFIGURE_ARGS=$$(echo $$(eval echo $$CONFIGURE_ARGS) | \
+ sed -re 's/--with-release=[^ ][^ ]*//'); \
+ RPMARGS="$$RPMARGS --define \"configure_args $$CONFIGURE_ARGS\""; \
+ echo "Building ldiskfs RPM with $$RPMARGS"; \
+ eval rpmbuild $$RPMARGS -ta $(distdir).tar.gz
+
+srpm: @PACKAGE_TARNAME@.spec dist Makefile
+ eval rpmbuild $$RPMARGS -ta $(distdir).tar.gz
+
+# this only needs to be done if disting stand-alone (i.e. not as a
+# subdir of lustre
+module-dist-hook:
+ if ! grep "AC_INIT(\[Lustre\], \[LUSTRE_VERSION\], \[http:\/\/bugs\.whamcloud\.com\/], \[lustre\])" ../configure.ac; then \
+ if [ -f META ]; then \
+ cp META $(distdir)/META; \
+ fi; \
+ fi
+++ /dev/null
-subdir-m += ldiskfs
-
-@INCLUDE_RULES@
+++ /dev/null
-SUBDIRS = . ldiskfs
-SOURCES_SUBDIRS = ldiskfs
-DIST_SUBDIRS = ldiskfs
-
-include build/autoMakefile.am.toplevel
-
-EXTRA_DIST += kernel_patches
-
-# this only needs to be done if disting stand-alone (i.e. not as a
-# subdir of lustre
-module-dist-hook:
- if ! grep "AC_INIT(\[Lustre\], \[LUSTRE_VERSION\], \[http:\/\/bugs\.whamcloud\.com\/], \[lustre\])" ../configure.ac; then \
- if [ -f META ]; then \
- cp META $(distdir)/META; \
- fi; \
- fi
# NOTE: Please avoid bashisms (bash specific syntax) in this script
-# taken from gnome-common/macros2/autogen.sh
-compare_versions() {
- ch_min_version=$1
- ch_actual_version=$2
- ch_status=0
- IFS="${IFS= }"; ch_save_IFS="$IFS"; IFS="."
- set $ch_actual_version
- for ch_min in $ch_min_version; do
- # remove letter suffixes
- ch_cur=$(echo $1 | sed 's/[^0-9].*$//'); shift
- if [ -z "$ch_min" ]; then break; fi
- if [ -z "$ch_cur" ]; then ch_status=1; break; fi
- if [ $ch_cur -gt $ch_min ]; then break; fi
- if [ $ch_cur -lt $ch_min ]; then ch_status=1; break; fi
- done
- IFS="$ch_save_IFS"
- return $ch_status
-}
-
-error_msg() {
- echo "$cmd is $1. Version $required (or higher) is"\
- " required to build Lustre."
-
- if [ ! -x /usr/bin/lsb_release ]; then
- echo "lsb_release could not be found. "\
- "If it were available more help on how to resolve this"
- echo "situation would be available."
- exit 1
- fi
-
- local dist_id="$(lsb_release -is)"
- local howto=""
- howto() {
- echo -e "To install $cmd, you can use the command:\n# $1"
- }
- case $dist_id in
- Ubuntu|Debian) howto "apt-get install $cmd" ;;
- CentOS|RedHat*|Fedora*) howto "yum install $cmd" ;;
- SUSE*) howto "yast -i $cmd" ;;
- *) cat <<EOF
-Installation instructions for the package $cmd on $dist_id are not known.
-If you know how to install the required package, please file a bug at
-http://bugs.whamcloud.com/ and include your distribution and the output from:
-"lsb_release -is" is: "$dist_id"
-EOF
- ;;
- esac
-
- exit 1
-}
-
-check_version() {
- local tool
- local cmd
- local required
- local version
-
- tool=$1
- cmd=$2
- required=$3
- echo -n "checking for $cmd >= $required... "
- if ! $cmd --version >/dev/null ; then
- error_msg "missing"
- fi
- version=$($cmd --version | awk "/$tool \(GNU/ { print \$4 }")
- echo "found $version"
- if ! compare_versions "$required" "$version" ; then
- error_msg "too old"
- fi
-}
-
-found=false
-for AMVER in 1.9 1.10 1.11; do
- if which automake-$AMVER 2> /dev/null; then
- found=true
- break
- fi
-done
-
-if ! $found; then
- cmd=automake required="1.9" error_msg "not found"
- exit 1
-fi
-
-[ "${AMVER#1.}" -ge "10" ] && AMOPT="-W no-portability"
+# enable execution tracing
+set -x
-check_version automake automake-$AMVER "1.9"
-check_version autoconf autoconf "2.57"
-
-run_cmd()
+error()
{
- cmd="$@"
- echo -n "Running $cmd"
- eval $cmd
- res=$?
- if [ $res -ne 0 ]; then
- echo " failed: $res"
- echo "Aborting"
- exit 1
- fi
- echo
+ rc=$?
+ echo "$1 failed (rc=$rc). Aborting."
+ exit 1
}
-ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I $PWD/build/autoconf"
-
-export ACLOCAL="aclocal-$AMVER"
-export AUTOMAKE="automake-$AMVER"
-
-run_cmd "$ACLOCAL $ACLOCAL_FLAGS"
-run_cmd "autoheader"
-run_cmd "$AUTOMAKE -a -c $AMOPT"
-run_cmd autoconf
+aclocal -I $PWD/config || error "aclocal"
+autoheader || error "autoheader"
+automake -a -c -W no-portability || error "automake"
+autoconf || error "autoconf"
+++ /dev/null
-/Rules
-/modules.order
-/Module.markers
-/lustre.spec
-/Module.symvers
-/Modules.symvers
-!Makefile
+++ /dev/null
-#
-# There are four ways this Makefile can be called:
-#
-#
-# 1. As a subdirectory from the toplevel, for automake
-#
-# 2. A wrapper around the kernel's makefile when building modules, to
-# possibly override the .config file
-#
-# 3. At configure time, as the toplevel module dir for building
-# kernel tests
-#
-# 4. At configure time, to determine the kernel's idea of $(ARCH)
-#
-
-ifeq ($(PATCHLEVEL),)
-
-ifeq ($(LUSTRE_LINUX_CONFIG),)
-
-# case #1
-include autoMakefile
-
-else
-
-# case #2
-# Note that this comes from make -C $LINUX -f $LUSTRE/build/Makefile
-# so "include Makefile" below includes $LINUX/Makefile, not this file
-include $(LUSTRE_LINUX_CONFIG)
-include Makefile
-
-endif # LUSTRE_LINUX_CONFIG
-
-else # PATCHLEVEL
-
-# case 3
-
-ifneq ($(LUSTRE_KERNEL_TEST),)
-extra-y = $(LUSTRE_KERNEL_TEST)
-endif
-
-obj-m := conftest.o
-
-endif # PATCHLEVEL
-
-# case 4
-
-echoarch:
- echo $(ARCH) >$(ARCHFILE)
-
-TESTS := $(wildcard commit.*)
-check-commit:
- SHELL="$(SHELL)" $(SHELL) test-commit-msg.sh $(TESTS)
-
-check: check-commit
-.PHONY: check-commit
+++ /dev/null
-# Directories building kernel modules should have two files:
-#
-# Makefile.in:
-#
-# MODULES := <module-name>
-# <module-name>-objs := file1.o file2.o file3.o
-# @INCLUDE_RULES@
-#
-# and autoMakefile.am:
-#
-# if MODULES
-# modulefs_DATA = <module-name>$(KMODEXT)
-# endif
-#
-# DIST_SOURCES = $(<module-name>-objs:.o=.c) <other sources>
-# MOSTLYCLEANFILES = *.o *.ko *.mod.c
-
-ifeq ($(PATCHLEVEL),)
-
-include autoMakefile
-
-fix-kext-ownership:
- @if test -d $(DESTDIR)$(kextdir) ; then \
- echo chown -R root:wheel $(DESTDIR)$(kextdir) ; \
- chown -R root:wheel $(DESTDIR)$(kextdir) || \
- echo >&2 "*** WARNING: Could not fix kext ownership for $(DESTDIR)$(kextdir)" ; \
- fi
-
-else
-
-include @LINUX_CONFIG@
-
-EXTRA_CFLAGS := $(EXTRA_PRE_CFLAGS)
-EXTRA_CFLAGS += @EXTRA_KCFLAGS@ @UML_CFLAGS@ @CFLAGS@
-EXTRA_CFLAGS += $(EXTRA_POST_CFLAGS)
-
-obj-m := $(patsubst %,%.o,$(MODULES))
-
-endif # PATCHLEVEL
+++ /dev/null
-# EXTRA_DIST is not actually taken from here but rather from
-# build/autoMakefile.am.toplevel
-
-MOSTLYCLEANFILES := @MOSTLYCLEANFILES@
-
-# Override the default distclean, which removes Makefile
-distclean: distclean-recursive
- @true
-
-SUBDIRS = autoconf
+++ /dev/null
-# -*- Makefile -*-
-# This file is included by each package's toplevel autoMakefile[.am],
-# which must define SUBDIRS as a minimum.
-
-AUTOMAKE_OPTIONS = foreign
-
-FIND_TAG_FILES_CMD = find $(top_srcdir) \
- -path $(top_srcdir)/ldiskfs/ldiskfs/linux-stage \
- -prune -false -o -type f -name '*.[hc]'
-
-# these empty rules are needed so that automake doesn't add its own
-# recursive rules
-etags-recursive:
-
-ctags-recursive:
-
-tags-recursive:
-
-TAGS: etags
-
-tags: ctags etags
-
-etags:
- $(RM) $(top_srcdir)/TAGS
- ETAGSF=`etags --version | grep -iq exuberant && \
- echo "-I __initdata,__exitdata,EXPORT_SYMBOL"`; \
- $(FIND_TAG_FILES_CMD) | xargs etags $$ETAGSF -a
-
-ctags:
- $(RM) $(top_srcdir)/tags
- CTAGSF=`ctags --version | grep -iq exuberant && \
- echo "-I __initdata,__exitdata,EXPORT_SYMBOL"`; \
- $(FIND_TAG_FILES_CMD) | xargs ctags $$CTAGSF -a
-
-cscope-recursive:
-
-cscope:
- $(RM) $(top_srcdir)/cscope*.out $(top_srcdir)/cscope.files
- $(FIND_TAG_FILES_CMD) > cscope.files
- cscope -bRq
-
-mkid:
- $(FIND_TAG_FILES_CMD) | xargs mkid
-
-
-doxygen: doxygen-api doxygen-ref
-
-doxygen-%: build/doxyfile.%
- doxygen $<
-
-if MODULES
-sources: all-sources
-
-all-sources: $(MODULE_SYMVERS_DEPS)
- for dir in $(SOURCES_SUBDIRS) ; do \
- $(MAKE) sources -C $$dir || exit $$? ; \
- done
-
-if LINUX
-all-am: modules
-
-modules: $(DEP) all-sources
- $(MAKE) $(ARCH_UM) CC="$(CC)" -C $(LINUX_OBJ) \
- -f $(PWD)/build/Makefile LUSTRE_LINUX_CONFIG=$(LINUX_CONFIG) \
- LINUXINCLUDE='$(EXTRA_LNET_INCLUDE) -I$$(srctree)/arch/$$(SRCARCH)/include -I$$(srctree)/arch/$$(SRCARCH)/include/generated -Iinclude $$(if $$(KBUILD_SRC),-Iinclude2 -I$$(srctree)/include) -include $(CONFIG_INCLUDE)' \
- $(MODULE_TARGET)=$(PWD) -o tmp_include_depends -o scripts -o \
- include/config/MARKER $@
-endif # LINUX
-
-endif # MODULES
-
-dist-hook:
- find $(distdir) -name .deps -o \
- -name .git -o \
- -name .#* | xargs rm -rf
- $(MAKE) $(AM_MAKEFLAGS) \
- top_distdir="$(top_distdir)" distdir="$(distdir)" \
- module-dist-hook
-
-EXTRA_DIST = @PACKAGE_TARNAME@.spec \
- build/Makefile build/autoMakefile.am.toplevel \
- build/Rules.in \
- build/autoconf/ldiskfs-build-linux.m4 \
- build/autoconf/ldiskfs-build.m4 \
- build/autoconf/ldiskfs.m4
-
-rpms: @PACKAGE_TARNAME@.spec dist Makefile
- CONFIGURE_ARGS=$$(echo $$(eval echo $(ac_configure_args)) | \
- sed -re 's/--(en|dis)able-tests//'); \
- if [ -n "@LINUX@" ]; then \
- CONFIGURE_ARGS=$$(echo $$(eval echo $$CONFIGURE_ARGS) | \
- sed -re 's/--with-linux=[^ ][^ ]*//'); \
- RPMARGS="--define \"kdir @LINUX@\""; \
- CONFIGURE_ARGS=$$(echo $$(eval echo $$CONFIGURE_ARGS) | \
- sed -re 's/--with-linux-obj=[^ ][^ ]*//'); \
- if [ -n "@LINUX_OBJ@" -a "@LINUX_OBJ@" != "@LINUX@" ]; then \
- RPMARGS="$$RPMARGS --define \"kobjdir @LINUX_OBJ@\""; \
- fi; \
- fi; \
- CONFIGURE_ARGS=$$(echo $$(eval echo $$CONFIGURE_ARGS) | \
- sed -re 's/--with-release=[^ ][^ ]*//'); \
- RPMARGS="$$RPMARGS --define \"configure_args $$CONFIGURE_ARGS\""; \
- echo "Building ldiskfs RPM with $$RPMARGS"; \
- eval rpmbuild $$RPMARGS -ta $(distdir).tar.gz
-
-srpm: @PACKAGE_TARNAME@.spec dist Makefile
- eval rpmbuild $$RPMARGS -ta $(distdir).tar.gz
+++ /dev/null
-EXTRA_DIST = ldiskfs.m4 ldiskfs-build.m4 ldiskfs-build-linux.m4
+++ /dev/null
-#
-# LB_LINUX_VERSION
-#
-# Set things accordingly for a linux kernel
-#
-AC_DEFUN([LB_LINUX_VERSION],[
-KMODEXT=".ko"
-
-MODULE_TARGET="SUBDIRS"
-makerule="$PWD/build"
-AC_MSG_CHECKING([for external module build support])
-rm -f build/conftest.i
-LB_LINUX_TRY_MAKE([],[],
- [$makerule LUSTRE_KERNEL_TEST=conftest.i],
- [test -s build/conftest.i],
- [
- AC_MSG_RESULT([no])
- ],[
- makerule="_module_$makerule"
- MODULE_TARGET="M"
- LB_LINUX_TRY_MAKE([],[],
- [$makerule LUSTRE_KERNEL_TEST=conftest.i],
- [test -s build/conftest.i],
- [
- AC_MSG_RESULT([yes])
- ],[
- AC_MSG_ERROR([unknown; check config.log for details])
- ])
- ])
-
-AC_SUBST(MODULE_TARGET)
-AC_SUBST(KMODEXT)
-])
-
-#
-# LB_LINUX_RELEASE
-#
-# get the release version of linux
-#
-AC_DEFUN([LB_LINUX_RELEASE],
-[LINUXRELEASE=
-rm -f build/conftest.i
-AC_MSG_CHECKING([for Linux release])
-if test -s $LINUX_OBJ/include/$AUTOCONF_HDIR/utsrelease.h ; then
- LINUXRELEASEHEADER=$AUTOCONF_HDIR/utsrelease.h
-else
- LINUXRELEASEHEADER=linux/version.h
-fi
-LB_LINUX_TRY_MAKE([
- #include <$LINUXRELEASEHEADER>
-],[
- char *LINUXRELEASE;
- LINUXRELEASE=UTS_RELEASE;
-],[
- $makerule LUSTRE_KERNEL_TEST=conftest.i
-],[
- test -s build/conftest.i
-],[
- # LINUXRELEASE="UTS_RELEASE"
- eval $(grep "LINUXRELEASE=" build/conftest.i)
-],[
- AC_MSG_RESULT([unknown])
- AC_MSG_ERROR([Could not preprocess test program. Consult config.log for details.])
-])
-rm -f build/conftest.i
-if test x$LINUXRELEASE = x ; then
- AC_MSG_RESULT([unknown])
- AC_MSG_ERROR([Could not determine Linux release version from linux/version.h.])
-fi
-AC_MSG_RESULT([$LINUXRELEASE])
-AC_SUBST(LINUXRELEASE)
-
-moduledir='/lib/modules/'$LINUXRELEASE/updates/kernel
-AC_SUBST(moduledir)
-
-modulefsdir='$(moduledir)/fs/$(PACKAGE)'
-AC_SUBST(modulefsdir)
-
-modulenetdir='$(moduledir)/net/$(PACKAGE)'
-AC_SUBST(modulenetdir)
-
-# ------------ RELEASE --------------------------------
-AC_MSG_CHECKING([for ldiskfs release])
-AC_ARG_WITH([release],
- AC_HELP_STRING([--with-release=string],
- [set the release string (default=$kvers_YYYYMMDDhhmm)]),
- [RELEASE=$withval],
- RELEASE=""
- if test -n "$DOWNSTREAM_RELEASE"; then
- RELEASE="${DOWNSTREAM_RELEASE}_"
- fi
- RELEASE="$RELEASE`echo ${LINUXRELEASE} | tr '-' '_'`_$BUILDID")
-AC_MSG_RESULT($RELEASE)
-AC_SUBST(RELEASE)
-
-# check is redhat/suse kernels
-AC_MSG_CHECKING([that RedHat kernel])
-LB_LINUX_TRY_COMPILE([
- #include <linux/version.h>
- ],[
- #ifndef RHEL_RELEASE_CODE
- #error "not redhat kernel"
- #endif
- ],[
- RHEL_KERNEL="yes"
- AC_MSG_RESULT([yes])
- ],[
- AC_MSG_RESULT([no])
-])
-
-LB_LINUX_CONFIG([SUSE_KERNEL],[SUSE_KERNEL="yes"],[])
-
-])
-
-# LB_ARG_REPLACE_PATH(PACKAGE, PATH)
-AC_DEFUN([LB_ARG_REPLACE_PATH],[
- new_configure_args=
- eval "set x $ac_configure_args"
- shift
- for arg; do
- case $arg in
- --with-[$1]=*)
- arg=--with-[$1]=[$2]
- ;;
- *\'*)
- arg=$(printf %s\n ["$arg"] | \
- sed "s/'/'\\\\\\\\''/g")
- ;;
- esac
- dnl AS_VAR_APPEND([new_configure_args], [" '$arg'"])
- new_configure_args="$new_configure_args \"$arg\""
- done
- ac_configure_args=$new_configure_args
-])
-
-# this is the work-horse of the next function
-AC_DEFUN([__LB_ARG_CANON_PATH], [
- [$3]=$(readlink -f $with_$2)
- LB_ARG_REPLACE_PATH([$1], $[$3])
-])
-
-# a front-end for the above function that transforms - and . in the
-# PACKAGE portion of --with-PACKAGE into _ suitable for variable names
-AC_DEFUN([LB_ARG_CANON_PATH], [
- __LB_ARG_CANON_PATH([$1], m4_translit([$1], [-.], [__]), [$2])
-])
-
-#
-#
-# LB_LINUX_PATH
-#
-# Find paths for linux, handling kernel-source rpms
-#
-AC_DEFUN([LB_LINUX_PATH],
-[# prep some default values
-for DEFAULT_LINUX in /lib/modules/$(uname -r)/{source,build} /usr/src/linux; do
- if readlink -q -e $DEFAULT_LINUX; then
- break
- fi
-done
-if test "$DEFAULT_LINUX" = "/lib/modules/$(uname -r)/source"; then
- PATHS="/lib/modules/$(uname -r)/build"
-fi
-PATHS+=" $DEFAULT_LINUX"
-for DEFAULT_LINUX_OBJ in $PATHS; do
- if readlink -q -e $DEFAULT_LINUX_OBJ; then
- break
- fi
-done
-AC_MSG_CHECKING([for Linux sources])
-AC_ARG_WITH([linux],
- AC_HELP_STRING([--with-linux=path],
- [set path to Linux source (default=/lib/modules/$(uname -r)/{source,build},/usr/src/linux)]),
- [LB_ARG_CANON_PATH([linux], [LINUX])
- DEFAULT_LINUX_OBJ=$LINUX],
- [LINUX=$DEFAULT_LINUX])
-AC_MSG_RESULT([$LINUX])
-AC_SUBST(LINUX)
-
-# -------- check for linux --------
-LB_CHECK_FILE([$LINUX],[],
- [AC_MSG_ERROR([Kernel source $LINUX could not be found.])])
-
-# -------- linux objects (for 2.6) --
-AC_MSG_CHECKING([for Linux objects dir])
-AC_ARG_WITH([linux-obj],
- AC_HELP_STRING([--with-linux-obj=path],
- [set path to Linux objects dir (default=/lib/modules/$(uname -r)/build,/usr/src/linux)]),
- [LB_ARG_CANON_PATH([linux-obj], [LINUX_OBJ])],
- [LINUX_OBJ=$DEFAULT_LINUX_OBJ])
-
-AC_MSG_RESULT([$LINUX_OBJ])
-AC_SUBST(LINUX_OBJ)
-
-# -------- check for .config --------
-AC_ARG_WITH([linux-config],
- [AC_HELP_STRING([--with-linux-config=path],
- [set path to Linux .conf (default=$LINUX_OBJ/.config)])],
- [LB_ARG_CANON_PATH([linux-config], [LINUX_CONFIG])],
- [LINUX_CONFIG=$LINUX_OBJ/.config])
-AC_SUBST(LINUX_CONFIG)
-
-LB_CHECK_FILE([/boot/kernel.h],
- [KERNEL_SOURCE_HEADER='/boot/kernel.h'],
- [LB_CHECK_FILE([/var/adm/running-kernel.h],
- [KERNEL_SOURCE_HEADER='/var/adm/running-kernel.h'])])
-
-AC_ARG_WITH([kernel-source-header],
- AC_HELP_STRING([--with-kernel-source-header=path],
- [Use a different kernel version header. Consult build/README.kernel-source for details.]),
- [LB_ARG_CANON_PATH([kernel-source-header], [KERNEL_SOURCE_HEADER])])
-
-# ------------ .config exists ----------------
-LB_CHECK_FILE([$LINUX_CONFIG],[],
- [AC_MSG_ERROR([Kernel config could not be found. If you are building from a kernel-source rpm consult build/README.kernel-source])])
-
-# ----------- make dep run? ------------------
-# at 2.6.19 # $LINUX/include/linux/config.h is removed
-# and at more old has only one line
-# include <autoconf.h>
-LB_CHECK_FILE([$LINUX_OBJ/include/generated/autoconf.h],[AUTOCONF_HDIR=generated],
- [LB_CHECK_FILE([$LINUX_OBJ/include/linux/autoconf.h],[AUTOCONF_HDIR=linux],
- [AC_MSG_ERROR([Run make config in $LINUX.])])])
- AC_SUBST(AUTOCONF_HDIR)
-LB_CHECK_FILE([$LINUX_OBJ/include/linux/version.h],[],
- [AC_MSG_ERROR([Run make config in $LINUX.])])
-
-# ----------- kconfig.h exists ---------------
-# kernel 3.1, $LINUX/include/linux/kconfig.h is added
-# see kernel commit 2a11c8ea20bf850b3a2c60db8c2e7497d28aba99
-LB_CHECK_FILE([$LINUX_OBJ/include/linux/kconfig.h],
- [CONFIG_INCLUDE=include/linux/kconfig.h],
- [CONFIG_INCLUDE=include/$AUTOCONF_HDIR/autoconf.h])
- AC_SUBST(CONFIG_INCLUDE)
-
-# ------------ rhconfig.h includes runtime-generated bits --
-# red hat kernel-source checks
-
-# we know this exists after the check above. if the user
-# tarred up the tree and ran make dep etc. in it, then
-# version.h gets overwritten with a standard linux one.
-
-if grep rhconfig $LINUX_OBJ/include/linux/version.h >/dev/null ; then
- # This is a clean kernel-source tree, we need to
- # enable extensive workarounds to get this to build
- # modules
- LB_CHECK_FILE([$KERNEL_SOURCE_HEADER],
- [if test $KERNEL_SOURCE_HEADER = '/boot/kernel.h' ; then
- AC_MSG_WARN([Using /boot/kernel.h from RUNNING kernel.])
- AC_MSG_WARN([If this is not what you want, use --with-kernel-source-header.])
- AC_MSG_WARN([Consult build/README.kernel-source for details.])
- fi],
- [AC_MSG_ERROR([$KERNEL_SOURCE_HEADER not found. Consult build/README.kernel-source for details.])])
- EXTRA_KCFLAGS="-include $KERNEL_SOURCE_HEADER $EXTRA_KCFLAGS"
-fi
-
-# this is needed before we can build modules
-LB_LINUX_UML
-LB_LINUX_VERSION
-
-# --- check that we can build modules at all
-AC_MSG_CHECKING([that modules can be built at all])
-LB_LINUX_TRY_COMPILE([],[],[
- AC_MSG_RESULT([yes])
-],[
- AC_MSG_RESULT([no])
- AC_MSG_WARN([Consult config.log for details.])
- AC_MSG_WARN([If you are trying to build with a kernel-source rpm, consult build/README.kernel-source])
- AC_MSG_ERROR([Kernel modules cannot be built.])
-])
-
-LB_LINUX_RELEASE
-]) # end of LB_LINUX_PATH
-
-# LB_LINUX_SYMVERFILE
-# SLES 9 uses a different name for this file - unsure about vanilla kernels
-# around this version, but it matters for servers only.
-AC_DEFUN([LB_LINUX_SYMVERFILE],
- [AC_MSG_CHECKING([name of module symbol version file])
- if grep -q Modules.symvers $LINUX/scripts/Makefile.modpost ; then
- SYMVERFILE=Modules.symvers
- else
- SYMVERFILE=Module.symvers
- fi
- AC_MSG_RESULT($SYMVERFILE)
- AC_SUBST(SYMVERFILE)
-])
-
-#
-#
-# LB_LINUX_MODPOST
-#
-# Find modpost and check it
-#
-AC_DEFUN([LB_LINUX_MODPOST],
-[
-# Find the modpost utility
-LB_CHECK_FILE([$LINUX_OBJ/scripts/mod/modpost],
- [MODPOST=$LINUX_OBJ/scripts/mod/modpost],
- [LB_CHECK_FILE([$LINUX_OBJ/scripts/modpost],
- [MODPOST=$LINUX_OBJ/scripts/modpost],
- AC_MSG_ERROR([modpost not found.])
- )]
-)
-AC_SUBST(MODPOST)
-
-# Ensure it can run
-AC_MSG_CHECKING([if modpost can be run])
-if $MODPOST ; then
- AC_MSG_RESULT([yes])
-else
- AC_MSG_ERROR([modpost can not be run.])
-fi
-
-# Check if modpost supports (and therefore requires) -m
-AC_MSG_CHECKING([if modpost supports -m])
-if $MODPOST -m 2>/dev/null ; then
- AC_MSG_RESULT([yes])
- MODPOST_ARGS=-m
-else
- AC_MSG_RESULT([no])
- MODPOST_ARGS=""
-fi
-AC_SUBST(MODPOST_ARGS)
-])
-
-#
-# LB_LINUX_UML
-#
-# check for a uml kernel
-#
-AC_DEFUN([LB_LINUX_UML],
-[ARCH_UM=
-UML_CFLAGS=
-
-AC_MSG_CHECKING([if you are running user mode linux for $target_cpu])
-if test -e $LINUX/include/asm-um ; then
- if test X`ls -id $LINUX/include/asm/ 2>/dev/null | awk '{print [$]1}'` = X`ls -id $LINUX/include/asm-um 2>/dev/null | awk '{print [$]1}'` ; then
- ARCH_UM='ARCH=um'
- # see notes in Rules.in
- UML_CFLAGS='-O0'
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT([no])
- fi
-else
- AC_MSG_RESULT([no (asm-um missing)])
-fi
-AC_SUBST(ARCH_UM)
-AC_SUBST(UML_CFLAGS)
-])
-
-# these are like AC_TRY_COMPILE, but try to build modules against the
-# kernel, inside the build directory
-
-# LB_LANG_PROGRAM(C)([PROLOGUE], [BODY])
-# --------------------------------------
-m4_define([LB_LANG_PROGRAM],
-[
-#include <linux/kernel.h>
-$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;
-}])
-
-#
-# LB_LINUX_COMPILE_IFELSE
-#
-# like AC_COMPILE_IFELSE
-#
-AC_DEFUN([LB_LINUX_COMPILE_IFELSE],
-[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
-rm -f build/conftest.o build/conftest.mod.c build/conftest.ko
-AS_IF([AC_TRY_COMMAND(cp conftest.c build && make -d [$2] ${LD:+"LD=$LD"} CC="$CC" -f $PWD/build/Makefile LUSTRE_LINUX_CONFIG=$LINUX_CONFIG LINUXINCLUDE="$EXTRA_LNET_INCLUDE -I$LINUX/arch/`echo $target_cpu|sed -e 's/powerpc64/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/'`/include -I$LINUX/arch/`echo $target_cpu|sed -e 's/ppc.*/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/'`/include/generated -I$LINUX_OBJ/include -I$LINUX/include -I$LINUX_OBJ/include2 -include $CONFIG_INCLUDE" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM $MODULE_TARGET=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])],
- [$4],
- [_AC_MSG_LOG_CONFTEST
-m4_ifvaln([$5],[$5])dnl])
-rm -f build/conftest.o build/conftest.mod.c build/conftest.mod.o build/conftest.ko m4_ifval([$1], [build/conftest.c conftest.c])[]dnl
-])
-
-#
-# LB_LINUX_ARCH
-#
-# Determine the kernel's idea of the current architecture
-#
-AC_DEFUN([LB_LINUX_ARCH],
- [AC_MSG_CHECKING([Linux kernel architecture])
- AS_IF([rm -f $PWD/build/arch
- make -s --no-print-directory echoarch -f $PWD/build/Makefile \
- LUSTRE_LINUX_CONFIG=$LINUX_CONFIG -C $LINUX $ARCH_UM \
- ARCHFILE=$PWD/build/arch && LINUX_ARCH=`cat $PWD/build/arch`],
- [AC_MSG_RESULT([$LINUX_ARCH])],
- [AC_MSG_ERROR([Could not determine the kernel architecture.])])
- rm -f build/arch])
-
-#
-# LB_LINUX_TRY_COMPILE
-#
-# like AC_TRY_COMPILE
-#
-AC_DEFUN([LB_LINUX_TRY_COMPILE],
-[LB_LINUX_COMPILE_IFELSE(
- [AC_LANG_SOURCE([LB_LANG_PROGRAM([[$1]], [[$2]])])],
- [modules],
- [test -s build/conftest.o],
- [$3], [$4])])
-
-#
-# LB_LINUX_CONFIG
-#
-# check if a given config option is defined
-#
-AC_DEFUN([LB_LINUX_CONFIG],[
- AC_MSG_CHECKING([if Linux was built with CONFIG_$1])
- LB_LINUX_TRY_COMPILE([
- #include <$AUTOCONF_HDIR/autoconf.h>
- ],[
- #ifndef CONFIG_$1
- #error CONFIG_$1 not #defined
- #endif
- ],[
- AC_MSG_RESULT([yes])
- $2
- ],[
- AC_MSG_RESULT([no])
- $3
- ])
-])
-
-#
-# LB_LINUX_CONFIG_IM
-#
-# check if a given config option is builtin or as module
-#
-AC_DEFUN([LB_LINUX_CONFIG_IM],[
- AC_MSG_CHECKING([if Linux was built with CONFIG_$1 in or as module])
- LB_LINUX_TRY_COMPILE([
- #include <$AUTOCONF_HDIR/autoconf.h>
- ],[
- #if !(defined(CONFIG_$1) || defined(CONFIG_$1_MODULE))
- #error CONFIG_$1 and CONFIG_$1_MODULE not #defined
- #endif
- ],[
- AC_MSG_RESULT([yes])
- $2
- ],[
- AC_MSG_RESULT([no])
- $3
- ])
-])
-
-#
-# LB_LINUX_TRY_MAKE
-#
-# like LB_LINUX_TRY_COMPILE, but with different arguments
-#
-AC_DEFUN([LB_LINUX_TRY_MAKE],
- [LB_LINUX_COMPILE_IFELSE(
- [AC_LANG_SOURCE(
- [LB_LANG_PROGRAM([[$1]], [[$2]])]
- )],
- [$3], [$4], [$5], [$6]
- )]
-)
-
-# LC_MODULE_LOADING
-# after 2.6.28 CONFIG_KMOD is removed, and only CONFIG_MODULES remains
-# so we test if request_module is implemented or not
-AC_DEFUN([LC_MODULE_LOADING],
-[AC_MSG_CHECKING([if kernel module loading is possible])
-LB_LINUX_TRY_MAKE([
- #include <linux/kmod.h>
-],[
- int myretval=ENOSYS ;
- return myretval;
-],[
- $makerule LUSTRE_KERNEL_TEST=conftest.i
-],[dnl
- grep request_module build/conftest.i |dnl
- grep -v `grep "int myretval=" build/conftest.i |dnl
- cut -d= -f2 | cut -d" " -f1`dnl
- >/dev/null dnl
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_MODULE_LOADING_SUPPORT, 1,
- [kernel module loading is possible])
-],[
- AC_MSG_RESULT(no)
- AC_MSG_WARN([])
- AC_MSG_WARN([Kernel module loading support is highly recommended.])
- AC_MSG_WARN([])
-])
-])
-
-#
-# LB_PROG_LINUX
-#
-# linux tests
-#
-AC_DEFUN([LB_PROG_LINUX],
-[LB_LINUX_PATH
-LB_LINUX_ARCH
-LB_LINUX_SYMVERFILE
-
-
-LB_LINUX_CONFIG([MODULES],[],[
- AC_MSG_ERROR([module support is required to build ldiskfs kernel module.])
-])
-
-LB_LINUX_CONFIG([MODVERSIONS])
-
-LB_LINUX_CONFIG([KALLSYMS],[],[
-if test "x$ARCH_UM" = "x" ; then
- AC_MSG_ERROR([ldiskfs requires that CONFIG_KALLSYMS is enabled in your kernel.])
-fi
-])
-
-# 2.6.28
-LC_MODULE_LOADING
-])
-
-#
-# LB_CHECK_SYMBOL_EXPORT
-# check symbol exported or not
-# $1 - symbol
-# $2 - file(s) for find.
-# $3 - do 'yes'
-# $4 - do 'no'
-#
-# 2.6 based kernels - put modversion info into $LINUX/Module.modvers
-# or check
-AC_DEFUN([LB_CHECK_SYMBOL_EXPORT],
-[AC_MSG_CHECKING([if Linux was built with symbol $1 exported])
-grep -q -E '[[[:space:]]]$1[[[:space:]]]' $LINUX/$SYMVERFILE 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
-])
-
-#
-# Like AC_CHECK_HEADER but checks for a kernel-space header
-#
-m4_define([LB_CHECK_LINUX_HEADER],
-[AS_VAR_PUSHDEF([ac_Header], [ac_cv_header_$1])dnl
-AC_CACHE_CHECK([for $1], ac_Header,
- [LB_LINUX_COMPILE_IFELSE([LB_LANG_PROGRAM([@%:@include <$1>])],
- [modules],
- [test -s build/conftest.o],
- [AS_VAR_SET(ac_Header, [yes])],
- [AS_VAR_SET(ac_Header, [no])])])
-AS_IF([test AS_VAR_GET(ac_Header) = yes], [$2], [$3])[]dnl
-AS_VAR_POPDEF([ac_Header])dnl
-])
+++ /dev/null
-#
-# LB_DOWNSTREAM_RELEASE
-#
-AC_DEFUN([LB_DOWNSTREAM_RELEASE],
-[AC_ARG_WITH([downstream-release],
- AC_HELP_STRING([--with-downstream-release=string],
- [set a string in the BUILD_VERSION and RPM Release: (default is nothing)]),
- [DOWNSTREAM_RELEASE=$with_downstream_release],
- [
- # if not specified, see if it's in the META file
- if test -f META; then
- DOWNSTREAM_RELEASE=$(sed -ne '/^LOCAL_VERSION =/s/.*= *//p' META)
- fi
- ])
-AC_SUBST(DOWNSTREAM_RELEASE)
-])
-
-#
-# LB_BUILDID
-#
-# Check if the source is a GA release and if not, set a "BUILDID"
-#
-# Currently there are at least two ways/modes of/for doing this. One
-# is if we are in a valid git repository, the other is if we are in a
-# non-git source tree of some form. Building the latter from the former
-# will be handled here.
-AC_DEFUN([LB_BUILDID],
-[
-AC_MSG_CHECKING([for buildid])
-BUILDID=""
-if git branch >/dev/null 2>&1; then
- ffw=0
- hash=""
- ver=$(git describe --match v[[0-9]]_*_[[0-9]]* --tags)
- if [[[ $ver = *-*-* ]]]; then
- hash=${ver##*-}
- ffw=${ver#*-}
- ffw=${ffw%-*}
- ver=${ver%%-*}
- fi
- # it's tempting to use [[ $ver =~ ^v([0-9]+_)+([0-9]+|RC[0-9]+)$ ]]
- # here but the portability of the regex on the right is dismal
- # (thanx suse)
- if echo "$ver" | egrep -q "^v([[0-9]]+_)+([[0-9]]+|RC[[0-9]]+)$"; then
- ver=$(echo $ver | sed -e 's/^v\(.*\)/\1/' \
- -e 's/_RC[[0-9]].*$//' -e 's/_/./g')
- fi
-
- # a "lustre fix" value of .0 should be truncated
- if [[[ $ver = *.*.*.0 ]]]; then
- ver=${ver%.0}
- fi
- # ditto for a "lustre fix" value of _0
- if [[[ $ver = v*_*_*_0 ]]]; then
- ver=${ver%_0}
- fi
- if [[[ $ver = v*_*_* ]]]; then
- ver=${ver#v}
- ver=${ver//_/.}
- fi
-
- if test "$ffw" != "0"; then
- BUILDID="$hash"
- msg="$BUILDID (ahead by $ffw commits)"
- AC_MSG_RESULT([$msg])
- else
- AC_MSG_RESULT([none... congratulations, you must be on a tag])
- fi
-elif test -f META; then
- BUILDID=$(sed -ne '/^BUILDID =/s/.*= *//p' META)
- msg="$BUILDID (from META file)"
- AC_MSG_RESULT([$msg])
-else
- AC_MSG_WARN([FIXME: I don't know how to deal with source trees outside of git that don't have a META file. Not setting a buildid.])
-fi
-AC_SUBST(BUILDID)
-])
-
-#
-# LB_CHECK_FILE
-#
-# Check for file existance even when cross compiling
-#
-AC_DEFUN([LB_CHECK_FILE],
-[AS_VAR_PUSHDEF([lb_File], [lb_cv_file_$1])dnl
-AC_CACHE_CHECK([for $1], lb_File,
-[if test -r "$1"; then
- AS_VAR_SET(lb_File, yes)
-else
- AS_VAR_SET(lb_File, no)
-fi])
-AS_IF([test AS_VAR_GET(lb_File) = yes], [$2], [$3])[]dnl
-AS_VAR_POPDEF([lb_File])dnl
-])# LB_CHECK_FILE
-
-#
-# LB_CONFIG_HEADERS
-#
-# add -include config.h
-#
-AC_DEFUN([LB_CONFIG_HEADERS],[
- AC_CONFIG_HEADERS([config.h])
- CPPFLAGS="-include $PWD/config.h $CPPFLAGS"
- EXTRA_KCFLAGS="-include $PWD/config.h $EXTRA_KCFLAGS"
- AC_SUBST(EXTRA_KCFLAGS)
-])
-
-#
-# LB_INCLUDE_RULES
-#
-# defines for including the toplevel Rules
-#
-AC_DEFUN([LB_INCLUDE_RULES],[
- INCLUDE_RULES="include $PWD/Rules"
- AC_SUBST(INCLUDE_RULES)
-])
-
-#
-# LB_PROG_CC
-#
-# checks on the C compiler
-#
-AC_DEFUN([LB_PROG_CC],
-[AC_PROG_RANLIB
-
-# --------- unsigned long long sane? -------
-AC_CHECK_SIZEOF(unsigned long long, 0)
-echo "---> size SIZEOF $SIZEOF_unsigned_long_long"
-echo "---> size SIZEOF $ac_cv_sizeof_unsigned_long_long"
-if test $ac_cv_sizeof_unsigned_long_long != 8 ; then
- AC_MSG_ERROR([** we assume that sizeof(long long) == 8.])
-fi
-
-if test $target_cpu == "powerpc64"; then
- AC_MSG_WARN([set compiler with -m64])
- CFLAGS="$CFLAGS -m64"
- CC="$CC -m64"
-fi
-
-LLCPPFLAGS="-D__arch_lib__ -D_LARGEFILE64_SOURCE=1"
-AC_SUBST(LLCPPFLAGS)
-
-# Add _GNU_SOURCE for strnlen on linux
-LLCFLAGS="-g -Wall -fPIC -D_GNU_SOURCE"
-AC_SUBST(LLCFLAGS)
-
-CCASFLAGS="-Wall -fPIC -D_GNU_SOURCE"
-AC_SUBST(CCASFLAGS)
-])
-
-#
-# LB_CONFIG_FILES
-#
-# build-specific config files
-#
-AC_DEFUN([LB_CONFIG_FILES],
-[
- AC_CONFIG_FILES([
- Makefile
- autoMakefile]
- [Rules:build/Rules.in]
- AC_PACKAGE_TARNAME[.spec]
- )
-])
+++ /dev/null
-
-#
-# LB_LDISKFS_EXT_DIR
-#
-# Determine the location of the ext4 source code. It is required
-# for several configure tests and to build ldiskfs.
-#
-AC_DEFUN([LB_LDISKFS_EXT_DIR],
-[
-# Kernel ext source located with devel headers
-linux_src=$LINUX
-if test -e "$linux_src/fs/ext4/super.c"; then
- EXT_DIR=$linux_src/fs/ext4
-else
- # Kernel ext source provided by kernel-debuginfo-common package
- linux_src=$(ls -1d /usr/src/debug/*/linux-$LINUXRELEASE \
- 2>/dev/null | tail -1)
- if test -e "$linux_src/fs/ext4/super.c"; then
- EXT_DIR=$linux_src/fs/ext4
- else
- EXT_DIR=
- fi
-fi
-
-AC_MSG_CHECKING([ext4 source directory])
-AC_MSG_RESULT([$EXT_DIR])
-AC_SUBST(EXT_DIR)
-])
-
-#
-# LB_LDISKFS_EXT_SOURCE
-#
-# Spot check the existance of several source files common to ext4.
-# Detecting this at configure time allows us to avoid a potential build
-# failure and provide a useful error message to explain what is wrong.
-#
-AC_DEFUN([LB_LDISKFS_EXT_SOURCE],
-[
-if test x$EXT_DIR = x; then
- enable_ldiskfs_build='no'
-else
- LB_CHECK_FILE([$EXT_DIR/dir.c], [], [
- enable_ldiskfs_build='no'
- AC_MSG_WARN([ext4 must exist for ldiskfs build])])
- LB_CHECK_FILE([$EXT_DIR/file.c], [], [
- enable_ldiskfs_build='no'
- AC_MSG_WARN([ext4 must exist for ldiskfs build])])
- LB_CHECK_FILE([$EXT_DIR/inode.c], [], [
- enable_ldiskfs_build='no'
- AC_MSG_WARN([ext4 must exist for ldiskfs build])])
- LB_CHECK_FILE([$EXT_DIR/super.c], [], [
- enable_ldiskfs_build='no'
- AC_MSG_WARN([ext4 must exist for ldiskfs build])])
-fi
-
-if test x$enable_ldiskfs_build = xno; then
- enable_server='no'
- enable_ldiskfs_build='no'
- with_ldiskfs='no'
- LDISKFS_SUBDIR=
-
- AC_MSG_WARN([
-
-Disabling server because complete ext4 source does not exist.
-
-If you are building using kernel-devel packages and require ldiskfs
-server support then ensure that the matching kernel-debuginfo-common
-and kernel-debuginfo-common-<arch> packages are installed.
-
-])
-
-fi
-])
-
-#
-# LB_LDISKFS_DEFINE_OPTIONS
-#
-# Enable config options related to ldiskfs. These are used by ldiskfs,
-# lvfs, and the osd-ldiskfs code (which includes ldiskfs headers.)
-#
-AC_DEFUN([LB_LDISKFS_DEFINE_OPTIONS],
-[
-AC_DEFINE(HAVE_LDISKFS_OSD, 1, Enable ldiskfs osd)
-
-with_ldiskfs_pdo=no
-case $LINUXRELEASE in
-2.6.32*)
- if test x$RHEL_KERNEL = xyes; then
- with_ldiskfs_pdo=yes
- AC_DEFINE(HAVE_LDISKFS_PDO, 1, [have ldiskfs PDO patch])
- fi
- if test x$SUSE_KERNEL = xyes; then
- with_ldiskfs_pdo=yes
- AC_DEFINE(HAVE_LDISKFS_PDO, 1, [have ldiskfs PDO patch])
- fi
- ;;
-esac
-LB_LDISKFS_JBD2_JOURNAL_CALLBACK_SET
-
-AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1,
- [enable extended attributes for ldiskfs])
-AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1,
- [enable posix acls for ldiskfs])
-AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1,
- [enable fs security for ldiskfs])
-AC_DEFINE(CONFIG_LDISKFSDEV_FS_POSIX_ACL, 1,
- [enable posix acls for ldiskfs])
-AC_DEFINE(CONFIG_LDISKFSDEV_FS_XATTR, 1,
- [enable extented attributes for ldiskfs])
-AC_DEFINE(CONFIG_LDISKFSDEV_FS_SECURITY, 1,
- [enable fs security for ldiskfs])
-])
-
-#
-# Check for jbd2_journal_callback_set(), which is needed for commit
-# callbacks. When LU-433 lands jbd2_journal_callback_set() will only
-# remain for legacy reasons and AC_MSG_ERROR can be removed.
-#
-AC_DEFUN([LB_LDISKFS_JBD2_JOURNAL_CALLBACK_SET],
-[
- LB_CHECK_SYMBOL_EXPORT([jbd2_journal_callback_set],
- [fs/jbd2/journal.c],
- [AC_DEFINE(HAVE_JBD2_JOURNAL_CALLBACK_SET, 1,
- [kernel exports jbd2_journal_callback_set])])
-])
-
-
-AC_DEFUN([LB_LDISKFS_SYMVERS],
-[
-AC_MSG_CHECKING([ldiskfs module symbols])
-if test -r $LDISKFS_OBJ/Module.symvers; then
- LDISKFS_SYMBOLS=Module.symvers
-elif test -r $LDISKFS_OBJ/Modules.symvers; then
- LDISKFS_SYMBOLS=Modules.symvers
-elif test -r $LDISKFS_OBJ/ldiskfs/Module.symvers; then
- LDISKFS_SYMBOLS=Module.symvers
-elif test -r $LDISKFS_OBJ/ldiskfs/Modules.symvers; then
- LDISKFS_SYMBOLS=Modules.symvers
-else
- LDISKFS_SYMBOLS=$SYMVERFILE
-fi
-
-AC_MSG_RESULT([$LDISKFS_SYMBOLS])
-AC_SUBST(LDISKFS_SYMBOLS)
-])
-
-AC_DEFUN([LB_LDISKFS_RELEASE],
-[
-AC_MSG_CHECKING([ldiskfs source release])
-if test -r $LDISKFS_OBJ/config.h; then
- tmp_flags="$EXTRA_KCFLAGS"
- EXTRA_KCFLAGS="-I$LDISKFS_DIR $EXTRA_KCFLAGS"
- LB_LINUX_TRY_MAKE([
- #undef PACKAGE_NAME
- #undef PACKAGE_TARNAME
- #undef PACKAGE_VERSION
- #undef PACKAGE_STRING
- #undef PACKAGE_BUGREPORT
- #undef PACKAGE
- #undef VERSION
- #undef STDC_HEADERS
-
- #include <$LDISKFS_OBJ/config.h>
- ],[
- char *LDISKFS_RELEASE;
- LDISKFS_RELEASE=VERSION;
- ],[
- $makerule LUSTRE_KERNEL_TEST=conftest.i
- ],[
- test -s build/conftest.i
- ],[
- eval $(grep "LDISKFS_RELEASE=" build/conftest.i)
- ],[
- AC_MSG_RESULT([unknown])
- AC_MSG_ERROR([Could not preprocess test program.])
- ])
- EXTRA_KCFLAGS="$tmp_flags"
- rm build/conftest.i
-elif test -r $LDISKFS_DIR/configure.ac; then
- LDISKFS_RELEASE=$(awk '/AC\_INIT/ { print [$]3 }' \
- $LDISKFS_DIR/configure.ac | tr ',' '\n')
-else
- AC_MSG_RESULT([unknown])
- AC_MSG_ERROR([Could not locate config.h, META, or configure.ac to check release.])
-fi
-
-if test x$LDISKFS_RELEASE = x; then
- AC_MSG_RESULT([unknown])
- AC_MSG_ERROR([Could not determine ldiskfs release.])
-fi
-
-AC_MSG_RESULT([$LDISKFS_RELEASE])
-AC_SUBST(LDISKFS_RELEASE)
-])
-
-AC_DEFUN([LB_LDISKFS_SERIES],
-[
-if $1; then
- AC_MSG_CHECKING([which ldiskfs series to use])
- case $LINUXRELEASE in
- 2.6.18*)
- if test x$RHEL_KERNEL = xyes; then
- LDISKFS_SERIES="2.6-rhel5-ext4.series"
- fi
- ;;
- 2.6.32*)
- if test x$RHEL_KERNEL = xyes; then
- LDISKFS_SERIES="2.6-rhel6.series"
- fi
- if test x$SUSE_KERNEL = xyes; then
- LDISKFS_SERIES="2.6-sles11.series"
- fi
- ;;
- *)
- AC_MSG_WARN([Unknown kernel version $LINUXRELEASE])
- LDISKFS_SERIES=
- ;;
- esac
- AC_MSG_RESULT([$LDISKFS_SERIES])
-else
- LDISKFS_SERIES=
-fi
-AC_SUBST(LDISKFS_SERIES)
-])
+++ /dev/null
-export QUILT_DIFF_OPTS="-upa"
-export QUILT_NO_DIFF_TIMESTAMPS=1
/config.sub
/install-sh
/missing
-/Makefile.in
--- /dev/null
+AC_DEFUN([LDISKFS_AC_LINUX_VERSION], [
+ AC_MSG_CHECKING([kernel source version])
+
+ utsrelease1=${LINUX_OBJ}/include/linux/version.h
+ utsrelease2=${LINUX_OBJ}/include/linux/utsrelease.h
+ utsrelease3=${LINUX_OBJ}/include/generated/utsrelease.h
+ AS_IF([test -r ${utsrelease1} && fgrep -q UTS_RELEASE ${utsrelease1}], [
+ utsrelease=linux/version.h
+ ], [test -r ${utsrelease2} && fgrep -q UTS_RELEASE ${utsrelease2}], [
+ utsrelease=linux/utsrelease.h
+ ], [test -r ${utsrelease3} && fgrep -q UTS_RELEASE ${utsrelease3}], [
+ utsrelease=generated/utsrelease.h
+ ])
+
+ AS_IF([test "${utsrelease}"], [
+ kernsrcver=$((echo "#include <$utsrelease>";
+ echo "kernsrcver=UTS_RELEASE") |
+ cpp -I ${LINUX_OBJ}/include |
+ grep "^kernsrcver=" | cut -d \" -f 2)
+
+ AS_IF([test -z "$kernsrcver"], [
+ AC_MSG_RESULT([Not found])
+ AC_MSG_ERROR([*** Cannot determine kernel version.])
+ ])
+ ], [
+ AC_MSG_RESULT([Not found])
+ AC_MSG_ERROR([
+ *** Cannot find UTS_RELEASE definition.
+ *** This is often provided by the kernel-devel package.])
+ ])
+
+ AC_MSG_RESULT([${kernsrcver}])
+
+ LINUX_VERSION=${kernsrcver}
+ AC_SUBST(LINUX_VERSION)
+ LINUXRELEASE=${kernsrcver}
+ AC_SUBST(LINUXRELEASE)
+])
+
+#
+# LB_LINUX_RELEASE
+#
+# get the release version of linux
+#
+
+AC_DEFUN([LB_LINUX_RELEASE],
+[
+LDISKFS_AC_LINUX_VERSION
+
+# ------------ RELEASE --------------------------------
+AC_MSG_CHECKING([for ldiskfs release])
+AC_ARG_WITH([release],
+ AC_HELP_STRING([--with-release=string],
+ [set the release string (default=$kvers_YYYYMMDDhhmm)]),
+ [RELEASE=$withval],
+ RELEASE=""
+ if test -n "$DOWNSTREAM_RELEASE"; then
+ RELEASE="${DOWNSTREAM_RELEASE}_"
+ fi
+ RELEASE="$RELEASE`echo ${LINUXRELEASE} | tr '-' '_'`_$BUILDID")
+AC_MSG_RESULT($RELEASE)
+AC_SUBST(RELEASE)
+
+# check is redhat/suse kernels
+AC_MSG_CHECKING([that RedHat kernel])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/version.h>
+ ],[
+ #ifndef RHEL_RELEASE_CODE
+ #error "not redhat kernel"
+ #endif
+ ],[
+ RHEL_KERNEL="yes"
+ AC_MSG_RESULT([yes])
+ ],[
+ AC_MSG_RESULT([no])
+])
+
+LB_LINUX_CONFIG([SUSE_KERNEL],[SUSE_KERNEL="yes"],[])
+
+])
+
+# LB_ARG_REPLACE_PATH(PACKAGE, PATH)
+AC_DEFUN([LB_ARG_REPLACE_PATH],[
+ new_configure_args=
+ eval "set x $ac_configure_args"
+ shift
+ for arg; do
+ case $arg in
+ --with-[$1]=*)
+ arg=--with-[$1]=[$2]
+ ;;
+ *\'*)
+ arg=$(printf %s\n ["$arg"] | \
+ sed "s/'/'\\\\\\\\''/g")
+ ;;
+ esac
+ dnl AS_VAR_APPEND([new_configure_args], [" '$arg'"])
+ new_configure_args="$new_configure_args \"$arg\""
+ done
+ ac_configure_args=$new_configure_args
+])
+
+# this is the work-horse of the next function
+AC_DEFUN([__LB_ARG_CANON_PATH], [
+ [$3]=$(readlink -f $with_$2)
+ LB_ARG_REPLACE_PATH([$1], $[$3])
+])
+
+# a front-end for the above function that transforms - and . in the
+# PACKAGE portion of --with-PACKAGE into _ suitable for variable names
+AC_DEFUN([LB_ARG_CANON_PATH], [
+ __LB_ARG_CANON_PATH([$1], m4_translit([$1], [-.], [__]), [$2])
+])
+
+#
+#
+# LB_LINUX_PATH
+#
+# Find paths for linux, handling kernel-source rpms
+#
+AC_DEFUN([LB_LINUX_PATH],
+[# prep some default values
+for DEFAULT_LINUX in /lib/modules/$(uname -r)/{source,build} /usr/src/linux; do
+ if readlink -q -e $DEFAULT_LINUX; then
+ break
+ fi
+done
+if test "$DEFAULT_LINUX" = "/lib/modules/$(uname -r)/source"; then
+ PATHS="/lib/modules/$(uname -r)/build"
+fi
+PATHS+=" $DEFAULT_LINUX"
+for DEFAULT_LINUX_OBJ in $PATHS; do
+ if readlink -q -e $DEFAULT_LINUX_OBJ; then
+ break
+ fi
+done
+AC_MSG_CHECKING([for Linux sources])
+AC_ARG_WITH([linux],
+ AC_HELP_STRING([--with-linux=path],
+ [set path to Linux source (default=/lib/modules/$(uname -r)/{source,build},/usr/src/linux)]),
+ [LB_ARG_CANON_PATH([linux], [LINUX])
+ DEFAULT_LINUX_OBJ=$LINUX],
+ [LINUX=$DEFAULT_LINUX])
+AC_MSG_RESULT([$LINUX])
+AC_SUBST(LINUX)
+
+# -------- check for linux --------
+LB_CHECK_FILE([$LINUX],[],
+ [AC_MSG_ERROR([Kernel source $LINUX could not be found.])])
+
+# -------- linux objects (for 2.6) --
+AC_MSG_CHECKING([for Linux objects dir])
+AC_ARG_WITH([linux-obj],
+ AC_HELP_STRING([--with-linux-obj=path],
+ [set path to Linux objects dir (default=/lib/modules/$(uname -r)/build,/usr/src/linux)]),
+ [LB_ARG_CANON_PATH([linux-obj], [LINUX_OBJ])],
+ [LINUX_OBJ=$DEFAULT_LINUX_OBJ])
+
+AC_MSG_RESULT([$LINUX_OBJ])
+AC_SUBST(LINUX_OBJ)
+
+# -------- check for .config --------
+AC_ARG_WITH([linux-config],
+ [AC_HELP_STRING([--with-linux-config=path],
+ [set path to Linux .conf (default=$LINUX_OBJ/.config)])],
+ [LB_ARG_CANON_PATH([linux-config], [LINUX_CONFIG])],
+ [LINUX_CONFIG=$LINUX_OBJ/.config])
+AC_SUBST(LINUX_CONFIG)
+
+LB_CHECK_FILE([/boot/kernel.h],
+ [KERNEL_SOURCE_HEADER='/boot/kernel.h'],
+ [LB_CHECK_FILE([/var/adm/running-kernel.h],
+ [KERNEL_SOURCE_HEADER='/var/adm/running-kernel.h'])])
+
+AC_ARG_WITH([kernel-source-header],
+ AC_HELP_STRING([--with-kernel-source-header=path],
+ [Use a different kernel version header. Consult build/README.kernel-source for details.]),
+ [LB_ARG_CANON_PATH([kernel-source-header], [KERNEL_SOURCE_HEADER])])
+
+# ------------ .config exists ----------------
+LB_CHECK_FILE([$LINUX_CONFIG],[],
+ [AC_MSG_ERROR([Kernel config could not be found. If you are building from a kernel-source rpm consult build/README.kernel-source])])
+
+# ----------- make dep run? ------------------
+# at 2.6.19 # $LINUX/include/linux/config.h is removed
+# and at more old has only one line
+# include <autoconf.h>
+LB_CHECK_FILE([$LINUX_OBJ/include/generated/autoconf.h],[AUTOCONF_HDIR=generated],
+ [LB_CHECK_FILE([$LINUX_OBJ/include/linux/autoconf.h],[AUTOCONF_HDIR=linux],
+ [AC_MSG_ERROR([Run make config in $LINUX.])])])
+ AC_SUBST(AUTOCONF_HDIR)
+LB_CHECK_FILE([$LINUX_OBJ/include/linux/version.h],[],
+ [AC_MSG_ERROR([Run make config in $LINUX.])])
+
+# ----------- kconfig.h exists ---------------
+# kernel 3.1, $LINUX/include/linux/kconfig.h is added
+# see kernel commit 2a11c8ea20bf850b3a2c60db8c2e7497d28aba99
+LB_CHECK_FILE([$LINUX_OBJ/include/linux/kconfig.h],
+ [CONFIG_INCLUDE=include/linux/kconfig.h],
+ [CONFIG_INCLUDE=include/$AUTOCONF_HDIR/autoconf.h])
+ AC_SUBST(CONFIG_INCLUDE)
+
+# ------------ rhconfig.h includes runtime-generated bits --
+# red hat kernel-source checks
+
+# we know this exists after the check above. if the user
+# tarred up the tree and ran make dep etc. in it, then
+# version.h gets overwritten with a standard linux one.
+
+if grep rhconfig $LINUX_OBJ/include/linux/version.h >/dev/null ; then
+ # This is a clean kernel-source tree, we need to
+ # enable extensive workarounds to get this to build
+ # modules
+ LB_CHECK_FILE([$KERNEL_SOURCE_HEADER],
+ [if test $KERNEL_SOURCE_HEADER = '/boot/kernel.h' ; then
+ AC_MSG_WARN([Using /boot/kernel.h from RUNNING kernel.])
+ AC_MSG_WARN([If this is not what you want, use --with-kernel-source-header.])
+ AC_MSG_WARN([Consult build/README.kernel-source for details.])
+ fi],
+ [AC_MSG_ERROR([$KERNEL_SOURCE_HEADER not found. Consult build/README.kernel-source for details.])])
+ EXTRA_KCFLAGS="-include $KERNEL_SOURCE_HEADER $EXTRA_KCFLAGS"
+fi
+
+# --- check that we can build modules at all
+AC_MSG_CHECKING([that modules can be built at all])
+LB_LINUX_TRY_COMPILE([],[],[
+ AC_MSG_RESULT([yes])
+],[
+ AC_MSG_RESULT([no])
+ AC_MSG_WARN([Consult config.log for details.])
+ AC_MSG_WARN([If you are trying to build with a kernel-source rpm, consult build/README.kernel-source])
+ AC_MSG_ERROR([Kernel modules cannot be built.])
+])
+
+LB_LINUX_RELEASE
+]) # end of LB_LINUX_PATH
+
+# LB_LINUX_SYMVERFILE
+# SLES 9 uses a different name for this file - unsure about vanilla kernels
+# around this version, but it matters for servers only.
+AC_DEFUN([LB_LINUX_SYMVERFILE],
+ [AC_MSG_CHECKING([name of module symbol version file])
+ if grep -q Modules.symvers $LINUX/scripts/Makefile.modpost ; then
+ SYMVERFILE=Modules.symvers
+ else
+ SYMVERFILE=Module.symvers
+ fi
+ AC_MSG_RESULT($SYMVERFILE)
+ AC_SUBST(SYMVERFILE)
+])
+
+# these are like AC_TRY_COMPILE, but try to build modules against the
+# kernel, inside the build directory
+
+# LB_LANG_PROGRAM(C)([PROLOGUE], [BODY])
+# --------------------------------------
+m4_define([LB_LANG_PROGRAM],
+[
+#include <linux/kernel.h>
+$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;
+}])
+
+#
+# LB_LINUX_COMPILE_IFELSE
+#
+# like AC_COMPILE_IFELSE
+#
+AC_DEFUN([LB_LINUX_COMPILE_IFELSE], [
+ m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])
+ rm -Rf build-test && mkdir -p build-test
+ echo "obj-m := conftest.o" >build-test/Makefile
+ AS_IF(
+ [AC_TRY_COMMAND(cp conftest.c build-test && make [$2] -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" M=$PWD/build-test) >/dev/null && AC_TRY_COMMAND([$3])],
+ [$4],
+ [_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])]
+ )
+ rm -Rf build-test
+])
+
+
+#
+# LB_LINUX_TRY_COMPILE
+#
+# like AC_TRY_COMPILE
+#
+AC_DEFUN([LB_LINUX_TRY_COMPILE],
+[LB_LINUX_COMPILE_IFELSE(
+ [AC_LANG_SOURCE([LB_LANG_PROGRAM([[$1]], [[$2]])])],
+ [modules],
+ [test -s build-test/conftest.o],
+ [$3], [$4])])
+
+#
+# LB_LINUX_CONFIG
+#
+# check if a given config option is defined
+#
+AC_DEFUN([LB_LINUX_CONFIG],[
+ AC_MSG_CHECKING([if Linux was built with CONFIG_$1])
+ LB_LINUX_TRY_COMPILE([
+ #include <$AUTOCONF_HDIR/autoconf.h>
+ ],[
+ #ifndef CONFIG_$1
+ #error CONFIG_$1 not #defined
+ #endif
+ ],[
+ AC_MSG_RESULT([yes])
+ $2
+ ],[
+ AC_MSG_RESULT([no])
+ $3
+ ])
+])
+
+#
+# LB_LINUX_CONFIG_IM
+#
+# check if a given config option is builtin or as module
+#
+AC_DEFUN([LB_LINUX_CONFIG_IM],[
+ AC_MSG_CHECKING([if Linux was built with CONFIG_$1 in or as module])
+ LB_LINUX_TRY_COMPILE([
+ #include <$AUTOCONF_HDIR/autoconf.h>
+ ],[
+ #if !(defined(CONFIG_$1) || defined(CONFIG_$1_MODULE))
+ #error CONFIG_$1 and CONFIG_$1_MODULE not #defined
+ #endif
+ ],[
+ AC_MSG_RESULT([yes])
+ $2
+ ],[
+ AC_MSG_RESULT([no])
+ $3
+ ])
+])
+
+#
+# LB_CHECK_SYMBOL_EXPORT
+# check symbol exported or not
+# $1 - symbol
+# $2 - file(s) for find.
+# $3 - do 'yes'
+# $4 - do 'no'
+#
+# 2.6 based kernels - put modversion info into $LINUX/Module.modvers
+# or check
+AC_DEFUN([LB_CHECK_SYMBOL_EXPORT],
+[AC_MSG_CHECKING([if Linux was built with symbol $1 exported])
+grep -q -E '[[[:space:]]]$1[[[:space:]]]' $LINUX/$SYMVERFILE 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
+])
+
+#
+# Like AC_CHECK_HEADER but checks for a kernel-space header
+#
+m4_define([LB_CHECK_LINUX_HEADER],
+[AS_VAR_PUSHDEF([ac_Header], [ac_cv_header_$1])dnl
+AC_CACHE_CHECK([for $1], ac_Header,
+ [LB_LINUX_COMPILE_IFELSE([LB_LANG_PROGRAM([@%:@include <$1>])],
+ [modules],
+ [test -s build-test/conftest.o],
+ [AS_VAR_SET(ac_Header, [yes])],
+ [AS_VAR_SET(ac_Header, [no])])])
+AS_IF([test AS_VAR_GET(ac_Header) = yes], [$2], [$3])[]dnl
+AS_VAR_POPDEF([ac_Header])dnl
+])
+#
+# LB_DOWNSTREAM_RELEASE
+#
+AC_DEFUN([LB_DOWNSTREAM_RELEASE],
+[AC_ARG_WITH([downstream-release],
+ AC_HELP_STRING([--with-downstream-release=string],
+ [set a string in the BUILD_VERSION and RPM Release: (default is nothing)]),
+ [DOWNSTREAM_RELEASE=$with_downstream_release],
+ [
+ # if not specified, see if it's in the META file
+ if test -f META; then
+ DOWNSTREAM_RELEASE=$(sed -ne '/^LOCAL_VERSION =/s/.*= *//p' META)
+ fi
+ ])
+AC_SUBST(DOWNSTREAM_RELEASE)
+])
+
+#
+# LB_BUILDID
+#
+# Check if the source is a GA release and if not, set a "BUILDID"
+#
+# Currently there are at least two ways/modes of/for doing this. One
+# is if we are in a valid git repository, the other is if we are in a
+# non-git source tree of some form. Building the latter from the former
+# will be handled here.
+AC_DEFUN([LB_BUILDID],
+[
+AC_MSG_CHECKING([for buildid])
+BUILDID=""
+if git branch >/dev/null 2>&1; then
+ ffw=0
+ hash=""
+ ver=$(git describe --match v[[0-9]]_*_[[0-9]]* --tags)
+ if [[[ $ver = *-*-* ]]]; then
+ hash=${ver##*-}
+ ffw=${ver#*-}
+ ffw=${ffw%-*}
+ ver=${ver%%-*}
+ fi
+ # it's tempting to use [[ $ver =~ ^v([0-9]+_)+([0-9]+|RC[0-9]+)$ ]]
+ # here but the portability of the regex on the right is dismal
+ # (thanx suse)
+ if echo "$ver" | egrep -q "^v([[0-9]]+_)+([[0-9]]+|RC[[0-9]]+)$"; then
+ ver=$(echo $ver | sed -e 's/^v\(.*\)/\1/' \
+ -e 's/_RC[[0-9]].*$//' -e 's/_/./g')
+ fi
+
+ # a "lustre fix" value of .0 should be truncated
+ if [[[ $ver = *.*.*.0 ]]]; then
+ ver=${ver%.0}
+ fi
+ # ditto for a "lustre fix" value of _0
+ if [[[ $ver = v*_*_*_0 ]]]; then
+ ver=${ver%_0}
+ fi
+ if [[[ $ver = v*_*_* ]]]; then
+ ver=${ver#v}
+ ver=${ver//_/.}
+ fi
+
+ if test "$ffw" != "0"; then
+ BUILDID="$hash"
+ msg="$BUILDID (ahead by $ffw commits)"
+ AC_MSG_RESULT([$msg])
+ else
+ AC_MSG_RESULT([none... congratulations, you must be on a tag])
+ fi
+elif test -f META; then
+ BUILDID=$(sed -ne '/^BUILDID =/s/.*= *//p' META)
+ msg="$BUILDID (from META file)"
+ AC_MSG_RESULT([$msg])
+else
+ AC_MSG_WARN([FIXME: I don't know how to deal with source trees outside of git that don't have a META file. Not setting a buildid.])
+fi
+AC_SUBST(BUILDID)
+])
+
+#
+# LB_CHECK_FILE
+#
+# Check for file existance even when cross compiling
+#
+AC_DEFUN([LB_CHECK_FILE],
+[AS_VAR_PUSHDEF([lb_File], [lb_cv_file_$1])dnl
+AC_CACHE_CHECK([for $1], lb_File,
+[if test -r "$1"; then
+ AS_VAR_SET(lb_File, yes)
+else
+ AS_VAR_SET(lb_File, no)
+fi])
+AS_IF([test AS_VAR_GET(lb_File) = yes], [$2], [$3])[]dnl
+AS_VAR_POPDEF([lb_File])dnl
+])# LB_CHECK_FILE
+
+#
+# LB_CONFIG_HEADERS
+#
+# add -include config.h
+#
+AC_DEFUN([LB_CONFIG_HEADERS],[
+ AC_CONFIG_HEADERS([config.h])
+ CPPFLAGS="-include $PWD/config.h $CPPFLAGS"
+ EXTRA_KCFLAGS="-include $PWD/config.h $EXTRA_KCFLAGS"
+ AC_SUBST(EXTRA_KCFLAGS)
+])
+
+#
+# LB_PROG_CC
+#
+# checks on the C compiler
+#
+AC_DEFUN([LB_PROG_CC],
+[AC_PROG_RANLIB
+
+# --------- unsigned long long sane? -------
+AC_CHECK_SIZEOF(unsigned long long, 0)
+echo "---> size SIZEOF $SIZEOF_unsigned_long_long"
+echo "---> size SIZEOF $ac_cv_sizeof_unsigned_long_long"
+if test $ac_cv_sizeof_unsigned_long_long != 8 ; then
+ AC_MSG_ERROR([** we assume that sizeof(long long) == 8.])
+fi
+
+if test $target_cpu == "powerpc64"; then
+ AC_MSG_WARN([set compiler with -m64])
+ CFLAGS="$CFLAGS -m64"
+ CC="$CC -m64"
+fi
+
+LLCPPFLAGS="-D__arch_lib__ -D_LARGEFILE64_SOURCE=1"
+AC_SUBST(LLCPPFLAGS)
+
+# Add _GNU_SOURCE for strnlen on linux
+LLCFLAGS="-g -Wall -fPIC -D_GNU_SOURCE"
+AC_SUBST(LLCFLAGS)
+
+CCASFLAGS="-Wall -fPIC -D_GNU_SOURCE"
+AC_SUBST(CCASFLAGS)
+])
+
+
+#
+# LB_LDISKFS_EXT_DIR
+#
+# Determine the location of the ext4 source code. It is required
+# for several configure tests and to build ldiskfs.
+#
+AC_DEFUN([LB_LDISKFS_EXT_DIR],
+[
+# Kernel ext source located with devel headers
+linux_src=$LINUX
+if test -e "$linux_src/fs/ext4/super.c"; then
+ EXT_DIR=$linux_src/fs/ext4
+else
+ # Kernel ext source provided by kernel-debuginfo-common package
+ linux_src=$(ls -1d /usr/src/debug/*/linux-$LINUXRELEASE \
+ 2>/dev/null | tail -1)
+ if test -e "$linux_src/fs/ext4/super.c"; then
+ EXT_DIR=$linux_src/fs/ext4
+ else
+ EXT_DIR=
+ fi
+fi
+
+AC_MSG_CHECKING([ext4 source directory])
+AC_MSG_RESULT([$EXT_DIR])
+AC_SUBST(EXT_DIR)
+])
+
+#
+# LB_LDISKFS_EXT_SOURCE
+#
+# Spot check the existance of several source files common to ext4.
+# Detecting this at configure time allows us to avoid a potential build
+# failure and provide a useful error message to explain what is wrong.
+#
+AC_DEFUN([LB_LDISKFS_EXT_SOURCE],
+[
+if test x$EXT_DIR = x; then
+ enable_ldiskfs_build='no'
+else
+ LB_CHECK_FILE([$EXT_DIR/dir.c], [], [
+ enable_ldiskfs_build='no'
+ AC_MSG_WARN([ext4 must exist for ldiskfs build])])
+ LB_CHECK_FILE([$EXT_DIR/file.c], [], [
+ enable_ldiskfs_build='no'
+ AC_MSG_WARN([ext4 must exist for ldiskfs build])])
+ LB_CHECK_FILE([$EXT_DIR/inode.c], [], [
+ enable_ldiskfs_build='no'
+ AC_MSG_WARN([ext4 must exist for ldiskfs build])])
+ LB_CHECK_FILE([$EXT_DIR/super.c], [], [
+ enable_ldiskfs_build='no'
+ AC_MSG_WARN([ext4 must exist for ldiskfs build])])
+fi
+
+if test x$enable_ldiskfs_build = xno; then
+ enable_server='no'
+ enable_ldiskfs_build='no'
+ with_ldiskfs='no'
+ LDISKFS_SUBDIR=
+
+ AC_MSG_WARN([
+
+Disabling server because complete ext4 source does not exist.
+
+If you are building using kernel-devel packages and require ldiskfs
+server support then ensure that the matching kernel-debuginfo-common
+and kernel-debuginfo-common-<arch> packages are installed.
+
+])
+
+fi
+])
+
+#
+# LB_LDISKFS_DEFINE_OPTIONS
+#
+# Enable config options related to ldiskfs. These are used by ldiskfs,
+# lvfs, and the osd-ldiskfs code (which includes ldiskfs headers.)
+#
+AC_DEFUN([LB_LDISKFS_DEFINE_OPTIONS],
+[
+AC_DEFINE(HAVE_LDISKFS_OSD, 1, Enable ldiskfs osd)
+
+with_ldiskfs_pdo=no
+case $LINUXRELEASE in
+2.6.32*)
+ if test x$RHEL_KERNEL = xyes; then
+ with_ldiskfs_pdo=yes
+ AC_DEFINE(HAVE_LDISKFS_PDO, 1, [have ldiskfs PDO patch])
+ fi
+ if test x$SUSE_KERNEL = xyes; then
+ with_ldiskfs_pdo=yes
+ AC_DEFINE(HAVE_LDISKFS_PDO, 1, [have ldiskfs PDO patch])
+ fi
+ ;;
+esac
+LB_LDISKFS_JBD2_JOURNAL_CALLBACK_SET
+
+AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1,
+ [enable extended attributes for ldiskfs])
+AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1,
+ [enable posix acls for ldiskfs])
+AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1,
+ [enable fs security for ldiskfs])
+AC_DEFINE(CONFIG_LDISKFSDEV_FS_POSIX_ACL, 1,
+ [enable posix acls for ldiskfs])
+AC_DEFINE(CONFIG_LDISKFSDEV_FS_XATTR, 1,
+ [enable extented attributes for ldiskfs])
+AC_DEFINE(CONFIG_LDISKFSDEV_FS_SECURITY, 1,
+ [enable fs security for ldiskfs])
+])
+
+#
+# Check for jbd2_journal_callback_set(), which is needed for commit
+# callbacks. When LU-433 lands jbd2_journal_callback_set() will only
+# remain for legacy reasons and AC_MSG_ERROR can be removed.
+#
+AC_DEFUN([LB_LDISKFS_JBD2_JOURNAL_CALLBACK_SET],
+[
+ LB_CHECK_SYMBOL_EXPORT([jbd2_journal_callback_set],
+ [fs/jbd2/journal.c],
+ [AC_DEFINE(HAVE_JBD2_JOURNAL_CALLBACK_SET, 1,
+ [kernel exports jbd2_journal_callback_set])])
+])
+
+
+AC_DEFUN([LB_LDISKFS_SYMVERS],
+[
+AC_MSG_CHECKING([ldiskfs module symbols])
+if test -r $LDISKFS_OBJ/Module.symvers; then
+ LDISKFS_SYMBOLS=Module.symvers
+elif test -r $LDISKFS_OBJ/Modules.symvers; then
+ LDISKFS_SYMBOLS=Modules.symvers
+elif test -r $LDISKFS_OBJ/ldiskfs/Module.symvers; then
+ LDISKFS_SYMBOLS=Module.symvers
+elif test -r $LDISKFS_OBJ/ldiskfs/Modules.symvers; then
+ LDISKFS_SYMBOLS=Modules.symvers
+else
+ LDISKFS_SYMBOLS=$SYMVERFILE
+fi
+
+AC_MSG_RESULT([$LDISKFS_SYMBOLS])
+AC_SUBST(LDISKFS_SYMBOLS)
+])
+
+AC_DEFUN([LB_LDISKFS_RELEASE],
+[
+AC_MSG_CHECKING([ldiskfs source release])
+if test -r $LDISKFS_OBJ/config.h; then
+ tmp_flags="$EXTRA_KCFLAGS"
+ EXTRA_KCFLAGS="-I$LDISKFS_DIR $EXTRA_KCFLAGS"
+ LB_LINUX_TRY_MAKE([
+ #undef PACKAGE_NAME
+ #undef PACKAGE_TARNAME
+ #undef PACKAGE_VERSION
+ #undef PACKAGE_STRING
+ #undef PACKAGE_BUGREPORT
+ #undef PACKAGE
+ #undef VERSION
+ #undef STDC_HEADERS
+
+ #include <$LDISKFS_OBJ/config.h>
+ ],[
+ char *LDISKFS_RELEASE;
+ LDISKFS_RELEASE=VERSION;
+ ],[
+ $makerule LUSTRE_KERNEL_TEST=conftest.i
+ ],[
+ test -s build/conftest.i
+ ],[
+ eval $(grep "LDISKFS_RELEASE=" build/conftest.i)
+ ],[
+ AC_MSG_RESULT([unknown])
+ AC_MSG_ERROR([Could not preprocess test program.])
+ ])
+ EXTRA_KCFLAGS="$tmp_flags"
+ rm build/conftest.i
+elif test -r $LDISKFS_DIR/configure.ac; then
+ LDISKFS_RELEASE=$(awk '/AC\_INIT/ { print [$]3 }' \
+ $LDISKFS_DIR/configure.ac | tr ',' '\n')
+else
+ AC_MSG_RESULT([unknown])
+ AC_MSG_ERROR([Could not locate config.h, META, or configure.ac to check release.])
+fi
+
+if test x$LDISKFS_RELEASE = x; then
+ AC_MSG_RESULT([unknown])
+ AC_MSG_ERROR([Could not determine ldiskfs release.])
+fi
+
+AC_MSG_RESULT([$LDISKFS_RELEASE])
+AC_SUBST(LDISKFS_RELEASE)
+])
+
+AC_DEFUN([LB_LDISKFS_SERIES],
+[
+if $1; then
+ AC_MSG_CHECKING([which ldiskfs series to use])
+ case $LINUXRELEASE in
+ 2.6.18*)
+ if test x$RHEL_KERNEL = xyes; then
+ LDISKFS_SERIES="2.6-rhel5-ext4.series"
+ fi
+ ;;
+ 2.6.32*)
+ if test x$RHEL_KERNEL = xyes; then
+ LDISKFS_SERIES="2.6-rhel6.series"
+ fi
+ if test x$SUSE_KERNEL = xyes; then
+ LDISKFS_SERIES="2.6-sles11.series"
+ fi
+ ;;
+ *)
+ AC_MSG_WARN([Unknown kernel version $LINUXRELEASE])
+ LDISKFS_SERIES=
+ ;;
+ esac
+ AC_MSG_RESULT([$LDISKFS_SERIES])
+else
+ LDISKFS_SERIES=
+fi
+AC_SUBST(LDISKFS_SERIES)
+])
+
+
+#
+# LDISKFS_AC_PATCH_PROGRAM
+#
+# Determine which program should be used to apply the patches to
+# the ext4 source code to produce the ldiskfs source code.
+#
+AC_DEFUN([LDISKFS_AC_PATCH_PROGRAM], [
+ AC_ARG_ENABLE([quilt],
+ [AC_HELP_STRING([--disable-quilt],
+ [disable use of quilt for ldiskfs])],
+ [AS_IF([test "x$enableval" = xno],
+ [use_quilt=no],
+ [use_quilt=maybe])],
+ [use_quilt=maybe]
+ )
+
+ AS_IF([test x$use_quilt = xmaybe], [
+ AC_PATH_PROG([quilt_avail], [quilt], [no])
+ AS_IF([test x$quilt_avail = xno], [
+ use_quilt=no
+ ], [
+ use_quilt=yes
+ ])
+ ])
+
+ AS_IF([test x$use_quilt = xno], [
+ AC_PATH_PROG([patch_avail], [patch], [no])
+ AS_IF([test x$patch_avail = xno], [
+ AC_MSG_ERROR([*** Need "quilt" or "patch" command])
+ ])
+ ])
+
+ AM_CONDITIONAL([USE_QUILT], [test x$use_quilt = xyes])
+])
# Process this file with autoconf to produce a configure script.
+AC_PREREQ([2.57])
AC_INIT([Lustre ldiskfs], 3.3.0, [http://bugs.whamcloud.com/])
AC_CONFIG_SRCDIR([lustre-ldiskfs.spec.in])
# Don't look for install-sh, etc. in ..
-AC_CONFIG_AUX_DIR([build/autoconf])
+AC_CONFIG_AUX_DIR([config])
-AC_CONFIG_MACRO_DIR([build/autoconf])
+AC_CONFIG_MACRO_DIR([config])
AC_CANONICAL_SYSTEM
-AM_INIT_AUTOMAKE([1.9 tar-ustar])
+AM_INIT_AUTOMAKE([1.10 tar-ustar])
AC_PROG_CC
LB_BUILDID
-LB_INCLUDE_RULES
LB_PROG_CC
AC_ARG_ENABLE([dist],
enable_modules='no'
fi
-#
-# LC_TARGET_SUPPORTED
-#
-# is the target os supported?
-#
-AC_DEFUN([LC_TARGET_SUPPORTED],
-[case $target_os in
- linux* | darwin*)
-$1
- ;;
- *)
-$2
- ;;
-esac
-])
-
AC_MSG_CHECKING([whether to build kernel modules])
AC_ARG_ENABLE([modules],
AC_HELP_STRING([--disable-modules],
[disable building of Lustre kernel modules]),[],
- [LC_TARGET_SUPPORTED([enable_modules='yes'],
- [enable_modules='no'])])
+ [enable_modules='yes'],
+ [enable_modules='no'])
AC_MSG_RESULT([$enable_modules])
if test x$enable_modules = xyes ; then
- LB_PROG_LINUX
+ LB_LINUX_PATH
+ LB_LINUX_SYMVERFILE
+ LB_LINUX_CONFIG([MODULES],[],[
+ AC_MSG_ERROR([module support is required to build ldiskfs kernel module.])
+ ])
+ LB_LINUX_CONFIG([MODVERSIONS])
+ LB_LINUX_CONFIG([KALLSYMS],[],[
+ if test "x$ARCH_UM" = "x" ; then
+ AC_MSG_ERROR([ldiskfs requires that CONFIG_KALLSYMS is enabled in your kernel.])
+ fi
+ ])
LB_LINUX_MODPOST
fi
LB_CONFIG_HEADERS
-# These allow Lustre Makefiles and autoMakefiles to be used unchanged.
-AM_CONDITIONAL(MODULES, true)
-AM_CONDITIONAL(LINUX, true)
-AM_CONDITIONAL(DARWIN, true)
-
LDISKFSDIR="$PWD/ldiskfs"
AC_SUBST(LDISKFSDIR)
-AC_MSG_CHECKING([whether to enable quilt for making ldiskfs])
-AC_ARG_ENABLE([quilt],
- AC_HELP_STRING([--disable-quilt],
- [disable use of quilt for ldiskfs]),[],
- [enable_quilt='yes'])
-AC_MSG_RESULT([$enable_quilt])
-
-AC_PATH_PROG(PATCH, patch, [no])
-
-if test x$enable_quilt = xno ; then
- QUILT="no"
-else
- AC_PATH_PROG(QUILT, quilt, [no])
-fi
-
-if test x$enable_server$PATCH$QUILT = xyesnono ; then
- AC_MSG_ERROR([Quilt or patch are needed to build the ldiskfs module])
-fi
-
-AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
+LDISKFS_AC_PATCH_PROGRAM
if test x$enable_server$enable_dist = xyesno ; then
LB_LDISKFS_EXT_DIR
AC_SUBST(ac_configure_args)
-LB_CONFIG_FILES
-AC_CONFIG_FILES([ldiskfs/autoMakefile ldiskfs/Makefile])
+AC_CONFIG_FILES([Makefile ldiskfs/Makefile]
+ AC_PACKAGE_TARNAME[.spec])
MOSTLYCLEANFILES='.*.cmd .*.flags *.o *.ko *.mod.c .depend .*.1.* Modules.symvers Module.symvers'
AC_SUBST(MOSTLYCLEANFILES)
-default: all
-
-MODULES := ldiskfs
+all: modules
+install: modules_install
+distdir:
# copy makefile over to not break patches
backfs_extra := $(wildcard @LINUX@/fs/ext4/Makefile)
ldiskfs_patched_sources := $(notdir $(backfs_sources) $(backfs_headers)) $(new_sources) $(new_headers)
ldiskfs_sources := $(ldiskfs_patched_sources)
+ldiskfs_obj := $(filter %.o,$(ldiskfs_sources:.c=.o))
+
+#--- autoMakefile cut-and-paste start
+
+ldiskfs_linux_headers := $(addprefix linux/,$(subst ext4,ldiskfs,$(notdir $(linux_headers))))
+
+$(filter %.c,$(ldiskfs_patched_sources)): sources $(ldiskfs_linux_headers) $(filter %.h,$(ldiskfs_patched_sources))
+
+ldiskfs_sed_flags = \
+ -e "s/dx_hash_info/ext4_dx_hash_info/g" \
+ -e "s/DX_HASH/EXT4_DX_HASH/g" \
+ -e "s/EXT4/LDISKFS/g" -e "s/ext4/ldiskfs/g"
+
+%.c: linux-stage/fs/ext4/%.c
+ sed $(strip $(ldiskfs_sed_flags)) $< > $@
+
+%.h: linux-stage/fs/ext4/%.h
+ sed $(strip $(ldiskfs_sed_flags)) $< > $@
+
+linux/ldiskfs%.h: linux-stage/include/linux/ext4%.h
+ sed $(strip $(ldiskfs_sed_flags)) $< > $@
+
+series := @top_srcdir@/kernel_patches/series/ldiskfs-@LDISKFS_SERIES@
+patches := @top_srcdir@/kernel_patches/patches
+
+#install-data-local: sources
+# destname=@LDISKFS_META_NAME@-@LDISKFS_META_VERSION@/@LINUX_VERSION@; \
+# instdest=$(DESTDIR)/usr/src/$$destname; \
+# instfiles=$$(find . -name '*.h' | grep -v linux-stage); \
+# for instfile in $$instfiles; do \
+# if [ "$$(dirname $$instfile)" = "." ]; then \
+# /usr/bin/install -c -D $$instfile $$instdest/ldiskfs/$$instfile; \
+# else \
+# /usr/bin/install -c -D $$instfile $$instdest/$$instfile; \
+# fi \
+# done
+
+###############################
+# Kernel Build Infrastructure #
+###############################
+
+EXTRA_CFLAGS += -I@LINUX@/fs -I@LDISKFSDIR@
+EXTRA_CFLAGS += -include @abs_top_builddir@/config.h
+
+obj-m := ldiskfs.o
+ldiskfs-objs := $(ldiskfs_obj)
+
+modules: sources
+ $(MAKE) -C @LINUX_OBJ@ M=$(shell pwd) $@
+
+clean:
+ $(MAKE) -C @LINUX_OBJ@ M=$(shell pwd) $@
+ if [ -f @LINUX_SYMBOLS@ ]; then $(RM) @LINUX_SYMBOLS@; fi
+ if [ -f Module.markers ]; then $(RM) Module.markers; fi
+
+modules_install:
+ @# Install the kernel modules
+ $(MAKE) -C @LINUX_OBJ@ M=$(shell pwd) \
+ INSTALL_MOD_PATH=$(DESTDIR) \
+ INSTALL_MOD_DIR=updates/kernel/fs/lustre-ldiskfs $@
+ @# Remove extraneous build products when packaging
+ if [ -n "$(DESTDIR)" ]; then \
+ find $(DESTDIR)/lib/modules/@LINUX_VERSION@ \
+ -name 'modules.*' | xargs $(RM); \
+ fi
+ sysmap=$(DESTDIR)/boot/System.map-@LINUX_VERSION@; \
+ if [ -f $$sysmap ]; then \
+ depmod -ae -F $$sysmap @LINUX_VERSION@; \
+ fi
+
+################################################
+# Patched ldiskfs Sources Build Infrastructure #
+################################################
+
+sources: $(backfs_sources) $(backfs_headers) $(linux_headers) $(series) $(trace_headers)
+ rm -rf linux-stage linux sources trace $(ldiskfs_SOURCES)
+ mkdir -p linux-stage/fs/ext4 linux-stage/include/linux \
+ linux-stage/include/trace/events
+ cp $(backfs_sources) $(backfs_headers) $(backfs_extra) linux-stage/fs/ext4
+ if test -n "$(linux_headers)" ; then \
+ cp $(linux_headers) linux-stage/include/linux; \
+ fi
+ if test -n "$(trace_headers)" ; then \
+ cp $(trace_headers) linux-stage/include/trace/events; \
+ fi
+
+@USE_QUILT_TRUE@ ln -s ../$(patches) linux-stage/patches
+@USE_QUILT_TRUE@ ln -s ../$(series) linux-stage/series
+@USE_QUILT_TRUE@ cd linux-stage && quilt push -a -q
+
+@USE_QUILT_FALSE@ @echo -n "Applying ext4 patches:"
+@USE_QUILT_FALSE@ @cd linux-stage && for i in $$(<../$(series)) ; do \
+@USE_QUILT_FALSE@ echo -n " $$i" ; \
+@USE_QUILT_FALSE@ patch -s -p1 < ../$(patches)/$$i || exit 1 ; \
+@USE_QUILT_FALSE@ done
+@USE_QUILT_FALSE@ @echo
+
+ mkdir -p linux trace/events
+ @echo -n "Replacing 'ext4' with 'ldiskfs':"
+ for i in $(notdir $(backfs_headers) $(backfs_sources)) $(new_sources) ; do \
+ echo -n " $$i" ; \
+ sed $(strip $(ldiskfs_sed_flags)) \
+ linux-stage/fs/ext4/$$i > $$i ; \
+ done
+ for i in $(subst ext4,,$(notdir $(backfs_headers))) ; do \
+ if test -f "ext4$$i" ; then \
+ echo -n " ext4$$i" ; \
+ mv ext4$$i ldiskfs$$i ; \
+ fi ; \
+ done
+ for i in $(subst ext4,,$(notdir $(linux_headers) $(new_headers))) ; do \
+ echo -n " ext4$$i" ; \
+ sed $(strip $(ldiskfs_sed_flags)) \
+ linux-stage/include/linux/ext4$$i \
+ > linux/ldiskfs$$i ; \
+ done
+ for i in $(subst ext4,,$(notdir $(trace_headers))) ; do \
+ echo -n " ext4$$i"; \
+ sed $(strip $(ldiskfs_sed_flags)) \
+ linux-stage/include/trace/events/ext4$$i \
+ > trace/events/ldiskfs$$i ; \
+ done
+ for i in $(notdir $(linux_new_headers)) ; do \
+ echo -n " $$i"; \
+ sed $(strip $(ldiskfs_sed_flags)) \
+ linux-stage/include/linux/$$i \
+ > linux/$$i ; \
+ done
+
+ @echo
+ touch sources
-ldiskfs-objs := $(filter %.o,$(ldiskfs_sources:.c=.o))
+foo-check:
+ @echo "ldiskfs_sources: $(ldiskfs_sources)"
+ @echo "ldiskfs_SOURCES: $(ldiskfs_SOURCES)"
+ @echo "ldiskfs_headers: $(ldiskfs_headers)"
+ @echo "ldiskfs_objects: $(ldiskfs_objects)"
+ @echo "ldiskfs_OBJECTS: $(ldiskfs_OBJECTS)"
+ @echo "ldiskfs_LDADD: $(ldiskfs_LDADD)"
-EXTRA_PRE_CFLAGS := -I@LINUX@/fs -I@LDISKFSDIR@
+MOSTLYCLEANFILES := @MOSTLYCLEANFILES@
+CLEANFILES = sources $(notdir $(linux_new_headers) $(linux_headers) $(backfs_headers) $(backfs_sources) $(new_sources) $(new_headers) $(trace_headers))
-@INCLUDE_RULES@
+#--- autoMakefile cut-and-paste end
+++ /dev/null
-modulefs_DATA = ldiskfs$(KMODEXT)
-
-ldiskfs_linux_headers := $(addprefix linux/,$(subst ext4,ldiskfs,$(notdir $(linux_headers))))
-
-$(filter %.c,$(ldiskfs_patched_sources)): sources $(ldiskfs_linux_headers) $(filter %.h,$(ldiskfs_patched_sources))
-
-ldiskfs_sed_flags = \
- -e "s/dx_hash_info/ext4_dx_hash_info/g" \
- -e "s/DX_HASH/EXT4_DX_HASH/g" \
- -e "s/EXT4/LDISKFS/g" -e "s/ext4/ldiskfs/g"
-
-%.c: linux-stage/fs/ext4/%.c
- sed $(strip $(ldiskfs_sed_flags)) $< > $@
-
-%.h: linux-stage/fs/ext4/%.h
- sed $(strip $(ldiskfs_sed_flags)) $< > $@
-
-linux/ldiskfs%.h: linux-stage/include/linux/ext4%.h
- sed $(strip $(ldiskfs_sed_flags)) $< > $@
-
-series := @top_srcdir@/kernel_patches/series/ldiskfs-$(LDISKFS_SERIES)
-patches := @top_srcdir@/kernel_patches/patches
-
-sources: $(backfs_sources) $(backfs_headers) $(linux_headers) $(series) $(trace_headers)
- rm -rf linux-stage linux sources trace $(ldiskfs_SOURCES)
- mkdir -p linux-stage/fs/ext4 linux-stage/include/linux \
- linux-stage/include/trace/events
- cp $(backfs_sources) $(backfs_headers) $(backfs_extra) linux-stage/fs/ext4
- if test -n "$(linux_headers)" ; then \
- cp $(linux_headers) linux-stage/include/linux; \
- fi
- if test -n "$(trace_headers)" ; then \
- cp $(trace_headers) linux-stage/include/trace/events; \
- fi
-if USE_QUILT
- ln -s ../$(patches) linux-stage/patches
- ln -s ../$(series) linux-stage/series
- cd linux-stage && quilt push -a -q
-else
- @echo -n "Applying ext4 patches:"
- @cd linux-stage && for i in $$(<../$(series)) ; do \
- echo -n " $$i" ; \
- patch -s -p1 < ../$(patches)/$$i || exit 1 ; \
- done
- @echo
-endif
- mkdir -p linux trace/events
- @echo -n "Replacing 'ext4' with 'ldiskfs':"
- for i in $(notdir $(backfs_headers) $(backfs_sources)) $(new_sources) ; do \
- echo -n " $$i" ; \
- sed $(strip $(ldiskfs_sed_flags)) \
- linux-stage/fs/ext4/$$i > $$i ; \
- done
- for i in $(subst ext4,,$(notdir $(backfs_headers))) ; do \
- if test -f "ext4$$i" ; then \
- echo -n " ext4$$i" ; \
- mv ext4$$i ldiskfs$$i ; \
- fi ; \
- done
- for i in $(subst ext4,,$(notdir $(linux_headers) $(new_headers))) ; do \
- echo -n " ext4$$i" ; \
- sed $(strip $(ldiskfs_sed_flags)) \
- linux-stage/include/linux/ext4$$i \
- > linux/ldiskfs$$i ; \
- done
- for i in $(subst ext4,,$(notdir $(trace_headers))) ; do \
- echo -n " ext4$$i"; \
- sed $(strip $(ldiskfs_sed_flags)) \
- linux-stage/include/trace/events/ext4$$i \
- > trace/events/ldiskfs$$i ; \
- done
- for i in $(notdir $(linux_new_headers)) ; do \
- echo -n " $$i"; \
- sed $(strip $(ldiskfs_sed_flags)) \
- linux-stage/include/linux/$$i \
- > linux/$$i ; \
- done
-
- @echo
- touch sources
-
-foo-check:
- @echo "ldiskfs_sources: $(ldiskfs_sources)"
- @echo "ldiskfs_SOURCES: $(ldiskfs_SOURCES)"
- @echo "ldiskfs_headers: $(ldiskfs_headers)"
- @echo "ldiskfs_objects: $(ldiskfs_objects)"
- @echo "ldiskfs_OBJECTS: $(ldiskfs_OBJECTS)"
- @echo "ldiskfs_LDADD: $(ldiskfs_LDADD)"
-
-MOSTLYCLEANFILES := @MOSTLYCLEANFILES@
-CLEANFILES = sources $(notdir $(linux_new_headers) $(linux_headers) $(backfs_headers) $(backfs_sources) $(new_sources) $(new_headers) $(trace_headers))
-
-clean: clean-am
- rm -rf linux linux-stage ldiskfs*.h trace
%install
make install DESTDIR=$RPM_BUILD_ROOT
+# Kernel module needs to be executable at the end of the install
+# section to allow the find-debuginfo.sh to produce a proper
+# debuginfo package. Permissions will be corrected in the files
+# section.
+chmod 755 ${RPM_BUILD_ROOT}/lib/modules/%{kversion}/updates/kernel/fs/lustre-ldiskfs/ldiskfs.ko
%files
-%attr(-, root, root) /lib/modules/%{kversion}/updates/kernel/fs/lustre-ldiskfs
+%defattr(644, root, root, 755)
+/lib/modules/%{kversion}/updates/kernel/fs/lustre-ldiskfs
%post
if [ -f /boot/System.map-%{kversion} ]; then