Update autogen.sh
Check library and add flags for configure