Support out of tree builds

Ensure the tests directory is present only when check is available.  Fix
an include error when running "make check" from an out of tree build.