merged from upstream and re-fixed configure.ac