Revert "Use LDSHARED configuration from ./configure everywhere"

This reverts commit 688769ab06b9787b28689c3c4bef58acdb6ea7bd.