])dnl
-AC_DEFUN(FPTOOLS_GHC_HAS_READLINE,
-[AC_CACHE_CHECK([whether ghc has readline package], [fptools_ghc_has_readline],
-[if "${GhcPkgCmd-ghc-pkg}" --show-package readline >/dev/null 2>&1; then
- fptools_ghc_has_readline='yes';
- GhcHasReadline='YES';
- else
- fptools_ghc_has_readline='no';
- GhcHasReadline='NO';
- fi
- AC_SUBST(GhcHasReadline)
-])
-])
-
dnl ** Map an arithmetic C type to a Haskell type.
dnl Based on autconf's AC_CHECK_SIZEOF.
dnl ** check for ghc-pkg command
FP_PROG_GHC_PKG
-dnl Check whether this GHC has readline installed
-FPTOOLS_GHC_HAS_READLINE
-
AC_ARG_WITH(greencard,
[AC_HELP_STRING([--with-greencard=ARG],
[Use ARG as the path to greencard [default=autodetct]])],
test -z "$ProjectPatchLevel" && ProjectPatchLevel=0
AC_SUBST([ProjectPatchLevel])
])# FP_SETUP_PROJECT_INFO
+
+
+# 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_GHC_HAS_READLINE
+# -------------------
+AC_DEFUN(FP_GHC_HAS_READLINE,
+[AC_REQUIRE([FP_PROG_GHC_PKG])
+AC_CACHE_CHECK([whether ghc has readline package], [fp_cv_ghc_has_readline],
+[if "${GhcPkgCmd-ghc-pkg}" --show-package readline >/dev/null 2>&1; then
+ fp_cv_ghc_has_readline=yes
+else
+ fp_cv_ghc_has_readline=no
+ fi])
+AC_SUBST([GhcHasReadline], [`echo $fp_cv_ghc_has_readline | sed 'y/yesno/YESNO/'`])
+])# FP_GHC_HAS_READLINE
# Hmmm, we fix the RPM release number to 1 here... Is this convenient?
AC_SUBST([release], [1])
+# Check whether this GHC has readline installed
+FP_GHC_HAS_READLINE
+
# Write the results...
-AC_CONFIG_FILES([ghc.spec VERSION docs/users_guide/ug-book.xml mk/version.mk])
+AC_CONFIG_FILES([ghc.spec VERSION docs/users_guide/ug-book.xml mk/config.mk mk/version.mk])
AC_OUTPUT
# -----------------------------------------------------------------------------
-# $Id: config.mk,v 1.20 2003/05/19 13:01:23 simonmar Exp $
#
# GHC project configuration
#
GhcBinDistBins = hp2ps ghcprof
GhcBinDistLinks = ghc ghci ghc-pkg
+# Set to YES if $(GHC) has the readline package installed
+GhcHasReadline = @GhcHasReadline@
+
include $(GhcMainDir)/mk/version.mk