-## always run autogen.sh
-./autogen.sh
-
-CFLAGS="$RPM_OPT_FLAGS $EXTRA -D_GNU_SOURCE" ./configure \
-%if %with_included_talloc
- --with-included-talloc \
-%endif
-%if %with_included_tdb
- --with-included-tdb \
-%endif
-%if %with_included_tevent
- --with-included-tevent \
-%endif
+CFLAGS="$RPM_OPT_FLAGS $EXTRA -D_GNU_SOURCE" ./buildtools/bin/waf configure \
+ --builtin-libraries=replace,popt \
+ --bundled-libraries=!talloc,!tevent,!tdb \
+ --minimum-library-version=talloc:%libtalloc_version,tdb:%libtdb_version,tevent:%libtevent_version \