[project @ 2000-11-02 14:27:01 by simonmar]
authorsimonmar <unknown>
Thu, 2 Nov 2000 14:27:02 +0000 (14:27 +0000)
committersimonmar <unknown>
Thu, 2 Nov 2000 14:27:02 +0000 (14:27 +0000)
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.

aclocal.m4
configure.in
ghc/compiler/Makefile
ghc/compiler/compMan/CmLink.lhs [moved from ghc/compiler/ghci/CmLink.lhs with 100% similarity]
ghc/compiler/compMan/CmStaticInfo.lhs [moved from ghc/compiler/ghci/CmStaticInfo.lhs with 100% similarity]
ghc/compiler/compMan/CmSummarise.lhs [moved from ghc/compiler/ghci/CmSummarise.lhs with 100% similarity]
ghc/compiler/compMan/CompManager.lhs [moved from ghc/compiler/ghci/CompManager.lhs with 100% similarity]
ghc/compiler/ghci/MCI_make_constr.hi-boot [moved from ghc/compiler/stgSyn/MCI_make_constr.hi-boot with 100% similarity]
ghc/compiler/ghci/StgInterp.lhs [moved from ghc/compiler/stgSyn/StgInterp.lhs with 99% similarity]
mk/config.mk.in

index 1840466..8e662fe 100644 (file)
@@ -1,4 +1,4 @@
-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
@@ -365,7 +365,7 @@ 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
@@ -820,7 +820,7 @@ dnl The variable LIBM (which is not an output variable by default) is
 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
@@ -908,7 +908,7 @@ dnl Please note that as the ac_opengl macro and the toy example evolves,
 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,
index 2c82bdc..b008248 100644 (file)
@@ -332,20 +332,6 @@ dnl AC_SUBST(TargetVendor_CPP)
 
 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 --------------------------------------------------------------
@@ -356,17 +342,40 @@ dnl use either is considered a Feature.
 
 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,
index fd48e28..c8651c7 100644 (file)
@@ -1,5 +1,5 @@
 # -----------------------------------------------------------------------------
-# $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
@@ -91,8 +91,7 @@ $(HS_PROG) :: $(HS_SRCS)
 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
@@ -104,6 +103,14 @@ SRC_HC_OPTS += -DILX
 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))
 
@@ -149,7 +156,7 @@ SRC_MKDEPENDC_OPTS += -D__GLASGOW_HASKELL__=$(ProjectVersionInt)
 # driver when booting.
 #
 ifneq "$(GhcWithHscBuiltViaC)" "YES"
-HC=$(WithGhcHc)
+HC=$(GHC)
 else
 HC=$(GHC_INPLACE)
 endif
similarity index 99%
rename from ghc/compiler/stgSyn/StgInterp.lhs
rename to ghc/compiler/ghci/StgInterp.lhs
index 3f7ad4b..e3e58c0 100644 (file)
@@ -63,8 +63,6 @@ import {-# SOURCE #-} MCI_make_constr
 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
index 5d78e07..24d43d9 100644 (file)
@@ -141,22 +141,8 @@ IncludeTestDirsInBuild=NO
 #
 #---------------------------------------------------------------
 
-# 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)
@@ -185,6 +171,25 @@ GhcWithHscBuiltViaC=@BootingFromHc@
 #   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).
@@ -510,8 +515,11 @@ HSTAGS_PREFIX           = $(FPTOOLS_TOP)/ghc/utils/hstags/
 #
 # $(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@