[start adding autoconf/automake based build system
John Meacham <john@repetae.net>**20080208061919] adddir ./ac-macros
hunk ./Makefile 1
-JHC_VERSION=0.1
-PREFIX=/usr/local
-
-all: jhc
-
-GHCDEBUGOPTS= -W -fno-warn-unused-matches # -fno-warn-unused-binds    # -O2 -ddump-simpl-stats -ddump-rules
-GHCPROFOPTS=   -prof -auto-all -osuf prof.o -hisuf prof.hi
-GHCINC=  -i. -iFrontEnd
-PACKAGES= -package mtl  -package unix -package QuickCheck
-GHCOPTS=   -O -ignore-package lang  -pgmF drift-ghc  -F $(GHCDEBUGOPTS) $(GHCINC) $(PACKAGES) -fwarn-type-defaults   -fallow-undecidable-instances  -fglasgow-exts -fallow-overlapping-instances
-
-HC = ghc
-HCI = ghci
-HC_OPTS = $(GHCOPTS)
-
-PROF_OPTS = -P
-
-BUILTSOURCES= PrimitiveOperators.hs RawFiles.hs FrontEnd/HsParser.hs FlagDump.hs FlagOpts.hs Version/Raw.hs Version/Ctx.hs Name/Prim.hs Info/Properties.hs
-
-# HSFILES is defined here, it can be updated with 'make depend' whenever a new source file is added
--include depend.make
-
-
-SUFFIXES= .hs .lhs .o .hi .hsc .c .h .ly .hi-boot .hs-boot .o-boot
-
-
-MAIN=Main.hs
-
-jhcp: $(BUILTSOURCES) $(HSFILES)
-	date '+%y%m%d%H%M.%S' > /tmp/$@.date.tmp
-	$(HC) $(GHCOPTS) $(EXTRAOPTS) $(GHCPROFOPTS) --make $(MAIN) -o $@
-	touch -t `cat /tmp/$@.date.tmp` $@
-
-jhc: $(BUILTSOURCES) $(HSFILES)
-	date '+%y%m%d%H%M.%S' > /tmp/$@.date.tmp
-	$(HC) $(GHCOPTS) $(EXTRAOPTS) --make $(MAIN) -o $@
-	touch -t `cat /tmp/$@.date.tmp` $@
-
-i ghci:
-	ghci $(GHCOPTS) $(EXTRAOPTS) Main.hs
-
-LIBPACKAGES=base-1.0.hl haskell98-1.0.hl
-LIBRARYPATH="$(PREFIX)/lib/jhc-$(JHC_VERSION)"
-DP=$(PREFIX)
-
-base-1.0.hl: jhc lib/base/base.cabal
-	-[ -e base.log ] && mv -f base.log base.log.bak
-	set -o pipefail; ./jhc -v -funboxed-tuples $(RTSOPTS) $(JHC_TEST)  -ilib/base --noauto --build-hl lib/base/base.cabal -o $@ 2>&1 | tee base.log
-
-base-1.0.prof.hl: jhc lib/base/base.cabal
-	-[ -e base.prof.log ] && mv -f base.prof.log base.prof.log.bak
-	./jhcp -v $(RTSOPTS) $(JHC_TEST) -ilib/base --noauto --build-hl lib/base/base.cabal -o base-1.0.prof.hl +RTS $(PROF_OPTS)  2>&1 | tee base.log
-
-jhc-1.0.hl: jhc lib/jhc/jhc.cabal
-	-[ -e jhc.log ] && mv -f jhc.log jhc.log.bak
-	set -o pipefail; ./jhc -v $(RTSOPTS) $(JHC_TEST)  -ilib/base --noauto --build-hl lib/jhc/jhc.cabal -o $@ 2>&1 | tee jhc.log
-
-libs: $(LIBPACKAGES)
-
-publish: $(LIBPACKAGES)
-	cp -f $(LIBPACKAGES) ~/public_html/computer/jhc/libs
-	make -C ~/public_html/computer/jhc
-
-fetch-libs:
-	rm -f $(LIBPACKAGES)
-	for f in $(LIBPACKAGES); do wget http://repetae.net/john/computer/jhc/libs/$${f}; done
-	touch $(LIBPACKAGES)
-
-haskell98-1.0.hl: jhc lib/haskell98/haskell98.cabal base-1.0.hl
-	./jhc -v $(RTSOPTS) $(JHC_TEST) -ilib/haskell98 --noauto -L- -L. -p base --build-hl lib/haskell98.cabal -o $@
-
-QuickCheck-1.0.hl: jhc base-1.0.hl
-	./jhc -v $(RTSOPTS) -d progress $(JHC_TEST) -ilib/QuickCheck -L- -L. -f cpp --build-hl lib/QuickCheck/QuickCheck.cabal -o $@
-
-install:
-	install -d "$(DP)/bin"
-	install jhc "$(DP)/bin"
-	ln -sf "$(DP)/bin/jhc" "$(DP)/bin/jhci"
-	install -d $(LIBRARYPATH)
-	install $(LIBPACKAGES) $(LIBRARYPATH)
-
-tags:
-	hasktags -c `find . -type f -name '*hs' | egrep -v '^\./(_darcs|lib|test)/'`
-	mv tags tags.tmp
-	LC_ALL=C sort tags.tmp > tags
-	rm tags.tmp
-
-
-hsdocs:
-	haddock -h $(filter-out DataConstructors.hs SelfTest.hs %/HsParser.hs FrontEnd/Representation.hs C/Gen.hs , $(HSFILES)) -o hsdocs
-
-printos:
-	echo $(HSFILES)
-
-
-depend: $(BUILTSOURCES)
-	$(HC) -M -optdep-f -optdepdep.tmp $(HC_OPTS) $(MAIN)
-	echo HSFILES=`egrep -o '[A-Za-z0-9/.]+.hs' dep.tmp | sed -e 's/^\.\///' | sort` > depend.make
-	rm -f dep.tmp
-
-clean:
-	rm -f  jhc jhcp depend.make *.hs_code.c `find . -name \*.hi -or -name \*.o-boot -or -name \*.hi-boot -or -name \*.o`
-
-tests: helloworld calendar primes
-
-helloworld: test/HelloWorld.hs jhc
-	-[ -e $@.log ] && mv -f $@.log $@.log.bak
-	./jhc -v $(JHC_TEST) test/HelloWorld.hs -o $@ 2>&1 | tee $@.log
-calendar: test/Calendar.hs jhc
-	-[ -e $@.log ] && mv -f $@.log $@.log.bak
-	./jhc -v $(JHC_TEST) test/Calendar.hs -o $@ 2>&1 | tee $@.log
-primes: test/Primes.hs jhc
-	-[ -e $@.log ] && mv -f $@.log $@.log.bak
-	./jhc -v $(JHC_TEST) test/Primes.hs -o $@ 2>&1 | tee $@.log
-
-realclean: clean
-	rm -f $(BUILTSOURCES) depend.make
-
-builtfiles: $(BUILTSOURCES)
-
-ho-clean:
-	rm -f -- `find -name \*.ho`
-hl-clean:
-	rm -f -- `find -name \*.ho`
-
-
-# Various rules for generated Haskell files
-
-%.hs: %.flags  ./utils/opt_sets.prl
-	perl ./utils/opt_sets.prl -n $< $<  > $@
-
-Info/Properties.hs: data/props.txt utils/gen_props.prl
-	perl ./utils/gen_props.prl $< > $@ || rm -f $@
-
-
-PrimitiveOperators.hs: utils/op_process.prl data/operators.txt data/primitives.txt data/PrimitiveOperators-in.hs
-	perl ./utils/op_process.prl > $@ || rm -f $@
-
-Name/Prim.hs: utils/op_names.prl data/primitives.txt data/names.txt
-	perl ./utils/op_names.prl > $@ || rm -f $@
-
-RawFiles.hs:  data/HsFFI.h data/jhc_rts.c data/jhc_rts_header.h data/wsize.h data/jhc_rts_alloc.c data/jhc_rts2.c data/ViaGhc.hs
-	perl ./utils/op_raw.prl $(basename $@)  $^ > $@
-
-FrontEnd/HsParser.hs: FrontEnd/HsParser.y
-	happy -a -g -c FrontEnd/HsParser.y
-
-Version/Ctx.hs: _darcs/inventory
-	rm -f $@
-	darcs changes --context > changes.txt  || echo "No darcs Context Available!" > changes.txt
-	perl ./utils/op_raw.prl Version.Ctx changes.txt > $@
-	rm -f changes.txt
-
-Version/Raw.hs: _darcs/inventory
-	rm -f $@
-	echo "module Version.Raw where"                                > $@
-	echo "jhcVersion = \"$(JHC_VERSION)\""                         >> $@
-	date +'compileDate = "%Y%m%d"'                                 >> $@
-	darcs changes -t '.' \
-	|  perl -e '<>;$$_=<>;s/^\s*tagged\s+/darcsTag = "/;s/$$/"/;print' >> $@
-	darcs changes --from-tag='' --xml-output | grep '</patch>' \
-	| wc -l | perl -e 'print "darcsPatches = \"".(<>-1)."\"\n"'    >> $@
-	echo '{-# NOINLINE libraryPath #-}'                            >> $@
-	echo 'libraryPath=["$(PREFIX)/lib/jhc-$(JHC_VERSION)"]'        >> $@
-
-.PHONY: depend clean realclean builtfiles clean-ho  regress hsdocs install i printos tests libs publish tags
-
rmfile ./Makefile
addfile ./Makefile.am
addfile ./configure.ac
hunk ./Makefile.am 1
+
+ACLOCAL_AMFLAGS=-I ac-macros
+
+bin_PROGRAMS = jhc
+
+jhc_SOURCES = Main.hs  $(HSFILES) $(BUILT_SOURCES) $(HSBOOT)
+
+SUFFIXES= .hs .lhs .o .hi .hsc .c .h .ly .hi-boot .hs-boot .o-boot
+BUILT_SOURCES= PrimitiveOperators.hs RawFiles.hs FrontEnd/HsParser.hs FlagDump.hs FlagOpts.hs Version/Raw.hs Version/Ctx.hs Name/Prim.hs Info/Properties.hs
+
+GHCDEBUGOPTS= -W -fno-warn-unused-matches  -fwarn-type-defaults
+GHCPROFOPTS=   -prof -auto-all -osuf prof.o -hisuf prof.hi
+GHCINC=  -i$(srcdir)/. -i$(srcdir)/FrontEnd -odir $(builddir) -hidir $(builddir)
+PACKAGES= -package mtl  -package unix -package QuickCheck -ignore-package lang
+GHCLANG=    -fallow-undecidable-instances  -fglasgow-exts -fallow-overlapping-instances
+GHCOPTS=  @HSOPTS@  -O -ignore-package lang  -pgmF drift-ghc  -F $(GHCDEBUGOPTS) $(GHCINC) $(PACKAGES) $(GHCLANG)
+
+HC = ghc
+HCI = ghci
+HC_OPTS = $(GHCOPTS)
+PROF_OPTS = -P
+
+EXTRA_DIST = FrontEnd/HsParser.y Version/Ctx.hs Version/Raw.hs $(RAWFILES) depend.make  arch/generic.arch arch/arch.c arch/i686.arch arch/x86_64.arch
+
+RAWFILES = $(srcdir)/data/HsFFI.h $(srcdir)/data/jhc_rts.c $(srcdir)/data/jhc_rts_header.h $(srcdir)/data/wsize.h $(srcdir)/data/jhc_rts_alloc.c $(srcdir)/data/jhc_rts2.c $(srcdir)/data/ViaGhc.hs
+
+-include depend.make
+
+jhc: Main.hs  $(HSFILES) $(BUILT_SOURCES)
+	$(HC) $(GHCOPTS) --make $< -o $@
+
+HSBOOT= DataConstructors.hs-boot FrontEnd/Tc/Class.hs-boot Grin/Grin.hs-boot Grin/Show.hs-boot Info/Binary.hs-boot
+
+# Various rules for generated Haskell files
+
+
+%.hs: %.hsc
+	$(HSC2HS) -C "$(CFLAGS)" -C -I. -C -I@srcdir@ -o $@ $<
+
+%.hs: %.flags  $(srcdir)/utils/opt_sets.prl
+	perl $(srcdir)/utils/opt_sets.prl -n $< $<  > $@
+
+Info/Properties.hs: $(srcdir)/data/props.txt $(srcdir)/utils/gen_props.prl
+	perl $(srcdir)/utils/gen_props.prl $< > $@ || rm -f $@
+
+
+PrimitiveOperators.hs: $(srcdir)/utils/op_process.prl $(srcdir)/data/operators.txt $(srcdir)/data/primitives.txt $(srcdir)/data/PrimitiveOperators-in.hs
+	perl $(srcdir)/utils/op_process.prl > $@ || rm -f $@
+
+Name/Prim.hs: $(srcdir)/utils/op_names.prl $(srcdir)/data/primitives.txt $(srcdir)/data/names.txt
+	perl $(srcdir)/utils/op_names.prl > $@ || rm -f $@
+
+RawFiles.hs:  $(RAWFILES)
+	perl $(srcdir)/utils/op_raw.prl $(basename $@)  $^ > $@
+
+FrontEnd/HsParser.hs: FrontEnd/HsParser.y
+	happy -a -g -c $<
+
+.INTERMEDIATE: changes.txt
+
+_dacs/inventory:
+	touch $@
+
+changes.txt: $(srcdir)/_darcs/inventory
+	(darcs changes --context || echo "No darcs Context Available!") > $@
+
+Version/Ctx.hs: changes.txt
+	rm -f $@
+	perl ./utils/op_raw.prl Version.Ctx $< > $@
+
+Version/Raw.hs: $(srcdir)/_darcs/inventory
+	rm -f $@
+	echo "module Version.Raw where"                                    > $@
+	echo "jhcVersion = \"@VERSION@\""                                  >> $@
+	date +'compileDate = "%Y%m%d"'                                     >> $@
+	darcs changes -t '.' \
+	|  perl -e '<>;$$_=<>;s/^\s*tagged\s+/darcsTag = "/;s/$$/"/;print' >> $@
+	darcs changes --from-tag='' --xml-output | grep '</patch>' \
+	| wc -l | perl -e 'print "darcsPatches = \"".(<>-1)."\"\n"'        >> $@
+	echo '{-# NOINLINE libraryPath #-}'                                >> $@
+	echo 'libraryPath=["$(libdir)/jhc-@VERSION@"]'                     >> $@
+
+
+BINDISTDIR=$(PACKAGE)-$(VERSION)-$(host)
+
+bin-dist: jhc
+	rm -rf -- $(BINDISTDIR)
+	mkdir $(BINDISTDIR)
+	strip -- jhc || true
+	cp -- jhc $(BINDISTDIR)
+	tar cvf $(BINDISTDIR).tar $(BINDISTDIR)
+	gzip -f -- $(BINDISTDIR).tar
+	rm -rf -- $(BINDISTDIR)
+
+rpm: jhc.spec dist
+	cp jhc-$(VERSION).tar.gz $(HOME)/var/rpm/SOURCES/
+	rpmbuild -ba jhc.spec
+
+# .PHONY: bin-dist depend clean
hunk ./configure.ac 1
+AC_INIT([jhc],[0.3])
+AC_CONFIG_SRCDIR(Main.hs)
+AC_CONFIG_MACRO_DIR(ac-macros)
+AC_CONFIG_AUX_DIR(ac-macros)
+AM_INIT_AUTOMAKE([foreign no-dependencies])
+
+AC_CANONICAL_HOST
+
+AC_PROGRAM_REQUIRE(hc,ghc,     [  --with-hc=<haskell compiler>    Specify location of ghc.])
+AC_ARG_WITH(hcflags,
+            [  --with-hcflags=HCFLAGS  specify flags for Haskell compiler],
+	    [HCFLAGS=$withval])
+
+AC_PROGRAM_REQUIRE(drift-ghc,drift-ghc,     [  --with-drift-ghc=<drift-ghc>    Specify location of drift-ghc binary.])
+
+AC_PROGRAM_REQUIRE(hsc2hs,hsc2hs,     [  --with-hsc2hs=<hsc2hs location>    Specify location of hsc2hs.])
+
+AC_SUBST(HC)
+AC_SUBST(HCFLAGS)
+AC_SUBST(HSC2HS)
+AC_CONFIG_FILES([Makefile jhc.spec])
+AC_OUTPUT