g++ linker: force static linking if static library exists? I've a program which links to many libraries. g++, by default, prefers to link to shared libraries, even if the corresponding archive exists. How can I change this preference to prefer static archives over dynamic libraries, if a static archive exists? Note, I used -static option, but it tries to find static archive for all libraries whi..