[project @ 2004-08-28 16:20:35 by panne]
authorpanne <unknown>
Sat, 28 Aug 2004 16:20:36 +0000 (16:20 +0000)
committerpanne <unknown>
Sat, 28 Aug 2004 16:20:36 +0000 (16:20 +0000)
Beautified test for ghc-pkg

aclocal.m4
configure.ac

index d767552..2b37051 100644 (file)
@@ -954,6 +954,26 @@ fi
 ])# FP_PROG_FO_PROCESSOR
 
 
+# FP_PROG_GHC_PKG
+# ----------------
+# Try to find a ghc-pkg matching the ghc mentioned in the environment variable
+# WithGhc. If the latter is unset or no matching ghc-pkg can be found, try to
+# find a plain ghc-pkg. Sets the output variable GhcPkgCmd.
+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
+  fp_cv_matching_ghc_pkg=$fp_ghc_pkg_guess
+else
+  fp_cv_matching_ghc_pkg=no
+fi])
+if test x"$fp_cv_matching_ghc_pkg" = xno; then
+  AC_PATH_PROG([GhcPkgCmd], [ghc-pkg])
+else
+  GhcPkgCmd=$fp_cv_matching_ghc_pkg
+fi])# FP_PROG_GHC_PKG
+
+
 # FP_CHECK_WIN32
 # --------------
 # If Windows is the target platform (e.g. MinGW/MSYS or Cygwin with
index 586d33c..de601b7 100644 (file)
@@ -860,15 +860,7 @@ FP_DIR_DOCBOOK_XSL([/usr/share/xml/docbook/stylesheet/nwalsh/current /usr/share/
 FP_PROG_FO_PROCESSOR
 
 dnl ** check for ghc-pkg command
-changequote(, )dnl
-ghc_pkg_guess=`echo $WithGhc | sed 's@ghc\([^/\\]*\)$@ghc-pkg\1@'`
-changequote([, ])dnl
-if $ghc_pkg_guess -l >/dev/null 2>/dev/null; then
-   GhcPkgCmd=$ghc_pkg_guess
-   AC_MSG_NOTICE([using $ghc_pkg_guess for ghc-pkg])
-else
-   AC_PATH_PROG(GhcPkgCmd,ghc-pkg)
-fi
+FP_PROG_GHC_PKG
 
 AC_ARG_WITH(greencard,
 [AC_HELP_STRING([--with-greencard=ARG],