diff --git a/ypserv.spec b/ypserv.spec
index 5770032..79e7fc8 100644
--- a/ypserv.spec
+++ b/ypserv.spec
@@ -33,7 +33,7 @@ Patch12: ypserv-2.26-shadow.patch
 Patch13: ypserv-2.26-errmsg.patch
 Patch14: ypserv-2.26-emptydomain.patch
 Patch15: ypserv-2.26-retval.patch
-BuildRequires: gdbm-devel
+BuildRequires: qdbm-devel
 BuildRequires: systemd-units
 
 %description
@@ -70,6 +70,8 @@ machines.
 %patch13 -p1 -b .errmsg
 %patch14 -p1 -b .emptydomain
 %patch15 -p1 -b .retval
+sed -i -e 's/<gdbm\.h>/<hovel.h>/' */*.[ch]
+sed -i -e 's/-lgdbm/-lqdbm/' configure
 
 %build
 cp etc/README etc/README.etc
@@ -78,6 +80,7 @@ export CFLAGS="$RPM_OPT_FLAGS -fPIC"
 %else
 export CFLAGS="$RPM_OPT_FLAGS -fpic"
 %endif
+export CPPFLAGS="$( pkg-config --cflags qdbm )"
 %configure --enable-checkroot --enable-fqdn --libexecdir=%{_libdir}/yp
 make
 
