diff --git a/slurm.spec b/slurm.spec
index c2baee2c5e342fe73bb85677532722f1598f66f0..215f8ce4dc04af7ecd2c535172e71b00b452382c 100644
--- a/slurm.spec
+++ b/slurm.spec
@@ -16,6 +16,8 @@
 # --without pam      %_without_pam      1    don't require pam-devel RPM to be installed
 # --without readline %_without_readline 1    don't require readline-devel RPM to be installed
 # --with sgijob      %_with_sgijob      1    build proctrack-sgi-job RPM
+# --with mysql       %_with_mysql       1    require mysql support
+# --with postgres    %_with_postgres    1    require postgresql support
 
 #
 #  Allow defining --with and --without build options or %_with and %without in .rpmmacors
@@ -90,6 +92,14 @@ BuildRequires: readline-devel
 BuildRequires: openssl-devel >= 0.9.6 openssl >= 0.9.6
 %endif
 
+%if %{slurm_with mysql}
+BuildRequires: mysql-devel >= 6.0
+%endif
+
+%if %{slurm_with postgres}
+BuildRequires: postgresql-devel >= 8.0
+%endif
+
 %description 
 SLURM is an open source, fault-tolerant, and highly
 scalable cluster management and job scheduling system for Linux clusters