diff --git a/config/lustre-build.m4 b/config/lustre-build.m4
index 81d7e6fe6fb79c13cf4a0a683f24d08099a423c1..acc0cc12e9a897f620ce85e74d5a4f43bc7a9aed 100644
--- a/config/lustre-build.m4
+++ b/config/lustre-build.m4
@@ -530,8 +530,11 @@ fi
 if test x$enable_zfs = xyes ; then
 	RPMBINARGS="$RPMBINARGS --with zfs"
 fi
-if test x$enable_gss_keyring == xno ; then
-	RPMBINARGS="$RPMBINARGS --without gss_keyring"
+if test x$enable_gss_keyring = xyes ; then
+	RPMBINARGS="$RPMBINARGS --with gss_keyring --with gss"
+fi
+if test x$enable_gss = xyes ; then
+	RPMBINARGS="$RPMBINARGS --with gss"
 fi
 if test x$enable_iokit != xyes ; then
 	RPMBINARGS="$RPMBINARGS --without lustre_iokit"
diff --git a/lustre.spec.in b/lustre.spec.in
index 1ce962be433fbecf2bd8906e10572a3031c4e768..6cf311d4c91f127d719fdc8b03d472f15ed656ed 100644
--- a/lustre.spec.in
+++ b/lustre.spec.in
@@ -9,12 +9,21 @@
 %bcond_without lustre_iokit
 %bcond_without lustre_modules
 %bcond_with snmp
-%bcond_without gss_keyring
+%bcond_with gss
+%bcond_with gss_keyring
 %bcond_without manpages
 %bcond_without shared
 %bcond_without static
 %bcond_with    systemd
 
+# By default both gss and gss keyring are disabled.
+# gss keyring requires the gss core. If the builder
+# request gss_keyring we must enable gss core even if
+# the builder attempts to disable gss.
+%if %{with gss_keyring}
+    %define with_gss
+%endif
+
 %if %{without servers}
     # --without servers overrides --with {ldiskfs|zfs}
     # so undefine the internal variables set by bcond_*
@@ -313,6 +322,7 @@ fi
 	%{!?with_servers:--disable-server} \
 	%{!?with_zfs:--without-zfs} \
 	%{!?with_snmp:--disable-snmp} \
+	%{!?with_gss:--disable-gss} \
 	%{!?with_gss_keyring:--disable-gss-keyring} \
 	%{!?with_manpages:--disable-manpages} \
 	%{!?with_systemd:--with-systemdsystemunitdir=no} \
@@ -374,6 +384,7 @@ echo '%{_sysconfdir}/sysconfig/lustre' >>lustre.files
 %if %{with gss_keyring}
 echo '%{_sysconfdir}/init.d/lsvcgss' >>lustre.files
 echo '%{_sysconfdir}/sysconfig/lsvcgss' >>lustre.files
+echo '%config(noreplace) %{_sysconfdir}/request-key.d/lgssc.conf' >>lustre.files
 %endif
 %endif
 
@@ -382,11 +393,6 @@ echo '%{_sysconfdir}/init.d/lnet' >>lustre.files
 %endif
 %endif
 
-CONFIGURE_ARGS="%{?configure_args}"
-if [ -z "$(echo $CONFIGURE_ARGS | grep "\-\-disable\-gss\-keyring")" ]; then
-    echo '%config(noreplace) %{_sysconfdir}/request-key.d/lgssc.conf' >>lustre.files
-fi
-
 %if %{with servers}
 mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/ocf/resource.d/lustre/
 install -m 0755 contrib/scripts/pacemaker/* $RPM_BUILD_ROOT%{_prefix}/lib/ocf/resource.d/lustre/
diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
index 3539bf95f2381994ea7aa2047ce188466d03b534..f1040794be4d9ae0a0fcf6652db29bd22d5242e1 100644
--- a/lustre/autoconf/lustre-core.m4
+++ b/lustre/autoconf/lustre-core.m4
@@ -327,10 +327,13 @@ AS_IF([test "x$enable_gss" != xno], [
 		AC_DEFINE([HAVE_GSS], [1], [Define this is if you enable gss])
 		enable_gss="yes"
 	], [
+		enable_gss_keyring="no"
 		enable_gss="no"
 	])
 
 	enable_ssk=$enable_gss
+], [
+	enable_gss_keyring="no"
 ])
 ]) # LC_CONFIG_GSS
 
diff --git a/lustre/conf/Makefile.am b/lustre/conf/Makefile.am
index d452924f616e85efc980634a09b1af2fccd0adeb..3e5bc689bc2acfc2c8e01d1d6b3b17038187c774 100644
--- a/lustre/conf/Makefile.am
+++ b/lustre/conf/Makefile.am
@@ -57,14 +57,11 @@ sysconfigdir = $(sysconfdir)/sysconfig
 sysconfig_DATA = lustre
 if GSS_KEYRING
 sysconfig_DATA += lsvcgss
+requestkeydir = $(sysconfdir)/request-key.d
+requestkey_DATA = lgssc.conf
 endif
 endif
 endif
 
 modprobedir = $(sysconfdir)/modprobe.d
 modprobe_DATA = ko2iblnd.conf
-
-if GSS_KEYRING
-requestkeydir = $(sysconfdir)/request-key.d
-requestkey_DATA = lgssc.conf
-endif