diff --git a/lustre/Makefile.am b/lustre/Makefile.am
index ffaf6c455146fdd716e6edecb856b47161c9dca0..59411e7762bc30e89cc835cfc09d6aa0f816344c 100644
--- a/lustre/Makefile.am
+++ b/lustre/Makefile.am
@@ -5,6 +5,11 @@
 
 AUTOMAKE_OPTIONS = foreign
 
+if LINUX25
+DIRS24 = mds
+else
+DIRS24 = extN mds
+endif
 
 # NOTE: keep extN before mds
 SUBDIRS = lov utils obdclass ldlm ptlrpc lib obdecho mdc osc ost llite 
diff --git a/lustre/archdep.m4 b/lustre/archdep.m4
index 0ae4905646fa6c241f31a66ec26054529ad84d86..e23e75c2ae2d562a35539430b3701999df87781a 100644
--- a/lustre/archdep.m4
+++ b/lustre/archdep.m4
@@ -1,19 +1,3 @@
-AC_MSG_CHECKING(if you are running linux 2.5...)
-if test -e $LINUX/include/linux/namei.h ; then
-	linux25=yes
-        DIRS24="mds"
-        FSMOD="mds_ext3"
-	AC_MSG_RESULT(yes)
-else
-	linux25=no
-        DIRS24="mds extN"
-        FSMOD="mds_extN"
-	AC_MSG_RESULT(no)
-fi
-AC_SUBST(DIRS24)
-AC_SUBST(FSMOD)
-## AM_CONDITIONAL(LINUX25, test x$linux25 = xyes)
-
 AC_MSG_CHECKING(if you are running user mode linux for $host_alias..)
 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
diff --git a/lustre/configure.in b/lustre/configure.in
index d8e2ccc2c33ee102a4fc3040d60676c22910e91f..57ab0f0bcff2c84178a3bc05a0998432144b077f 100644
--- a/lustre/configure.in
+++ b/lustre/configure.in
@@ -45,6 +45,16 @@ AC_SUBST(LINUX)
 
 sinclude(archdep.m4)
 
+AC_MSG_CHECKING(if you are running linux 2.5...)
+if test -e $LINUX/include/linux/namei.h ; then
+	linux25=yes
+	AC_MSG_RESULT(yes)
+else
+	linux25=no
+	AC_MSG_RESULT(no)
+fi
+AM_CONDITIONAL(LINUX25, test x$linux25 = xyes)
+
 KINCFLAGS='-I. -I$(top_srcdir)/include -I$(PORTALS)/include -I$(LINUX)/include'
 CPPFLAGS="$KINCFLAGS $ARCHCPPFLAGS"
 
diff --git a/lustre/mds/Makefile.am b/lustre/mds/Makefile.am
index 33d3ecee0046fcd4e9a2b3da52e0c64e94d702e6..322be15c2a8ab4bfe51dc8b6e31dc647e0653090 100644
--- a/lustre/mds/Makefile.am
+++ b/lustre/mds/Makefile.am
@@ -5,7 +5,11 @@
 
 DEFS= 
 
-MODS=@FSMOD@
+if LINUX25
+FSMOD = mds_ext3
+else
+FSMOD = mds_extN
+endif
 
 MODULE = mds
 modulefs_DATA = mds.o $(MODS).o
@@ -27,4 +31,3 @@ target.c:
 mds_SOURCES = mds_lov.c handler.c mds_reint.c mds_fs.c $(LINX)
 
 include $(top_srcdir)/Rules
-