Use $ORIGIN when setting rpath.

This matches what the configure build does.

Patch by Jan Vesely.

Fixes pr14189.