Fix make check for out-of-tree builds.
Merge branch 'bug2190' into bug2193

to be able to do "make check".