Make sure --as-needed and the other flags got checked as the last thing, workarounds linking checks issues due broken system libraries

Originally committed as revision 6849 to svn://svn.ffmpeg.org/ffmpeg/trunk
