fixed handling of external libraries

we can have dynamic linking or static linking but not both (damn you GCC
conventions)