Fix remaining known autotools issues

Now autotools building method should be stable even for cross compiling.