Cleaning up the configuration/build process.
- New build.mk option: GhcWithInterpreter. It has reasonable
defaults, and shouldn't need to be overriden (you get the interpreter
if you're bootstrapping with ghc 4.09+ on an ELF architecture, at
the moment).
- compilation manager now lives in compiler/compMan. compiler/ghci
contains only interpreter-related files.
- WithGhcHc has gone, it now defaults to $(GHC). This is so that
we can reliably determine the version of $(GHC) using the stuff that
configure tells us. configure gets a new --with-ghc option so you
can specify which ghc to use.
-dnl $Id: aclocal.m4,v 1.57 2000/10/10 04:55:28 chak Exp $
+dnl $Id: aclocal.m4,v 1.58 2000/11/02 14:27:01 simonmar Exp $
dnl
dnl Extra autoconf macros for the Glasgow fptools
dnl
AC_DEFUN(FPTOOLS_GHC_VERSION,
[define([FPTOOLS_CV_GHC_VERSION], [fptools_cv_ghc_version])dnl
AC_CACHE_CHECK([version of ghc], FPTOOLS_CV_GHC_VERSION, [dnl
-${GHC-ghc} --version > conftestghc 2>&1
+${WithGhc-ghc} --version > conftestghc 2>&1
cat conftestghc >&AC_FD_CC
dnl `Useless Use Of cat' award...
changequote(<<, >>)dnl
dnl set to a value which is suitable for use in a Makefile (for example,
dnl in make's LOADLIBES macro) provided you AC_SUBST it first.
dnl
-dnl @version 0.01 $Id: aclocal.m4,v 1.57 2000/10/10 04:55:28 chak Exp $
+dnl @version 0.01 $Id: aclocal.m4,v 1.58 2000/11/02 14:27:01 simonmar Exp $
dnl @author Matthew D. Langston <langston@SLAC.Stanford.EDU>
# FPTOOLS_CHECK_LIBM - check for math library
dnl the version number increases, so you may have to adjust the above
dnl URL accordingly.
dnl
-dnl @version 0.01 $Id: aclocal.m4,v 1.57 2000/10/10 04:55:28 chak Exp $
+dnl @version 0.01 $Id: aclocal.m4,v 1.58 2000/11/02 14:27:01 simonmar Exp $
dnl @author Matthew D. Langston <langston@SLAC.Stanford.EDU>
AC_DEFUN(FPTOOLS_HAVE_OPENGL,
AC_SUBST(exeext)
-if test "$GHC" = ""; then
- AC_PATH_PROG(GHC,ghc)
-fi
-if test "$GHC" != ""; then
- FPTOOLS_GHC_VERSION([GhcVersion], [GhcMajVersion], [GhcMinVersion], [GhcPatchLevel])dnl
- AC_SUBST(GhcVersion)dnl
- AC_SUBST(GhcMajVersion)dnl
- AC_SUBST(GhcMinVersion)dnl
- AC_SUBST(GhcPatchLevel)dnl
-fi
-
-AC_PATH_PROGS(NHC,nhc nhc98)
-AC_PATH_PROG(HBC,hbc)
-
dnl --------------------------------------------------------------
dnl * Project specific configuration options
dnl --------------------------------------------------------------
dnl ** What command to use to compile compiler sources ?
dnl --------------------------------------------------------------
+if test "$GHC" = ""; then
+ AC_PATH_PROG(GHC,ghc)
+fi
+
AC_ARG_WITH(hc,
[ --with-hc=<haskell compiler>
- Use a command different from 'ghc' to compile up Haskell code.
- (no claims currently made that this will work with a compiler other than a
- recent version of GHC, but you could always try...)
+ Use a command different from 'ghc' to compile generic Haskell code.
],
[WithHc="$withval"],
[WithHc=$GHC]
)
AC_SUBST(WithHc)
+AC_ARG_WITH(ghc,
+[ --with-ghc=<haskell compiler>
+ Use a command different from 'ghc' to compile GHC-specific Haskell code
+ (including GHC itself).
+],
+[WithGhc="$withval"],
+[WithGhc=$GHC]
+)
+AC_SUBST(WithGhc)
+
+if test "$WithGhc" != ""; then
+ FPTOOLS_GHC_VERSION([GhcVersion], [GhcMajVersion], [GhcMinVersion], [GhcPatchLevel])dnl
+ AC_SUBST(GhcVersion)dnl
+ AC_SUBST(GhcMajVersion)dnl
+ AC_SUBST(GhcMinVersion)dnl
+ AC_SUBST(GhcPatchLevel)dnl
+fi
+
+AC_PATH_PROGS(NHC,nhc nhc98)
+AC_PATH_PROG(HBC,hbc)
+
dnl ** Which gcc to use?
dnl --------------------------------------------------------------
AC_ARG_WITH(gcc,
# -----------------------------------------------------------------------------
-# $Id: Makefile,v 1.105 2000/11/02 13:36:44 simonmar Exp $
+# $Id: Makefile,v 1.106 2000/11/02 14:27:02 simonmar Exp $
TOP = ..
include $(TOP)/mk/boilerplate.mk
DIRS = \
utils basicTypes types hsSyn prelude rename typecheck deSugar coreSyn \
specialise simplCore stranal stgSyn simplStg codeGen absCSyn main \
- profiling parser usageSP cprAnalysis javaGen ghci
-
+ profiling parser usageSP cprAnalysis javaGen compMan
ifeq ($(GhcWithNativeCodeGen),YES)
DIRS += nativeGen
endif
endif
+# Only include GHCi if we're bootstrapping with at least version 409
+ifeq "$(GhcWithInterpreter)" "YES"
+ghc_409_at_least = $(shell expr "$(GhcMinVersion)" \>= 9)
+ifeq "$(ghc_409_at_least)" "1"
+SRC_HC_OPTS += -DGHCI
+DIRS += ghci
+endif
+endif
HS_SRCS = $(foreach dir,$(DIRS),$(wildcard $(dir)/*.lhs) $(wildcard $(dir)/*.hs))
# driver when booting.
#
ifneq "$(GhcWithHscBuiltViaC)" "YES"
-HC=$(WithGhcHc)
+HC=$(GHC)
else
HC=$(GHC_INPLACE)
endif
import IOExts ( unsafePerformIO ) -- ToDo: remove
import PrelGHC --( unsafeCoerce#, dataToTag#,
-- indexPtrOffClosure#, indexWordOffClosure# )
-import IO ( hPutStr, stderr )
-import Char ( ord )
import PrelAddr ( Addr(..) )
import PrelFloat ( Float(..), Double(..) )
import Word
#
#---------------------------------------------------------------
-# Specify the Haskell compiler to be used to compile the compiler itself
-#
-# WithGhcHc Path name of the compiler to use
-#
-# WithGhcHcType What "type" of compiler is being used
-# Valid options:
-# HC_CHALMERS_HBC
-# HC_GLASGOW_GHC
-# HC_ROJEMO_NHC
-# HC_UNSPECIFIED
-
-WithGhcHc = @WithHc@
-
-# Variable which is set to the version number of the $(WithGhcHc) we're using.
-# Not currently used, but might come in handy sometime soon.
-#WithGhcHcVersion = $(shell echo `if ( $(WithGhcHc) --version 2>/dev/null >/dev/null ) then $(WithGhcHc) --version 2>&1 | @SedCmd@ -e 's/^.*version [^0-9]*\([.0-9]*\).*/\1/;s/\.//'; else echo unknown; fi; ` )
+# The compiler used to build GHC is $(GHC). To change the actual compiler
+# used, re-configure with --with-ghc=<path-to-ghc>.
# Extra ways in which to build the compiler (for example, you might want to
# build a profiled compiler so you can see where it spends its time)
# i386, alpha & sparc
GhcWithNativeCodeGen=$(shell if (test x$(findstring $(HostArch_CPP),i386 alpha sparc) = x); then echo NO; else echo YES; fi)
+# Include GHCi in the compiler
+ifeq "$(linux_TARGET_OS)" "1"
+GhcWithInterpreter=YES
+else
+ifeq "$(solaris_TARGET_OS)" "1"
+GhcWithInterpreter=YES
+else
+ifeq "$(freebsd_TARGET_OS)" "1"
+GhcWithInterpreter=YES
+else
+ifeq "$(netbsd_TARGET_OS)" "1"
+GhcWithInterpreter=YES
+else
+GhcWithInterpreter=NO
+endif
+endif
+endif
+endif
+
#
# Building various ways?
# (right now, empty if not).
#
# $(HC) is a generic Haskell 98 compiler, set to $(GHC) by default.
# $(MKDEPENDHS) is the Haskell dependency generator (ghc -M).
+#
+# NOTE: Don't override $(GHC) in build.mk, use configure --with-ghc instead
+# (because the version numbers have to be calculated).
-GHC = @GHC@
+GHC = @WithGhc@
GhcVersion = @GhcVersion@
GhcMajVersion = @GhcMajVersion@
GhcMinVersion = @GhcMinVersion@