Add Autoconf macros for SWIG build.

From git://git.sv.gnu.org/autoconf-archive.git
at commit bc79e96c971db0c59f9f0ab3f4b1c0aa256d472a
First stab at adding Java SWIG support.

Also moved stuff around.