We shouldn't allow choosing whether modules could be build as a sheared module or statically linked into smbd.
We should build as many as possible modules as shared modules and only static what is really needed.
This is the list of modules distributions build as shared modules:
idmap_ad idmap_rid idmap_adex idmap_hash idmap_tdb2
pdb_tdbsam pdb_ldap pdb_ads pdb_smbpasswd pdb_wbc_sam pdb_samba4
auth_unix auth_wbc auth_server auth_netlogond auth_script auth_samba4
These modules should always be shared modules.
The rest should be clean up and always linked into smbd. This is probably:
auth_builtin auth_domain auth_sam auth_winbind