autotools: avoid check_SCRIPTS duplication

The check_SCRIPTS content must be added to EXTRA_DIST, otherwise it will
not be included by make dist and it won't be possible to run make check
successfully.

One solution would be to add $(check_SCRIPTS) to EXTRA_DIST to avoid
duplication and help with long term maintenance. However, $(srcdir) is
not supported in the content of the check_SCRIPTS variable.

A GNU Make variable substitution (patsubst) is used to prepend $(srcdir)
to each script, only when used in the EXTRA_DIST variable.

Signed-off-by: Loic Dachary <loic@dachary.org>
Merge pull request #1993 from dachary/fix_ut

autotools: avoid check_SCRIPTS duplication

Reviewed-by: Wei Luo <luowei@yahoo-inc.com>