Back-port configure.ac changes to make 3.5.x build

Sudhir was asked to build 3.5.x and the configure script failed to make sense of libxml2.
After some debugging and git-archeology, I found the relevant changes in master's history that (we hope) restore 3.5.x to a build-able state.  Currently awaiting test build.