Better lib_dir detection.
Multi API.