--- /dev/null
+#!/bin/sh
+# $Id$
+# $Name$
+
+options="-q"
+extra_options=
+
+while [ $# -gt 0 ]
+do
+ case "$1" in
+ -*) extra_options="$extra_options $1";;
+ *) break;;
+ esac
+ shift
+done
+
+test_name=$1
+expected_result=$2
+if [ -z "$test_name" ]
+then
+ test_name=check
+fi
+if [ -z "$expected_result" ]
+then
+ expected_result=0
+fi
+
+# For use outside Makefile
+if [ -z "$srcdir" ]
+then
+ srcdir=.
+ options=$extra_options
+else
+ options="$options $extra_options"
+fi
+
+outfile=$test_name.out
+logfile=check.out
+reffile=$srcdir/output/$test_name.ref
+options="$options -o $outfile"
+
+builddir=`pwd`
+ltcmd="$builddir/../libtool --mode=execute -dlopen $builddir/../gedcom/libgedcom.la"
+GCONV_PATH=.:$GCONV_PATH
+export GCONV_PATH
+ln -s $srcdir/../data/gedcom.enc .
+ln -s $builddir/../data/new.ged .
+ln -s $builddir/../iconv/glibc/.libs/ANSI_Z39.47.so .
+ln -s $srcdir/../iconv/glibc/gconv-modules .
+rm -f core
+echo "======================================================">> $logfile
+echo "Performing test '$test_name'" >> $logfile
+$ltcmd $GEDCOM_TESTENV $builddir/src/testintl $options
+result=$?
+rm gedcom.enc
+rm new.ged
+rm ANSI_Z39.47.so
+rm gconv-modules
+
+echo "Result is $result (expected: $expected_result)" >> $logfile
+if [ "$result" -ne "$expected_result" ]
+then
+ echo "Not the expected return value!" >> $logfile
+ exit 1
+else
+ if [ -r core ]
+ then
+ echo "Core file generated!" >> $logfile
+ exit 1
+ else
+ if diff $outfile $reffile >/dev/null 2>>$logfile
+ then
+ echo "Output agrees with reference output" >> $logfile
+ rm $outfile
+ exit 0
+ else
+ echo "Differences with reference output detected!" >> $logfile
+ exit 1
+ fi
+ fi
+fi