From 803963adcff2a811b7ec494e37ab8b2e318bff45 Mon Sep 17 00:00:00 2001 From: simonmar Date: Thu, 2 Nov 2000 14:27:02 +0000 Subject: [PATCH] [project @ 2000-11-02 14:27:01 by simonmar] 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 | 8 ++-- configure.in | 43 ++++++++++++-------- ghc/compiler/Makefile | 15 +++++-- ghc/compiler/{ghci => compMan}/CmLink.lhs | 0 ghc/compiler/{ghci => compMan}/CmStaticInfo.lhs | 0 ghc/compiler/{ghci => compMan}/CmSummarise.lhs | 0 ghc/compiler/{ghci => compMan}/CompManager.lhs | 0 .../{stgSyn => ghci}/MCI_make_constr.hi-boot | 0 ghc/compiler/{stgSyn => ghci}/StgInterp.lhs | 2 - mk/config.mk.in | 42 +++++++++++-------- 10 files changed, 66 insertions(+), 44 deletions(-) rename ghc/compiler/{ghci => compMan}/CmLink.lhs (100%) rename ghc/compiler/{ghci => compMan}/CmStaticInfo.lhs (100%) rename ghc/compiler/{ghci => compMan}/CmSummarise.lhs (100%) rename ghc/compiler/{ghci => compMan}/CompManager.lhs (100%) rename ghc/compiler/{stgSyn => ghci}/MCI_make_constr.hi-boot (100%) rename ghc/compiler/{stgSyn => ghci}/StgInterp.lhs (99%) diff --git a/aclocal.m4 b/aclocal.m4 index 1840466..8e662fe 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -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 # 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 AC_DEFUN(FPTOOLS_HAVE_OPENGL, diff --git a/configure.in b/configure.in index 2c82bdc..b008248 100644 --- a/configure.in +++ b/configure.in @@ -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= - 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= + 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, diff --git a/ghc/compiler/Makefile b/ghc/compiler/Makefile index fd48e28..c8651c7 100644 --- a/ghc/compiler/Makefile +++ b/ghc/compiler/Makefile @@ -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 diff --git a/ghc/compiler/ghci/CmLink.lhs b/ghc/compiler/compMan/CmLink.lhs similarity index 100% rename from ghc/compiler/ghci/CmLink.lhs rename to ghc/compiler/compMan/CmLink.lhs diff --git a/ghc/compiler/ghci/CmStaticInfo.lhs b/ghc/compiler/compMan/CmStaticInfo.lhs similarity index 100% rename from ghc/compiler/ghci/CmStaticInfo.lhs rename to ghc/compiler/compMan/CmStaticInfo.lhs diff --git a/ghc/compiler/ghci/CmSummarise.lhs b/ghc/compiler/compMan/CmSummarise.lhs similarity index 100% rename from ghc/compiler/ghci/CmSummarise.lhs rename to ghc/compiler/compMan/CmSummarise.lhs diff --git a/ghc/compiler/ghci/CompManager.lhs b/ghc/compiler/compMan/CompManager.lhs similarity index 100% rename from ghc/compiler/ghci/CompManager.lhs rename to ghc/compiler/compMan/CompManager.lhs diff --git a/ghc/compiler/stgSyn/MCI_make_constr.hi-boot b/ghc/compiler/ghci/MCI_make_constr.hi-boot similarity index 100% rename from ghc/compiler/stgSyn/MCI_make_constr.hi-boot rename to ghc/compiler/ghci/MCI_make_constr.hi-boot diff --git a/ghc/compiler/stgSyn/StgInterp.lhs b/ghc/compiler/ghci/StgInterp.lhs similarity index 99% rename from ghc/compiler/stgSyn/StgInterp.lhs rename to ghc/compiler/ghci/StgInterp.lhs index 3f7ad4b..e3e58c0 100644 --- a/ghc/compiler/stgSyn/StgInterp.lhs +++ b/ghc/compiler/ghci/StgInterp.lhs @@ -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 diff --git a/mk/config.mk.in b/mk/config.mk.in index 5d78e07..24d43d9 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -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=. # 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@ -- 1.7.10.4