lib/tdb: sync build system changes and python code from samba4