build: handle library dependencies in configure