Link LazyLinalg with cusolver statically when needed (#79324)
By copy-n-pasting the static linking logic from `libtorch_cuda` if
lazylinalg is not enabled
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79324
Approved by: https://github.com/atalman