+++ /dev/null
-# Four main targets: lustre kernel modules, utilities, tests, and liblustre
-AC_MSG_CHECKING([whether to build kernel modules])
-AC_ARG_ENABLE([modules],
- AC_HELP_STRING([--disable-modules],
- [disable building of Lustre kernel modules]),
- [],[enable_modules='yes'])
-AC_MSG_RESULT([$enable_modules])
-AM_CONDITIONAL(MODULES, test x$enable_modules = xyes)
-
-AC_MSG_CHECKING([whether to build utilities])
-AC_ARG_ENABLE([utils],
- AC_HELP_STRING([--disable-utils],
- [disable building of Lustre utility programs]),
- [],[enable_utils='yes'])
-AC_MSG_RESULT([$enable_utils])
-
-AC_MSG_CHECKING([whether to build Lustre tests])
-AC_ARG_ENABLE([tests],
- AC_HELP_STRING([--disable-tests],
- [disable building of Lustre tests]),
- [],[enable_tests='yes'])
-AC_MSG_RESULT([$enable_tests])
-
-# specify wether to build doc or not
-AC_MSG_CHECKING([whether to build docs])
-AC_ARG_ENABLE(doc,
- AC_HELP_STRING([--disable-doc],
- [skip creation of pdf documentation]),
- [
- if test x$enable_doc = xyes ; then
- ENABLE_DOC=1
- else
- ENABLE_DOC=0
- fi
- ],[
- ENABLE_DOC=0
- enable_doc='no'
- ])
-AC_MSG_RESULT([$enable_doc])
-AM_CONDITIONAL(DOC, test x$ENABLE_DOC = x1)
-AC_SUBST(ENABLE_DOC)
-
-# we need to pass a full path here for kernel makefiles
-INCLUDE_RULES="include $PWD/build/Rules"
-AC_SUBST(INCLUDE_RULES)
-
-# directories for binaries
-AC_PREFIX_DEFAULT([/usr])
-
-sysconfdir='/etc'
-AC_SUBST(sysconfdir)
-
-# Directories for documentation and demos.
-docdir='${datadir}/doc/$(PACKAGE)'
-AC_SUBST(docdir)
-
-# ---------- BAD gcc? ------------
-AC_PROG_RANLIB
-AC_PROG_CC
-AC_MSG_CHECKING([for buggy compiler])
-CC_VERSION=`$CC -v 2>&1 | grep "^gcc version"`
-bad_cc() {
- AC_MSG_RESULT([buggy compiler found!])
- echo
- echo " '$CC_VERSION'"
- echo " has been known to generate bad code, "
- echo " please get an updated compiler."
- AC_MSG_ERROR([sorry])
-}
-TMP_VERSION=`echo $CC_VERSION | cut -c 1-16`
-if test "$TMP_VERSION" = "gcc version 2.95"; then
- bad_cc
-fi
-case "$CC_VERSION" in
- # ost_pack_niobuf putting 64bit NTOH temporaries on the stack
- # without "sub $0xc,%esp" to protect the stack from being
- # stomped on by interrupts (bug 606)
- "gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98)")
- bad_cc
- ;;
- # mandrake's similar sub 0xc compiler bug
- # http://marc.theaimsgroup.com/?l=linux-kernel&m=104748366226348&w=2
- "gcc version 2.96 20000731 (Mandrake Linux 8.1 2.96-0.62mdk)")
- bad_cc
- ;;
- *)
- AC_MSG_RESULT([no known problems])
- ;;
-esac
-# end ------ BAD gcc? ------------
-
-# --------- 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. Tell phil@clusterfs.com])
-fi
-
-# -------- we can't build modules unless srcdir = builddir
-if test x$enable_modules != xno ; then
- AC_CHECK_FILE([autoMakefile.am],[],
- [AC_MSG_ERROR([At this time, Lustre does not support building kernel modules with srcdir != buildir.])])
-fi
-
-# -------- in kernel compilation? (2.5 only) -------------
-AC_MSG_CHECKING([if inkernel build support is requested])
-AC_ARG_ENABLE([inkernel],
- AC_HELP_STRING([--enable-inkernel],
- [set up 2.5 kernel makefiles]),
- [],[enable_inkernel=no])
-AC_MSG_RESULT([$enable_inkernel])
-AM_CONDITIONAL(INKERNEL, test x$enable_inkernel = xyes)
-
-if test x$enable_inkernel = xyes ; then
- find portals lustre -name Makefile.mk | sed 's/.mk$//' | xargs -n 1 \
- sh -e -x -c '(cp -f $0.mk $0.in)'
-fi
-
-if test x$enable_modules != xno ; then
- # -------- set linuxdir ------------
- AC_MSG_CHECKING([for Linux sources])
- AC_ARG_WITH([linux],
- AC_HELP_STRING([--with-linux=path],
- [set path to Linux source (default=/usr/src/linux)]),
- [LINUX=$with_linux],
- [LINUX=/usr/src/linux])
- AC_MSG_RESULT([$LINUX])
- AC_SUBST(LINUX)
- if test x$enable_inkernel = xyes ; then
- echo ln -s `pwd` $LINUX/fs/lustre
- rm $LINUX/fs/lustre
- ln -s `pwd` $LINUX/fs/lustre
- fi
-
- # -------- 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=\$LINUX)]),
- [LINUX_OBJ=$with_linux_obj],
- [LINUX_OBJ=$LINUX])
- AC_MSG_RESULT([$LINUX_OBJ])
- AC_SUBST(LINUX_OBJ)
-
- # -------- check for .confg --------
- AC_ARG_WITH([linux-config],
- [AC_HELP_STRING([--with-linux-config=path],
- [set path to Linux .conf (default=\$LINUX_OBJ/.config)])],
- [LINUX_CONFIG=$with_linux_config],
- [LINUX_CONFIG=$LINUX_OBJ/.config])
- AC_SUBST(LINUX_CONFIG)
-
- AC_CHECK_FILE([/boot/kernel.h],
- [KERNEL_SOURCE_HEADER='/boot/kernel.h'],
- [AC_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 README.kernel-source for details.]),
- [KERNEL_SOURCE_HEADER=$with_kernel_source_header])
-
- # --------------------
- ARCH_UM=
- UML_CFLAGS=
-
- AC_MSG_CHECKING([if you are running user mode linux for $host_cpu])
- if test -e $LINUX/include/asm-um ; then
- if test X`ls -id $LINUX/include/asm/ | awk '{print $1}'` = X`ls -id $LINUX/include/asm-um | 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 (asm doesn't point at asm-um)])
- fi
- else
- AC_MSG_RESULT([no (asm-um missing)])
- fi
-
- AC_SUBST(ARCH_UM)
- AC_SUBST(UML_CFLAGS)
-
- # --------- Linux 25 ------------------
- AC_CHECK_FILE([$LINUX/include/linux/namei.h],
- [
- linux25="yes"
- KMODEXT=".ko"
- ],[
- KMODEXT=".o"
- linux25="no"
- ])
- AC_MSG_CHECKING([if you are using Linux 2.6])
- AC_MSG_RESULT([$linux25])
-
- AC_SUBST(LINUX25)
- AC_SUBST(KMODEXT)
-fi
-AM_CONDITIONAL(LINUX25, test x$linux25 = xyes)
-
-
-# ------- Makeflags ------------------
-
-CPPFLAGS="$CPPFLAGS $CRAY_PORTALS_INCLUDES -I\$(top_srcdir)/lustre/include -I\$(top_srcdir)/portals/include"
-
-# liblustre are all the same
-LLCPPFLAGS="-D__arch_lib__ -D_LARGEFILE64_SOURCE=1"
-AC_SUBST(LLCPPFLAGS)
-
-LLCFLAGS="-g -Wall -fPIC"
-AC_SUBST(LLCFLAGS)
-
-# everyone builds against portals and lustre
-
-EXTRA_KCFLAGS="-g $CRAY_PORTALS_INCLUDES -I$PWD/portals/include -I$PWD/lustre/include"
-
-# these are like AC_TRY_COMPILE, but try to build modules against the
-# kernel, inside the kernel-tests directory
-
-AC_DEFUN([LUSTRE_MODULE_CONFTEST],
-[cat >conftest.c <<_ACEOF
-$1
-_ACEOF
-])
-
-AC_DEFUN([LUSTRE_MODULE_COMPILE_IFELSE],
-[m4_ifvaln([$1], [LUSTRE_MODULE_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 [$2] CC="$CC" -f $PWD/build/Makefile LUSTRE_LINUX_CONFIG=$LINUX_CONFIG -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])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
-])
-
-AC_DEFUN([LUSTRE_MODULE_TRY_COMPILE],
-[LUSTRE_MODULE_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[$1]], [[$2]])],
- [modules],
- [test -s build/conftest.o],
- [$3], [$4])])
-
-AC_DEFUN([LUSTRE_MODULE_TRY_MAKE],
-[LUSTRE_MODULE_COMPILE_IFELSE([AC_LANG_PROGRAM([[$1]], [[$2]])], [$3], [$4], [$5], [$6])])
-
-# ------------ include paths ------------------
-
-if test x$enable_modules != xno ; then
- # ------------ .config exists ----------------
- AC_CHECK_FILE([$LINUX_CONFIG],[],
- [AC_MSG_ERROR([Kernel config could not be found. If you are building from a kernel-source rpm consult README.kernel-source])])
-
- # ----------- make dep run? ------------------
- AC_CHECK_FILES([$LINUX_OBJ/include/linux/autoconf.h
- $LINUX_OBJ/include/linux/version.h
- $LINUX/include/linux/config.h],[],
- [AC_MSG_ERROR([Run make config in $LINUX.])])
-
- # ------------ 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
- AC_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 README.kernel-source for details.])
- fi],
- [AC_MSG_ERROR([$KERNEL_SOURCE_HEADER not found. Consult README.kernel-source for details.])])
- EXTRA_KCFLAGS="-include $KERNEL_SOURCE_HEADER $EXTRA_KCFLAGS"
- fi
-
- # ------------ external module support ---------------------
- MODULE_TARGET="SUBDIRS"
- if test $linux25 = 'yes' ; then
- makerule="$PWD/build"
- AC_MSG_CHECKING([for external module build support])
- rm -f build/conftest.i
- LUSTRE_MODULE_TRY_MAKE([],[],
- [$makerule LUSTRE_KERNEL_TEST=conftest.i],
- [test -s build/conftest.i],
- [
- AC_MSG_RESULT([no])
- ],[
- AC_MSG_RESULT([yes])
- makerule="_module_$makerule"
- MODULE_TARGET="M"
- ])
- else
- makerule="_dir_$PWD/build"
- fi
- AC_SUBST(MODULE_TARGET)
-
- # --- check that we can build modules at all
- AC_MSG_CHECKING([that modules can be built])
- LUSTRE_MODULE_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 README.kernel-source])
- AC_MSG_ERROR([Kernel modules could not be built.])
- ])
-
- # ------------ LINUXRELEASE and moduledir ------------------
- LINUXRELEASE=
- rm -f build/conftest.i
- AC_MSG_CHECKING([for Linux release])
- LUSTRE_MODULE_TRY_MAKE(
- [#include <linux/version.h>],
- [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/kernel
- modulefsdir='$(moduledir)/fs/$(PACKAGE)'
- modulenetdir='$(moduledir)/net/$(PACKAGE)'
-
- AC_SUBST(moduledir)
- AC_SUBST(modulefsdir)
- AC_SUBST(modulenetdir)
-
- # ------------ RELEASE --------------------------------
- AC_MSG_CHECKING([for Lustre release])
- RELEASE="`echo ${LINUXRELEASE} | tr '-' '_'`_`date +%Y%m%d%H%M`"
- AC_MSG_RESULT($RELEASE)
- AC_SUBST(RELEASE)
-
- # ---------- modules? ------------------------
- AC_MSG_CHECKING([for module support])
- LUSTRE_MODULE_TRY_COMPILE(
- [
- #include <linux/config.h>
- ],[
- #ifndef CONFIG_MODULES
- #error CONFIG_MODULES not #defined
- #endif
- ],[
- AC_MSG_RESULT([yes])
- ],[
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([module support is required to build Lustre kernel modules.])
- ])
-
- # ---------- modversions? --------------------
- AC_MSG_CHECKING([for MODVERSIONS])
- LUSTRE_MODULE_TRY_COMPILE(
- [
- #include <linux/config.h>
- ],[
- #ifndef CONFIG_MODVERSIONS
- #error CONFIG_MODVERSIONS not #defined
- #endif
- ],[
- AC_MSG_RESULT([yes])
- ],[
- AC_MSG_RESULT([no])
- ])
-
- # ------------ preempt -----------------------
- AC_MSG_CHECKING([if preempt is enabled])
- LUSTRE_MODULE_TRY_COMPILE(
- [
- #include <linux/config.h>
- ],[
- #ifndef CONFIG_PREEMPT
- #error CONFIG_PREEMPT is not #defined
- #endif
- ],[
- AC_MSG_RESULT([yes])
- AC_MSG_ERROR([Lustre does not support kernels with preempt enabled.])
- ],[
- AC_MSG_RESULT([no])
- ])
-
- # ------------ kallsyms (so software watchdogs produce useful stacks)
- AC_MSG_CHECKING([if kallsyms is enabled])
- LUSTRE_MODULE_TRY_COMPILE(
- [
- #include <linux/config.h>
- ],[
- #ifndef CONFIG_KALLSYMS
- #error CONFIG_KALLSYMS is not #defined
- #endif
- ],[
- AC_MSG_RESULT([yes])
- ],[
- AC_MSG_RESULT([no])
- if test "x$ARCH_UM" = "x" ; then
- AC_MSG_ERROR([Lustre requires that CONFIG_KALLSYMS is enabled in your kernel.])
- fi
- ])
-fi
-
-ENABLE_INIT_SCRIPTS=0
-if test x$enable_utils = xyes ; then
- AC_MSG_CHECKING([whether to install init scripts])
- # our scripts only work on red hat systems
- if test -f /etc/init.d/functions -a -f /etc/sysconfig/network ; then
- ENABLE_INIT_SCRIPTS=1
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- fi
-fi
-AM_CONDITIONAL(INIT_SCRIPTS, test x$ENABLE_INIT_SCRIPTS = "x1")
-AC_SUBST(ENABLE_INIT_SCRIPTS)
-
-AC_CONFIG_FILES([
-build/autoMakefile
-build/Rules
-build/lustre.spec
-])