Fix autogen.sh for some extreme cases