consensus lib work: some win build fixes necessary for dll creation

This is a follow-up of #5081. It includes a different fix for the link problem that should be more robust anyway.


- Fix for linking static libs into dll's.
- Split out LIBS for Windows builds as was done for INCLUDES in 6b09940.

This should result in no noticeable changes.
This looks like a hack. Are there still complications if we use LDFLAGS -no-undefined to tell libtool we don't have undefined symbols in our libraries?