Fix tests when building out-of-tree

(This was too hard. Silly autoconf.)