Test whether ld flags exist before using them