Detect and replace non-POSIX shell.

This will enable running autogen.sh on platforms like Solaris.