-# Automake variables. Steal the version number from lustre.spec.in.
-AM_INIT_AUTOMAKE(obd, builtin([esyscmd], [sed -ne '/^%define version /{ s/.*version //; p; q; }' scripts/lustre.spec.in]))
-#AM_MAINTAINER_MODE
-AC_PROG_CC
-AC_PROG_RANLIB
-
-#
-# Check for required packages
-*
-
-AC_PATH_PROG([XML2_CONFIG], [xml2-config], [],)
-if test -z "$XML2_CONFIG"; then
- AC_MSG_ERROR([xml2-config not found; libxml2-dev libraries must be installed.])
-fi
-XML2_CFLAGS=$($XML2_CONFIG --cflags)
-XML2_LIBS=$($XML2_CONFIG --libs)
-AC_SUBST(XML2_CFLAGS)
-AC_SUBST(XML2_LIBS)
-
-# Kernel build environment.
-ac_default_prefix=
-bindir='${exec_prefix}/usr/bin'
-sbindir='${exec_prefix}/usr/sbin'
-
-linuxdir_def=/usr/src/linux
-AC_ARG_ENABLE(linuxdir, [ --enable-linuxdir=[path] set path to Linux source (default=/usr/src/linux)],, enable_linuxdir=$linuxdir_def)
-
-LINUX=$enable_linuxdir
-AC_SUBST(LINUX)
-
-sinclude(archdep.m4)
-
-KINCFLAGS='-I. -I$(top_srcdir)/include -I$(PORTALS)/include -I$(LINUX)/include'
-CPPFLAGS="$KINCFLAGS $ARCHCPPFLAGS"
-
-portalsdir_def='$(top_srcdir)/../portals'
-AC_ARG_ENABLE(portalsdir, [ --enable-portalsdir=[path] set path to Portals source (default=../portals)],, enable_portalsdir=$portalsdir_def)
-PORTALS=$enable_portalsdir
-AC_SUBST(PORTALS)
-
-AC_MSG_CHECKING(if make dep has been run in kernel source)
-if test -f $LINUX/include/linux/config.h ; then
- AC_MSG_RESULT(yes)
-else
- AC_MSG_ERROR(** cannot find $LINUX/include/linux/config.h. Run make dep in $LINUX.)
+AC_INIT
+AC_CANONICAL_SYSTEM
+AM_INIT_AUTOMAKE(lustre, HEAD)
+# AM_MAINTAINER_MODE
+
+# 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 Lustre library])
+AC_ARG_ENABLE([liblustre],
+ AC_HELP_STRING([--disable-liblustre],
+ [disable building of Lustre library]),
+ [],[enable_liblustre='yes'])
+AC_MSG_RESULT([$enable_liblustre])
+AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = 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)
+
+# default backing fs is ext3
+BACKINGFS='ext3'
+
+# LLNL patches their ext3 and calls it extN
+AC_MSG_CHECKING([whether to use extN])
+AC_ARG_ENABLE([extN],
+ AC_HELP_STRING([--enable-extN],
+ [use extN instead of ext3 for lustre backend]),
+ [BACKINGFS='extN'],[enable_extN='no'])
+AC_MSG_RESULT([$enable_extN])
+AM_CONDITIONAL(EXTN, test x$enable_extN = xyes)
+
+# SuSE gets ldiskfs
+AC_MSG_CHECKING([whether to enable ldiskfs])
+AC_ARG_ENABLE([ldiskfs],
+ AC_HELP_STRING([--enable-ldiskfs],
+ [use ldiskfs for the Lustre backing FS]),
+ [BACKINGFS='ldiskfs'],[enable_ldiskfs='no'])
+AC_MSG_RESULT([$enable_ldiskfs])
+AM_CONDITIONAL(LDISKFS, test x$enable_ldiskfs = xyes)
+
+AC_MSG_CHECKING([which backing filesystem to use])
+AC_MSG_RESULT([$BACKINGFS])
+AC_SUBST(BACKINGFS)
+
+# the pinger is temporary, until we have the recovery node in place
+AC_MSG_CHECKING([whether to enable pinger support])
+AC_ARG_ENABLE([pinger],
+ AC_HELP_STRING([--disable-pinger],
+ [disable recovery pinger support]),
+ [],[enable_pinger='yes'])
+AC_MSG_RESULT([$enable_pinger])
+if test x$enable_pinger != xno ; then
+ AC_DEFINE(ENABLE_PINGER, 1, Use the Pinger)