build: re-add AM_LDFLAGS where it's overridden

using _LDFLAGS replaces AM_LDFLAGS rather than adding to it.
build: fix win32 static linking after libtool merge

Libtool eats the -static flag rather than passing it along to the compiler. To
get the same effect, -all-static is used instead.
Merge pull request #4490

575e70c build: fix win32 static linking after libtool merge (Cory Fields)
9a427da build: re-add AM_LDFLAGS where it's overridden (Cory Fields)