smarter gcc version check
fix gd symbols overlap with real gd lib