3 # Try to find a ghc-pkg matching the ghc mentioned in the environment variable
4 # WithGhc. Sets the output variable GhcPkgCmd.
5 AC_DEFUN([FP_PROG_GHC_PKG],
6 [AC_CACHE_CHECK([for ghc-pkg matching $WithGhc], fp_cv_matching_ghc_pkg,
8 # If we are told to use ghc-stage2, then we're using an in-tree
9 # compiler. In this case, we just want ghc-pkg, not ghc-pkg-stage2,
10 # so we sed off -stage[0-9]$. However, if we are told to use
11 # ghc-6.12.1 then we want to use ghc-pkg-6.12.1, so we keep any
13 fp_ghc_pkg_guess=`echo "$WithGhc" | sed -e 's/-stage@<:@0-9@:>@$//' -e 's,ghc\(@<:@^/\\@:>@*\)$,ghc-pkg\1,'`
14 if "$fp_ghc_pkg_guess" list > /dev/null 2>&1; then
15 fp_cv_matching_ghc_pkg=$fp_ghc_pkg_guess
17 AC_MSG_ERROR([Cannot find matching ghc-pkg])
19 GhcPkgCmd=$fp_cv_matching_ghc_pkg