From f6fb5ab37906ed82a64f4e9a664427f209e76d54 Mon Sep 17 00:00:00 2001
From: jacob <jacob>
Date: Wed, 27 Apr 2005 01:04:12 +0000
Subject: [PATCH] b=5786

 - add --disable-client and --disable-server configure options
---
 lustre/ChangeLog               |  1 +
 lustre/Makefile.in             | 10 +++-------
 lustre/autoMakefile.am         | 32 +++++++++++++++++++++++++++++---
 lustre/autoconf/lustre-core.m4 | 26 +++++++++++++++++++++++++-
 lustre/llite/autoMakefile.am   |  2 ++
 lustre/lvfs/Makefile.in        |  3 ++-
 lustre/lvfs/autoMakefile.am    |  9 ++++++++-
 lustre/mdc/autoMakefile.am     |  2 ++
 8 files changed, 72 insertions(+), 13 deletions(-)

diff --git a/lustre/ChangeLog b/lustre/ChangeLog
index be83e1e739..8fdfc3098b 100644
--- a/lustre/ChangeLog
+++ b/lustre/ChangeLog
@@ -7,6 +7,7 @@ tbd         Cluster File Systems, Inc. <info@clusterfs.com>
 	- drop import inflight refcount on signal_completed_replay error (5255)
        * miscellania
 	- add pid to ldlm debugging output (4922)
+	- add --disable-server and --disable-client configure options (5786)
 
 2004-10-08  Cluster File Systems, Inc. <info@clusterfs.com>
        * version 1.3.3
diff --git a/lustre/Makefile.in b/lustre/Makefile.in
index 1a5db43c71..d383f48181 100644
--- a/lustre/Makefile.in
+++ b/lustre/Makefile.in
@@ -8,15 +8,11 @@ subdir-m += lmv
 subdir-m += ptlrpc
 subdir-m += obdecho
 subdir-m += osc
-subdir-m += mdc
-subdir-m += mds
-subdir-m += obdfilter
-subdir-m += ost
-subdir-m += llite
 subdir-m += cobd
-subdir-m += smfs
 subdir-m += cmobd 
- 
+
+@SERVER_TRUE@subdir-m += smfs mds obdfilter ost
+@CLIENT_TRUE@subdir-m += mdc llite
 
 ifeq ($(PATCHLEVEL),4)
 subdir-m += ptlbd
diff --git a/lustre/autoMakefile.am b/lustre/autoMakefile.am
index 24f80d0e29..84f3c26251 100644
--- a/lustre/autoMakefile.am
+++ b/lustre/autoMakefile.am
@@ -5,9 +5,35 @@
 
 AUTOMAKE_OPTIONS = foreign
 
-SUBDIRS = include ldiskfs lvfs obdclass lov ldlm sec ptlrpc      \
-	obdecho osc mdc lmv  mds obdfilter ost llite cobd ptlbd smfs snapfs \
-	cmobd liblustre doc utils tests conf scripts autoconf
+ALWAYS_SUBDIRS := include lvfs obdclass lov ldlm sec ptlrpc	      \
+	obdecho osc lmv cobd ptlbd cmobd doc utils tests conf scripts \
+	autoconf
+
+SERVER_SUBDIRS := ldiskfs smfs snapfs obdfilter ost mds
+
+CLIENT_SUBDIRS := mdc llite
+
+LIBLUSTRE_SUBDIRS := liblustre
+
+SUBDIRS := $(ALWAYS_SUBDIRS)
+
+if SERVER
+SUBDIRS += $(SERVER_SUBDIRS)
+endif
+
+if CLIENT
+SUBDIRS += $(CLIENT_SUBDIRS)
+endif
+
+if LIBLUSTRE
+if !CLIENT
+SUBDIRS += $(CLIENT_SUBDIRS)
+endif
+SUBDIRS += $(LIBLUSTRE_SUBDIRS)
+endif
+
+DIST_SUBDIRS := $(ALWAYS_SUBDIRS) $(SERVER_SUBDIRS) $(CLIENT_SUBDIRS) \
+	$(LIBLUSTRE_SUBDIRS)
 
 EXTRA_DIST = BUGS FDL Rules.in kernel_patches
 
diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
index bc1cdb3fc9..30960c273a 100644
--- a/lustre/autoconf/lustre-core.m4
+++ b/lustre/autoconf/lustre-core.m4
@@ -405,7 +405,9 @@ AC_MSG_RESULT([$enable_smfs])
 # Lustre linux kernel checks
 #
 AC_DEFUN([LC_PROG_LINUX],
-[LC_CONFIG_BACKINGFS
+[if test x$enable_server = xyes ; then
+	LC_CONFIG_BACKINGFS
+fi
 LC_CONFIG_PINGER
 LC_CONFIG_GSS
 LC_CONFIG_SNAPFS
@@ -421,6 +423,26 @@ LC_STRUCT_INODE
 LC_FUNC_DEV_SET_RDONLY
 ])
 
+#
+# LC_CONFIG_CLIENT_SERVER
+#
+# Build client/server sides of Lustre
+#
+AC_DEFUN([LC_CONFIG_CLIENT_SERVER],
+[AC_MSG_CHECKING([whether to build Lustre server support])
+AC_ARG_ENABLE([server],
+	AC_HELP_STRING([--disable-server],
+			[disable Lustre server support]),
+	[],[enable_server='yes'])
+AC_MSG_RESULT([$enable_server])
+
+AC_MSG_CHECKING([whether to build Lustre client support])
+AC_ARG_ENABLE([client],
+	AC_HELP_STRING([--disable-client],
+			[disable Lustre client support]),
+	[],[enable_client='yes'])
+AC_MSG_RESULT([$enable_client])])
+
 #
 # LC_CONFIG_LIBLUSTRE
 #
@@ -483,6 +505,8 @@ AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
 AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
 AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
+AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
+AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
 ])
 
 #
diff --git a/lustre/llite/autoMakefile.am b/lustre/llite/autoMakefile.am
index 9fdde59acc..0d3209cfe6 100644
--- a/lustre/llite/autoMakefile.am
+++ b/lustre/llite/autoMakefile.am
@@ -4,8 +4,10 @@
 # See the file COPYING in this distribution
 
 if MODULES
+if CLIENT
 modulefs_DATA = llite$(KMODEXT)
 endif
+endif
 
 DIST_SOURCES := $(llite-objs:.o=.c) llite_internal.h rw24.c super.c rw26.c super25.c
 MOSTLYCLEANFILES = *.o *.ko *.mod.c
diff --git a/lustre/lvfs/Makefile.in b/lustre/lvfs/Makefile.in
index 00a327d1bf..8ec55683fc 100644
--- a/lustre/lvfs/Makefile.in
+++ b/lustre/lvfs/Makefile.in
@@ -1,4 +1,5 @@
-MODULES := lvfs fsfilt_@BACKINGFS@ fsfilt_smfs
+MODULES := lvfs 
+@SERVER_TRUE@MODULES += fsfilt_@BACKINGFS@ fsfilt_smfs
 
 @SNAPFS_TRUE@MODULES += fsfilt_snap_@BACKINGFS@ fsfilt_snap_smfs 
 
diff --git a/lustre/lvfs/autoMakefile.am b/lustre/lvfs/autoMakefile.am
index 4a8075521e..460e497f66 100644
--- a/lustre/lvfs/autoMakefile.am
+++ b/lustre/lvfs/autoMakefile.am
@@ -16,10 +16,17 @@ endif
 
 if MODULES
 
-modulefs_DATA = lvfs$(KMODEXT) fsfilt_$(BACKINGFS)$(KMODEXT) fsfilt_smfs$(KMODEXT)
+modulefs_DATA := lvfs$(KMODEXT)
+
+if SERVER
+modulefs_DATA += fsfilt_$(BACKINGFS)$(KMODEXT) fsfilt_smfs$(KMODEXT)
 
 sources: fsfilt_$(BACKINGFS).c fsfilt_smfs.c fsfilt_snap_$(BACKINGFS).c
 	touch sources
+else
+sources:
+
+endif
 
 fsfilt_extN.c: fsfilt_ext3.c
 	sed -e "s/EXT3/EXTN/g" -e "s/ext3/extN/g" $< > $@
diff --git a/lustre/mdc/autoMakefile.am b/lustre/mdc/autoMakefile.am
index 4a71d24280..57e7acb5dd 100644
--- a/lustre/mdc/autoMakefile.am
+++ b/lustre/mdc/autoMakefile.am
@@ -11,8 +11,10 @@ libmdc_a_CFLAGS = $(LLCFLAGS)
 endif
 
 if MODULES
+if CLIENT
 modulefs_DATA = mdc$(KMODEXT)
 endif
+endif
 
 DIST_SOURCES = $(mdc-objs:.o=.c) mdc_internal.h
 MOSTLYCLEANFILES = *.o *.ko *.mod.c
-- 
GitLab