diff --git a/slurm.spec b/slurm.spec
index ac610e89c93d5258c5a731453fa536fde67a5bb3..c4aeb6727bd7b6ab80bd218622e5676c273b240f 100644
--- a/slurm.spec
+++ b/slurm.spec
@@ -69,7 +69,9 @@
 # Build with sgijob plugin and mysql (for slurmdbdb) on CHAOS systems
 %if %{?chaos}0
 %slurm_with_opt mysql
+%if %chaos < 5
 %slurm_with_opt sgijob
+%endif
 %else
 %slurm_without_opt sgijob
 %endif
@@ -128,6 +130,8 @@ BuildRequires: mysql-devel >= 5.0.0
 BuildRequires: postgresql-devel >= 8.0.0
 %endif
 
+BuildRequires: perl(ExtUtils::MakeMaker)
+
 %description 
 SLURM is an open source, fault-tolerant, and highly
 scalable cluster management and job scheduling system for Linux clusters
@@ -287,7 +291,8 @@ Perl tool to print SLURM job state information.
 %package pam_slurm
 Summary: PAM module for restricting access to compute nodes via SLURM.
 Group: System Environment/Base
-Requires: slurm slurm-devel pam-devel
+Requires: slurm slurm-devel
+BuildRequires: pam-devel
 %description pam_slurm
 This module restricts access to compute nodes in a cluster where the Simple
 Linux Utility for Resource Managment (SLURM) is in use.  Access is granted