configure: support target dependent linking