--- aclocal.m4.sav	2009-08-29 16:29:02.000000000 -0400
+++ aclocal.m4	2009-08-29 16:29:51.000000000 -0400
@@ -194,29 +194,6 @@
 AS_IF([test "$fp_num1" $2 "$fp_num2"], [$4], [$5])[]dnl
 ])# FP_COMPARE_VERSIONS
 
-
-dnl
-dnl Check for GreenCard and version.
-dnl
-AC_DEFUN([FPTOOLS_GREENCARD],
-[
-AC_PATH_PROG(GreenCardCmd,greencard)
-AC_CACHE_CHECK([for version of greencard], fptools_cv_greencard_version,
-changequote(, )dnl
-[if test x"$GreenCardCmd" != x; then
-   fptools_cv_greencard_version="`$GreenCardCmd --version |
-			  grep 'version' | sed -e 's/greencard. version \([^ ]*\).*/\1/g'`"
-else
-   fptools_cv_greencard_version=""
-fi
-changequote([, ])dnl
-])
-FP_COMPARE_VERSIONS([$fptools_cv_greencard_version],[-lt],[$1],
-  [AC_MSG_ERROR([greencard version $1 or later is required (found '$fptools_cv_greencard_version')])])[]dnl
-GreenCardVersion=$fptools_cv_greencard_version
-AC_SUBST(GreenCardVersion)
-])
-
 dnl
 dnl Check for Happy and version.  If we're building GHC, then we need
 dnl at least Happy version 1.14.  If there's no installed Happy, we look
@@ -237,8 +214,8 @@
 AC_CACHE_CHECK([for version of happy], fptools_cv_happy_version,
 changequote(, )dnl
 [if test x"$HappyCmd" != x; then
-   fptools_cv_happy_version="`$HappyCmd -v |
-			  grep 'Happy Version' | sed -e 's/Happy Version \([^ ]*\).*/\1/g'`" ;
+   fptools_cv_happy_version=`"$HappyCmd" -v |
+			  grep 'Happy Version' | sed -e 's/Happy Version \([^ ]*\).*/\1/g'` ;
 else
    fptools_cv_happy_version="";
 fi;
@@ -247,7 +224,7 @@
 if test ! -f compiler/parser/Parser.hs || test ! -f compiler/main/ParsePkgConf.hs || test ! -f compiler/cmm/CmmParse.hs || test ! -f compiler/parser/ParserCore.hs
 then
     FP_COMPARE_VERSIONS([$fptools_cv_happy_version],[-lt],[1.15],
-      [AC_MSG_ERROR([Happy version 1.15 or later is required to compile GHC.])])[]dnl
+      [AC_MSG_ERROR([Happy version 1.15 or later is required to compile GHC.])])[]
 fi
 HappyVersion=$fptools_cv_happy_version;
 AC_SUBST(HappyVersion)
@@ -272,8 +249,8 @@
 AC_CACHE_CHECK([for version of alex], fptools_cv_alex_version,
 changequote(, )dnl
 [if test x"$AlexCmd" != x; then
-   fptools_cv_alex_version="`$AlexCmd -v |
-			  grep 'Alex [Vv]ersion' | sed -e 's/Alex [Vv]ersion \([0-9\.]*\).*/\1/g'`" ;
+   fptools_cv_alex_version=`"$AlexCmd" -v |
+			  grep 'Alex [Vv]ersion' | sed -e 's/Alex [Vv]ersion \([0-9\.]*\).*/\1/g'` ;
 else
    fptools_cv_alex_version="";
 fi;
@@ -282,7 +259,7 @@
 if test ! -f compiler/cmm/CmmLex.hs || test ! -f compiler/parser/Lexer.hs
 then
     FP_COMPARE_VERSIONS([$fptools_cv_alex_version],[-lt],[2.1.0],
-      [AC_MSG_ERROR([Alex version 2.1.0 or later is required to compile GHC.])])[]dnl
+      [AC_MSG_ERROR([Alex version 2.1.0 or later is required to compile GHC.])])[]
 fi
 AlexVersion=$fptools_cv_alex_version;
 AC_SUBST(AlexVersion)
@@ -518,17 +495,17 @@
 if test "$fp_have_gcc" = "NO" -a -d $srcdir/ghc; then
   AC_MSG_ERROR([gcc is required])
 fi
-AC_CACHE_CHECK([version of gcc], [fp_gcc_version],
+AC_CACHE_CHECK([version of gcc], [fp_cv_gcc_version],
 [if test "$fp_have_gcc" = "YES"; then
-   fp_gcc_version="`$CC -v 2>&1 | grep 'version ' | sed -e 's/.*version [[^0-9]]*\([[0-9.]]*\).*/\1/g'`"
-   FP_COMPARE_VERSIONS([$fp_gcc_version], [-lt], [2.0],
-     [AC_MSG_ERROR([Need at least gcc version 2.0 (3.4+ recommended)])])
+   fp_cv_gcc_version="`$CC -v 2>&1 | grep 'version ' | sed -e 's/.*version [[^0-9]]*\([[0-9.]]*\).*/\1/g'`"
+   FP_COMPARE_VERSIONS([$fp_cv_gcc_version], [-lt], [3.0],
+     [AC_MSG_ERROR([Need at least gcc version 3.0 (3.4+ recommended)])])
  else
-   fp_gcc_version="not-installed"
+   fp_cv_gcc_version="not-installed"
  fi
 ])
 AC_SUBST([HaveGcc], [$fp_have_gcc])
-AC_SUBST([GccVersion], [$fp_gcc_version])
+AC_SUBST([GccVersion], [$fp_cv_gcc_version])
 ])# FP_HAVE_GCC
 
 AC_DEFUN([FP_MINGW_GCC],
@@ -785,7 +762,7 @@
 if test -n "$XmllintCmd"; then
   AC_MSG_CHECKING([for DocBook DTD])
   FP_GEN_DOCBOOK_XML
-  if $XmllintCmd --valid --noout conftest.xml > /dev/null 2>&1; then
+  if $XmllintCmd --nonet --valid --noout conftest.xml ; then
     AC_MSG_RESULT([ok])
   else
     AC_MSG_RESULT([failed])
@@ -805,7 +782,7 @@
 AC_DEFUN([FP_PROG_GHC_PKG],
 [AC_CACHE_CHECK([for ghc-pkg matching $WithGhc], fp_cv_matching_ghc_pkg,
 [fp_ghc_pkg_guess=`echo $WithGhc | sed 's,ghc\(@<:@^/\\@:>@*\)$,ghc-pkg\1,'`
-if "$fp_ghc_pkg_guess" -l > /dev/null 2>&1; then
+if "$fp_ghc_pkg_guess" -l > /dev/null 2>&1 || "$fp_ghc_pkg_guess" list > /dev/null 2>&1; then
   fp_cv_matching_ghc_pkg=$fp_ghc_pkg_guess
 elif "$fp_ghc_pkg_guess" list > /dev/null 2>&1; then
   # from 6.10, ghc-pkg doesn't support the old -l syntax any more
@@ -841,23 +818,23 @@
 [AC_REQUIRE([FP_HAVE_GCC])
 AC_CACHE_CHECK([for extra options to pass gcc when compiling via C], [fp_cv_gcc_extra_opts],
 [fp_cv_gcc_extra_opts=
- FP_COMPARE_VERSIONS([$fp_gcc_version], [-ge], [3.4],
+ FP_COMPARE_VERSIONS([$fp_cv_gcc_version], [-ge], [3.4],
   [fp_cv_gcc_extra_opts="$fp_cv_gcc_extra_opts -fwrapv"],
   [])
  case $TargetPlatform in
   i386-*|x86_64-*) 
-     FP_COMPARE_VERSIONS([$fp_gcc_version], [-ge], [3.2],
+     FP_COMPARE_VERSIONS([$fp_cv_gcc_version], [-ge], [3.2],
       [fp_cv_gcc_extra_opts="$fp_cv_gcc_extra_opts -mno-omit-leaf-frame-pointer"],
       [])
-    FP_COMPARE_VERSIONS([$fp_gcc_version], [-ge], [3.4],
-     [FP_COMPARE_VERSIONS([$fp_gcc_version], [-ge], [4.2],
+    FP_COMPARE_VERSIONS([$fp_cv_gcc_version], [-ge], [3.4],
+     [FP_COMPARE_VERSIONS([$fp_cv_gcc_version], [-ge], [4.2],
        [fp_cv_gcc_extra_opts="$fp_cv_gcc_extra_opts -fno-toplevel-reorder"],
        [fp_cv_gcc_extra_opts="$fp_cv_gcc_extra_opts -fno-unit-at-a-time"]
      )],
      [])
   ;;
   sparc-*-solaris2) 
-    FP_COMPARE_VERSIONS([$fp_gcc_version], [-ge], [4.2],
+    FP_COMPARE_VERSIONS([$fp_cv_gcc_version], [-ge], [4.2],
       [fp_cv_gcc_extra_opts="$fp_cv_gcc_extra_opts -fno-toplevel-reorder"],
       [])
   ;;
@@ -1128,7 +1105,7 @@
   rm -f *.hi
   rm -f pwd
   rm -f pwd.exe
-  $WithGhc -v0 --make pwd -o pwd
+  $WithGhc -v0 -pgmc XXPATH_TO_GCCXX -pgml XXPATH_TO_GCCXX -pgma XXPATH_TO_GCCXX --make pwd -o pwd
   cd ../..
 fi
 
