THRIFT-932. hs: Haskell tests need to be run through 'make check' (and probably 'cabal check') too

Tests are now self-contained and correctly exit after running. There's a single run script which has improved error messages and defaults to the thrift binary compiled in the current source directory instead of those in PATH. And as a bonus hooks both cabal check and running the tests to make check. 

Patch: Christian Lavoie

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1004861 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/configure.ac b/configure.ac
index dc08344..bf8ef6d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -203,14 +203,18 @@
 AX_THRIFT_LIB(haskell, [Haskell], yes)
 have_haskell=no
 RUNHASKELL=true
+CABAL=true
 if test "$with_haskell" = "yes"; then
+  AC_PATH_PROG([CABAL], [cabal])
   AC_PATH_PROG([RUNHASKELL], [runhaskell])
-  if test "x$RUNHASKELL" != "x"; then
+  if test "x$CABAL" != "x" -a "x$RUNHASKELL" != "x"; then
     have_haskell="yes"
   else
     RUNHASKELL=true
+    CABAL=true
   fi
 fi
+AC_SUBST(CABAL)
 AC_SUBST(RUNHASKELL)
 AM_CONDITIONAL(WITH_HASKELL, [test "$have_haskell" = "yes"])
 
@@ -351,9 +355,9 @@
   lib/Makefile
   lib/cpp/Makefile
   lib/cpp/test/Makefile
-  lib/cpp/thrift.pc
   lib/cpp/thrift-nb.pc
   lib/cpp/thrift-z.pc
+  lib/cpp/thrift.pc
   lib/csharp/Makefile
   lib/erl/Makefile
   lib/erl/src/Makefile
@@ -365,6 +369,7 @@
   lib/py/Makefile
   lib/rb/Makefile
   test/Makefile
+  test/hs/Makefile
   test/py/Makefile
   test/rb/Makefile
 ])
@@ -417,6 +422,7 @@
 if test "$have_haskell" = "yes" ; then
   echo
   echo "Using Haskell ................ : $RUNHASKELL"
+  echo "Using Cabal .................. : $CABAL"
 fi
 if test "$have_perl" = "yes" ; then
   echo