added autogen.sh script to update buildsystem
fixed command line parsing of mode switch