Updated to detect static linking options dynamically