From e568f1f6bf47ff1a37ba61665add06ea205b0df4 Mon Sep 17 00:00:00 2001 From: Don Stewart Date: Thu, 18 Aug 2005 05:03:08 +0000 Subject: [PATCH] HEADS UP: First go at cabalising hs-plugins build system. Bugs have been introduced though --- BUILDING.CVS | 23 - Makefile | 38 +- config.h.in | 48 +- config.mk.in | 44 +- configure | 781 +++++++----------- configure.ac | 152 +--- examples/build.mk | 1 - examples/conf/simple/prog/Main.hs | 4 + examples/dynload/io/prog/Main.hs | 2 +- examples/dynload/poly/prog/Main.hs | 2 +- examples/dynload/should_fail/prog/Main.hs | 2 +- examples/dynload/should_fail_1/prog/Main.hs | 2 +- examples/dynload/simple/prog/Main.hs | 2 +- examples/eval.mk | 2 - examples/foreign.mk | 1 - {src/altdata => plugins}/AltData/Dynamic.hs | 0 {src/altdata => plugins}/AltData/Typeable.hs | 0 {src/hi => plugins}/Language/Hi/Binary.hs | 0 {src/hi => plugins}/Language/Hi/FastMutInt.hs | 0 {src/hi => plugins}/Language/Hi/FastString.hs | 0 {src/hi => plugins}/Language/Hi/Parser.hs | 3 +- {src/hi => plugins}/Language/Hi/PrimPacked.hs | 0 {src/hi => plugins}/Language/Hi/Syntax.hs | 0 {src/hi => plugins}/Language/Hi/hschooks.c | 0 {src/hi => plugins}/Language/Hi/hschooks.h | 0 {src/plugins => plugins}/System/Eval.hs | 0 .../System/Eval/Haskell.hs | 0 {src/plugins => plugins}/System/Eval/Utils.hs | 28 +- {src/plugins => plugins}/System/MkTemp.hs | 0 {src/plugins => plugins}/System/Plugins.hs | 0 .../System/Plugins/Consts.hs | 4 +- .../plugins => plugins}/System/Plugins/Env.hs | 2 +- .../System/Plugins/Load.hs | 2 + .../System/Plugins/LoadTypes.hs | 0 .../System/Plugins/Make.hs | 0 .../System/Plugins/Package.hs | 0 .../System/Plugins/PackageAPI.hs | 2 +- .../System/Plugins/ParsePkgConfCabal.hs | 0 .../System/Plugins/ParsePkgConfCabal.y | 0 .../System/Plugins/ParsePkgConfLite.hs | 68 +- .../System/Plugins/ParsePkgConfLite.y | 0 .../System/Plugins/Parser.hs | 0 .../System/Plugins/Utils.hs | 4 +- src/Makefile | 30 - src/README | 23 - src/altdata/Makefile | 12 - src/altdata/altdata.conf.in.cpp | 52 -- src/build.mk | 131 --- src/hi/Makefile | 18 - src/hi/hi.conf.in.cpp | 57 -- src/plugins/Makefile | 40 - src/plugins/plugins.conf.in.cpp | 70 -- 52 files changed, 453 insertions(+), 1197 deletions(-) delete mode 100644 BUILDING.CVS rename {src/altdata => plugins}/AltData/Dynamic.hs (100%) rename {src/altdata => plugins}/AltData/Typeable.hs (100%) rename {src/hi => plugins}/Language/Hi/Binary.hs (100%) rename {src/hi => plugins}/Language/Hi/FastMutInt.hs (100%) rename {src/hi => plugins}/Language/Hi/FastString.hs (100%) rename {src/hi => plugins}/Language/Hi/Parser.hs (99%) rename {src/hi => plugins}/Language/Hi/PrimPacked.hs (100%) rename {src/hi => plugins}/Language/Hi/Syntax.hs (100%) rename {src/hi => plugins}/Language/Hi/hschooks.c (100%) rename {src/hi => plugins}/Language/Hi/hschooks.h (100%) rename {src/plugins => plugins}/System/Eval.hs (100%) rename {src/plugins => plugins}/System/Eval/Haskell.hs (100%) rename {src/plugins => plugins}/System/Eval/Utils.hs (68%) rename {src/plugins => plugins}/System/MkTemp.hs (100%) rename {src/plugins => plugins}/System/Plugins.hs (100%) rename {src/plugins => plugins}/System/Plugins/Consts.hs (97%) rename {src/plugins => plugins}/System/Plugins/Env.hs (99%) rename {src/plugins => plugins}/System/Plugins/Load.hs (99%) rename {src/plugins => plugins}/System/Plugins/LoadTypes.hs (100%) rename {src/plugins => plugins}/System/Plugins/Make.hs (100%) rename {src/plugins => plugins}/System/Plugins/Package.hs (100%) rename {src/plugins => plugins}/System/Plugins/PackageAPI.hs (98%) rename {src/plugins => plugins}/System/Plugins/ParsePkgConfCabal.hs (100%) rename {src/plugins => plugins}/System/Plugins/ParsePkgConfCabal.y (100%) rename {src/plugins => plugins}/System/Plugins/ParsePkgConfLite.hs (91%) rename {src/plugins => plugins}/System/Plugins/ParsePkgConfLite.y (100%) rename {src/plugins => plugins}/System/Plugins/Parser.hs (100%) rename {src/plugins => plugins}/System/Plugins/Utils.hs (99%) delete mode 100644 src/Makefile delete mode 100644 src/README delete mode 100644 src/altdata/Makefile delete mode 100644 src/altdata/altdata.conf.in.cpp delete mode 100644 src/build.mk delete mode 100644 src/hi/Makefile delete mode 100644 src/hi/hi.conf.in.cpp delete mode 100644 src/plugins/Makefile delete mode 100644 src/plugins/plugins.conf.in.cpp diff --git a/BUILDING.CVS b/BUILDING.CVS deleted file mode 100644 index 6c9e620..0000000 --- a/BUILDING.CVS +++ /dev/null @@ -1,23 +0,0 @@ -CVS BUILDING INSTRUCTIONS -========================= - -These are build instructions if you've checked out hs-plugins -from CVS (instead of downloading a source distribution tarball). - -1. Use autoconf to generate the GNU ./configure script: - -2. Build hs-plugins as usual with ./configure && make - - -cvsps -===== - -For people who are used to more modern revision control systems -(such as Darcs, Subversion and Arch) and miss working with -'patchsets' instead of the disjoint per-file patches that CVS -uses, take a look at cvsps , -a patchset manager for CVS. While it doesn't, by any means, give -you the many advantages that more modern source control systems -offer you, it certainly makes using CVS and managing patches far -easier! - diff --git a/Makefile b/Makefile index 78a9017..a5c8082 100644 --- a/Makefile +++ b/Makefile @@ -8,12 +8,13 @@ all: build EvalHaskell.h build:: - cd src && $(MAKE) - @find src -name depend -exec rm {} \; - @#cd src && $(MAKE) way=p + cd plugins ;\ + $(GHC) -o setup --make Setup.hs ;\ + ./setup configure --prefix=$(PREFIX) --with-happy=$(TOP)/happy.sh ;\ + ./setup build EvalHaskell.h: build - cp src/plugins/System/Eval/Haskell_stub.h $@ + cp plugins/System/Eval/Haskell_stub.h $@ # # installing @@ -25,22 +26,7 @@ install: $(INSTALL_DATA) EvalHaskell.h $(LIBDIR)/include $(INSTALL_DATA_DIR) $(MANDIR)/man1 $(INSTALL_DATA) docs/hs-plugins.1 $(MANDIR)/man1 - @(cd src && $(MAKE) install) - -# -# and register the library with ghc package system -# Use this target if installing by hand. May need to be performed as root -# -register: - env LIBDIR=${LIBDIR} $(GHC_PKG) -u < src/altdata/altdata.conf.in - env LIBDIR=${LIBDIR} $(GHC_PKG) -u < src/hi/hi.conf.in - env LIBDIR=${LIBDIR} $(GHC_PKG) -u < src/plugins/plugins.conf.in - -# and unregister the packages -unregister: - $(GHC_PKG) -r plugins - $(GHC_PKG) -r hi - $(GHC_PKG) -r altdata + cd plugins && ./setup install # # regress check. TODO check expected output @@ -51,7 +37,7 @@ check: exit 1 ;\ fi @( d=/tmp/plugins.tmp.$$$$ ; mkdir $$d ; export TMPDIR=$$d ;\ - for i in `find examples ! -name CVS -type d -maxdepth 2 -mindepth 2` ; do \ + for i in `find examples ! -name CVS -type d -maxdepth 2 -mindepth 2 | sort` ; do \ printf "=== testing %-50s ... " "$$i" ; \ ( cd $$i ; if [ -f dont_test ] ; then \ echo "ignored." ;\ @@ -61,18 +47,16 @@ check: fi ) 2> /dev/null ;\ done ; rm -rf $$d ) - # # making clean # CLEAN_FILES += *.conf.*.old *~ -EXTRA_CLEANS+=*.conf.inplace* *.conf.in *.h autom4te.cache \ - config.h config.mk config.log config.status clean: cd docs && $(MAKE) clean - cd src && $(MAKE) clean + cd plugins && ./setup clean 2> /dev/null || true + cd plugins && rm -rf dist Setup.hi Setup.o setup rm -rf $(CLEAN_FILES) find examples -name '*.a' -exec rm {} \; find examples -name '*~' -exec rm {} \; @@ -87,7 +71,9 @@ clean: rm -rf examples/hmake/one-shot/runplugs rm -f EvalHaskell.h +EXTRA_CLEANS+=*.conf.inplace* *.conf.in *.h autom4te.cache \ + config.h config.mk config.log config.status distclean: clean rm -rf $(EXTRA_CLEANS) -include config.mk +-include config.mk diff --git a/config.h.in b/config.h.in index 73db90a..fcdaca6 100644 --- a/config.h.in +++ b/config.h.in @@ -1,21 +1,43 @@ -/* - * Copyright (c) 2004 Don Stewart - http://www.cse.unsw.edu.au/~dons - * LGPL version 2.1 or later (see http://www.gnu.org/copyleft/lesser.html) - */ +/* config.h.in. Generated from configure.ac by autoheader. */ -/* symbols that must be assigned to variables in Haskell code */ +/* Defined if compiling with mingw */ +#undef CYGWIN -/* NOTE: this is not the same as symbols needed for cpp of .hs code */ +/* Defined if a debugging version is to be built */ +#undef DEBUG -/* path to ghc */ -#define GHC "@GHC@" +/* Path to ghc libraries */ +#undef GHC_LIB_PATH -/* path to GHC libraries */ -#define GHC_LIB_PATH "@GHC_LIB_PATH@" +/* Define to 1 if you have the `arc4random' function. */ +#undef HAVE_ARC4RANDOM -#define TOP "@TOP@" +/* Whether symbols are prefixed with a leading underscore */ +#undef LEADING_UNDERSCORE -#define LEADING_UNDERSCORE @LEADING_UNDERSCORE@ +/* Defined if compiling on the mac */ +#undef MACOSX -#define CABAL @CABAL@ +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Path to top of build tree */ +#undef TOP + +/* Which ghc to use */ +#undef WITH_GHC + +/* Defined if compiling with mingw */ +#undef __MINGW32__ diff --git a/config.mk.in b/config.mk.in index 4002615..9034791 100644 --- a/config.mk.in +++ b/config.mk.in @@ -1,58 +1,20 @@ -# -# Copyright (c) 2004 Don Stewart - http://www.cse.unsw.edu.au/~dons -# LGPL version 2.1 or later (see http://www.gnu.org/copyleft/lesser.html) -# - -# -# config.mk.in : -# variables that need to be visible in Makefiles -# - -# all is the default rule for everyone default: all +VERSION = 0.9.10 PACKAGE = plugins -UPACKAGE = Plugins TOP = @TOP@ PREFIX = @PREFIX@ -LIBDIR = $(PREFIX)/lib/hs-$(PACKAGE) +LIBDIR = $(PREFIX)/lib/$(PACKAGE)-$(VERSION) BINDIR = $(PREFIX)/bin MANDIR = $(PREFIX)/man -WHOLE_ARCHIVE_FLAG = @WHOLE_ARCHIVE_FLAG@ - -# Are we using the new Cabal packages? -CABAL = @CABAL@ - - GHC = @GHC@ -GHC_LIB_PATH = @GHC_LIB_PATH@ -GHC_VERSION = @GHC_VERSION@ GLASGOW_HASKELL = @GLASGOW_HASKELL@ -GHC_EXTRA_OPTS = @SYMS@ @DEBUG_OPTS@ -GHC_LD_OPTS = - -GHC_PKG = @GHCPKG@ - -LD = @LD@ -LD_X = @LD@ -x - -HAPPY = @HAPPY@ -HAPPY_OPTS = -a -g -c -ALEX = @ALEX@ -ALEX_OPTS = --ghc -HADDOCK = @HADDOCK@ - -AR = @AR@ -RANLIB = @RANLIB@ - -RM = @RM@ - -INSTALL = @INSTALL@ # A few aliases +INSTALL = @INSTALL@ INSTALL_PROGRAM = ${INSTALL} -s -m 755 INSTALL_DATA = ${INSTALL} -m 644 INSTALL_DATA_DIR= ${INSTALL} -d -m 755 diff --git a/configure b/configure index 6f1c4fa..5febe25 100644 --- a/configure +++ b/configure @@ -271,8 +271,8 @@ PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= -ac_unique_file="src/plugins/System/Plugins.hs" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os PREFIX WHOLE_ARCHIVE_FLAG LEADING_UNDERSCORE SYMS TOP GHC GHC_LIB_PATH GHC_VERSION GLASGOW_HASKELL CABAL DEBUG_OPTS GHCPKG HADDOCK HAPPY ALEX LD AR RANLIB RM TEX TEX2PAGE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LIBOBJS LTLIBOBJS' +ac_unique_file="plugins/System/Plugins.hs" +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os PREFIX TOP GHC GLASGOW_HASKELL TEX TEX2PAGE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -802,8 +802,6 @@ if test -n "$ac_init_help"; then Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-cabal Enable use of Cabal packages in pluggable-1-branch - of GHC --enable-debug Enable a debug version of hs-plugins to be built Optional Packages: @@ -1258,6 +1256,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu +# Prepare to generate the config.h.in file + ac_config_headers="$ac_config_headers config.h" + + # untested on earlier than 2.52, but it won't work anyway @@ -1338,45 +1340,56 @@ fi case $Platform in powerpc-apple-darwin*) MACOSX=yes + +cat >>confdefs.h <<_ACEOF +#define MACOSX 1 +_ACEOF + + LEADING_UNDERSCORE=1 ;; *) MACOSX=no + LEADING_UNDERSCORE=0 ;; esac -if test "$MACOSX" = "yes" -then - WHOLE_ARCHIVE_FLAG=-all_load - LEADING_UNDERSCORE=1 - SYMS="$SYMS -DMACOSX" -else - WHOLE_ARCHIVE_FLAG=--whole-archive - LEADING_UNDERSCORE=0 -fi - - - if test "$build_os" = "mingw32" then + +cat >>confdefs.h <<\_ACEOF +#define __MINGW32__ 1 +_ACEOF + LEADING_UNDERSCORE=1 - SYMS="$SYMS -D__MINGW32__" fi - - if test "$build_os" = "cygwin" then + +cat >>confdefs.h <<\_ACEOF +#define CYGWIN 1 +_ACEOF + LEADING_UNDERSCORE=1 - SYMS="$SYMS -DCYGWIN" fi +cat >>confdefs.h <<_ACEOF +#define LEADING_UNDERSCORE $LEADING_UNDERSCORE +_ACEOF + # Find pwd, in a cygwin friendly way. # Suggested by: http://www.haskell.org/ghc/docs/latest/html/users_guide/ch11s04.html TOP=`echo "Directory.getCurrentDirectory >>= putStrLn.init.tail.show " | ghc --interactive -ignore-dot-ghci -v0` +cat >>confdefs.h <<_ACEOF +#define TOP "$TOP" +_ACEOF + + + # necessary tools # allow user supplied haskell compiler @@ -1436,25 +1449,10 @@ echo "$as_me: error: You need GHC to build this project" >&2;} fi; +cat >>confdefs.h <<_ACEOF +#define WITH_GHC $GHC +_ACEOF -# find path to GHC libs, for runtime_loader -if test -n "$GHC" ; then - echo "$as_me:$LINENO: checking for ghc library directory" >&5 -echo $ECHO_N "checking for ghc library directory... $ECHO_C" >&6 - GHC_LIB_PATH=`$GHC --print-libdir` - echo "$as_me:$LINENO: result: $GHC_LIB_PATH" >&5 -echo "${ECHO_T}$GHC_LIB_PATH" >&6 -fi - - -# check ghc version here -if test -n "$GHC" ; then - echo "$as_me:$LINENO: checking for ghc version" >&5 -echo $ECHO_N "checking for ghc version... $ECHO_C" >&6 - GHC_VERSION=`$GHC --numeric-version` - echo "$as_me:$LINENO: result: $GHC_VERSION" >&5 -echo "${ECHO_T}$GHC_VERSION" >&6 -fi # Work out value of __GLASGOW_HASKELL__ @@ -1469,384 +1467,35 @@ echo "${ECHO_T}$GLASGOW_HASKELL" >&6 fi -MAJOR=`echo "$GHC_VERSION" | sed 's/^\([^\.]*\)\.\([^\.]*\).*/\1/'` -MINOR=`echo "$GHC_VERSION" | sed 's/^\([^\.]*\)\.\([^\.]*\).*/\2/'` - -if test "$MAJOR" -lt "6"; then - { { echo "$as_me:$LINENO: error: Found major $MAJOR. You need a ghc version >= 6.2" >&5 -echo "$as_me: error: Found major $MAJOR. You need a ghc version >= 6.2" >&2;} - { (exit 1); exit 1; }; } ; -fi -if test "$MINOR" -lt "2"; then - { { echo "$as_me:$LINENO: error: You need a ghc version >= 6.2" >&5 -echo "$as_me: error: You need a ghc version >= 6.2" >&2;} - { (exit 1); exit 1; }; } ; -fi - -#Allow plugins to be built with Cabal libraries -# Check whether --enable-cabal or --disable-cabal was given. -if test "${enable_cabal+set}" = set; then - enableval="$enable_cabal" - CABAL=1 -else - CABAL=0 -fi; - -# used by the Makefile`s to alter dependencies. -if test "$MAJOR" -ge "6" -a "$MINOR" -ge "4"; then - CABAL=1 +# find path to GHC libs, for runtime_loader +if test -n "$GHC" ; then + echo "$as_me:$LINENO: checking for ghc library directory" >&5 +echo $ECHO_N "checking for ghc library directory... $ECHO_C" >&6 + GHC_LIB_PATH=`$GHC --print-libdir` + echo "$as_me:$LINENO: result: $GHC_LIB_PATH" >&5 +echo "${ECHO_T}$GHC_LIB_PATH" >&6 fi +cat >>confdefs.h <<_ACEOF +#define GHC_LIB_PATH "$GHC_LIB_PATH" +_ACEOF # Allow a debugging version of hs-plugins to be built # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" - DEBUG_OPTS=-DDEBUG + +cat >>confdefs.h <<_ACEOF +#define DEBUG 1 +_ACEOF + else - DEBUG_OPTS= + : fi; -# Search for ghc-pkg -echo "$as_me:$LINENO: checking for ghc-pkg" >&5 -echo $ECHO_N "checking for ghc-pkg... $ECHO_C" >&6 -ghc_pkg_guess=`echo $GHC | sed 's,ghc\([^/\\]*\)$,ghc-pkg\1,'` -if "$ghc_pkg_guess" -l > /dev/null 2>&1; then - matching_ghc_pkg=$ghc_pkg_guess -else - matching_ghc_pkg=no -fi -if test x"$matching_ghc_pkg" = xno; then - # Extract the first word of "ghc-pkg", so it can be a program name with args. -set dummy ghc-pkg; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_GHCPKG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$GHCPKG"; then - ac_cv_prog_GHCPKG="$GHCPKG" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_GHCPKG="" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -GHCPKG=$ac_cv_prog_GHCPKG -if test -n "$GHCPKG"; then - echo "$as_me:$LINENO: result: $GHCPKG" >&5 -echo "${ECHO_T}$GHCPKG" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - if test -z "$GHCPKG" ; then - { { echo "$as_me:$LINENO: error: ghc-pkg not found." >&5 -echo "$as_me: error: ghc-pkg not found." >&2;} - { (exit 1); exit 1; }; } - fi -else - GHCPKG=$matching_ghc_pkg -fi -echo "$as_me:$LINENO: result: $GHCPKG" >&5 -echo "${ECHO_T}$GHCPKG" >&6 - - -# Extract the first word of "haddock", so it can be a program name with args. -set dummy haddock; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_HADDOCK+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$HADDOCK"; then - ac_cv_prog_HADDOCK="$HADDOCK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_HADDOCK="haddock" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -HADDOCK=$ac_cv_prog_HADDOCK -if test -n "$HADDOCK"; then - echo "$as_me:$LINENO: result: $HADDOCK" >&5 -echo "${ECHO_T}$HADDOCK" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -if test -z "$HADDOCK" ; then - { echo "$as_me:$LINENO: WARNING: You need Haddock if you want developer documentation" >&5 -echo "$as_me: WARNING: You need Haddock if you want developer documentation" >&2;} -fi - -# Extract the first word of "happy", so it can be a program name with args. -set dummy happy; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_HAPPY+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$HAPPY"; then - ac_cv_prog_HAPPY="$HAPPY" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_HAPPY="happy" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -HAPPY=$ac_cv_prog_HAPPY -if test -n "$HAPPY"; then - echo "$as_me:$LINENO: result: $HAPPY" >&5 -echo "${ECHO_T}$HAPPY" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -if test -z "$HAPPY" ; then - { echo "$as_me:$LINENO: WARNING: If you change or remove the parser you'll need Happy" >&5 -echo "$as_me: WARNING: If you change or remove the parser you'll need Happy" >&2;} -fi - -# Extract the first word of "alex", so it can be a program name with args. -set dummy alex; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ALEX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ALEX"; then - ac_cv_prog_ALEX="$ALEX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ALEX="alex" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ALEX=$ac_cv_prog_ALEX -if test -n "$ALEX"; then - echo "$as_me:$LINENO: result: $ALEX" >&5 -echo "${ECHO_T}$ALEX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -if test -z "$ALEX" ; then - { echo "$as_me:$LINENO: WARNING: If you change or remove the lexer files you'll need alex" >&5 -echo "$as_me: WARNING: If you change or remove the lexer files you'll need alex" >&2;} -fi - -# Extract the first word of "ld", so it can be a program name with args. -set dummy ld; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_LD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$LD"; then - ac_cv_prog_LD="$LD" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_LD="ld" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -LD=$ac_cv_prog_LD -if test -n "$LD"; then - echo "$as_me:$LINENO: result: $LD" >&5 -echo "${ECHO_T}$LD" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -if test -z "$LD" ; then - { echo "$as_me:$LINENO: WARNING: You need ld -export-dynamic" >&5 -echo "$as_me: WARNING: You need ld -export-dynamic" >&2;} -fi - -# Extract the first word of "ar", so it can be a program name with args. -set dummy ar; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AR="ar" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - echo "$as_me:$LINENO: result: $AR" >&5 -echo "${ECHO_T}$AR" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -if test -z "$AR" ; then - { echo "$as_me:$LINENO: WARNING: You need ar to build the library" >&5 -echo "$as_me: WARNING: You need ar to build the library" >&2;} -fi - -# Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - echo "$as_me:$LINENO: result: $RANLIB" >&5 -echo "${ECHO_T}$RANLIB" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -if test -z "$RANLIB" ; then - { echo "$as_me:$LINENO: WARNING: You need randlib to build the library" >&5 -echo "$as_me: WARNING: You need randlib to build the library" >&2;} -fi - -# Extract the first word of "rm", so it can be a program name with args. -set dummy rm; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_RM+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$RM"; then - ac_cv_prog_RM="$RM" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_RM="rm" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -RM=$ac_cv_prog_RM -if test -n "$RM"; then - echo "$as_me:$LINENO: result: $RM" >&5 -echo "${ECHO_T}$RM" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -if test -z "$RM" ; then - { echo "$as_me:$LINENO: WARNING: You need rm!" >&5 -echo "$as_me: WARNING: You need rm!" >&2;} -fi - # Extract the first word of "tex", so it can be a program name with args. set dummy tex; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 @@ -2859,9 +2508,13 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:$LINENO: checking for arc4random" >&5 -echo $ECHO_N "checking for arc4random... $ECHO_C" >&6 -if test "${ac_cv_func_arc4random+set}" = set; then + +for ac_func in arc4random +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -2870,12 +2523,12 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define arc4random to an innocuous variant, in case declares arc4random. +/* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ -#define arc4random innocuous_arc4random +#define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char arc4random (); below. + which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ @@ -2885,7 +2538,7 @@ cat >>conftest.$ac_ext <<_ACEOF # include #endif -#undef arc4random +#undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -2894,14 +2547,14 @@ extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char arc4random (); +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ -#if defined (__stub_arc4random) || defined (__stub___arc4random) +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -char (*f) () = arc4random; +char (*f) () = $ac_func; #endif #ifdef __cplusplus } @@ -2910,7 +2563,7 @@ char (*f) () = arc4random; int main () { -return f != arc4random; +return f != $ac_func; ; return 0; } @@ -2937,23 +2590,25 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_func_arc4random=yes + eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_func_arc4random=no +eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_func_arc4random" >&5 -echo "${ECHO_T}$ac_cv_func_arc4random" >&6 -if test $ac_cv_func_arc4random = yes; then - SYMS="$SYMS -DHAVE_ARC4RANDOM" +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + fi - - +done # Find a good install program. We prefer a C program (faster), @@ -3037,8 +2692,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # System.Process uses cmd or command.com shell on Windows, doen't use Cygwin or MSYS shell - ac_config_files="$ac_config_files config.mk config.h examples/makewith/io/TestIO.conf examples/makewith/unsafeio/Unsafe.conf" - + ac_config_files="$ac_config_files config.mk examples/makewith/io/TestIO.conf examples/makewith/unsafeio/Unsafe.conf" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -3114,38 +2768,7 @@ s/^[^=]*=[ ]*$//; }' fi -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then we branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -cat >confdef2opt.sed <<\_ACEOF -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g -t quote -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g -t quote -d -: quote -s,[ `~#$^&*(){}\\|;'"<>?],\\&,g -s,\[,\\&,g -s,\],\\&,g -s,\$,$$,g -p -_ACEOF -# We use echo to avoid assuming a particular line-breaking character. -# The extra dot is to prevent the shell from consuming trailing -# line-breaks from the sub-command output. A line-break within -# single-quotes doesn't work because, if this script is created in a -# platform that uses two characters for line-breaks (e.g., DOS), tr -# would break. -ac_LF_and_DOT=`echo; echo .` -DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` -rm -f confdef2opt.sed - +DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= @@ -3479,10 +3102,15 @@ Usage: $0 [OPTIONS] [FILE]... --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE Configuration files: $config_files +Configuration headers: +$config_headers + Report bugs to ." _ACEOF @@ -3592,9 +3220,9 @@ do case "$ac_config_target" in # Handling of arguments. "config.mk" ) CONFIG_FILES="$CONFIG_FILES config.mk" ;; - "config.h" ) CONFIG_FILES="$CONFIG_FILES config.h" ;; "examples/makewith/io/TestIO.conf" ) CONFIG_FILES="$CONFIG_FILES examples/makewith/io/TestIO.conf" ;; "examples/makewith/unsafeio/Unsafe.conf" ) CONFIG_FILES="$CONFIG_FILES examples/makewith/unsafeio/Unsafe.conf" ;; + "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; @@ -3607,6 +3235,7 @@ done # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree @@ -3683,24 +3312,9 @@ s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t s,@build_os@,$build_os,;t t s,@PREFIX@,$PREFIX,;t t -s,@WHOLE_ARCHIVE_FLAG@,$WHOLE_ARCHIVE_FLAG,;t t -s,@LEADING_UNDERSCORE@,$LEADING_UNDERSCORE,;t t -s,@SYMS@,$SYMS,;t t s,@TOP@,$TOP,;t t s,@GHC@,$GHC,;t t -s,@GHC_LIB_PATH@,$GHC_LIB_PATH,;t t -s,@GHC_VERSION@,$GHC_VERSION,;t t s,@GLASGOW_HASKELL@,$GLASGOW_HASKELL,;t t -s,@CABAL@,$CABAL,;t t -s,@DEBUG_OPTS@,$DEBUG_OPTS,;t t -s,@GHCPKG@,$GHCPKG,;t t -s,@HADDOCK@,$HADDOCK,;t t -s,@HAPPY@,$HAPPY,;t t -s,@ALEX@,$ALEX,;t t -s,@LD@,$LD,;t t -s,@AR@,$AR,;t t -s,@RANLIB@,$RANLIB,;t t -s,@RM@,$RM,;t t s,@TEX@,$TEX,;t t s,@TEX2PAGE@,$TEX2PAGE,;t t s,@CC@,$CC,;t t @@ -3953,6 +3567,229 @@ s,@INSTALL@,$ac_INSTALL,;t t done _ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + # Do quote $f, to prevent DOS paths from being IFS'd. + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +_ACEOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\_ACEOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +_ACEOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >>conftest.undefs <<\_ACEOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +_ACEOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # grep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS + +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\_ACEOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if diff $ac_file $tmp/config.h >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +done +_ACEOF cat >>$CONFIG_STATUS <<\_ACEOF diff --git a/configure.ac b/configure.ac index 8c75db3..3a027b0 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,17 @@ # -# Copyright (c) 2004 Don Stewart - http://www.cse.unsw.edu.au/~dons +# Copyright (c) 2004-5 Don Stewart - http://www.cse.unsw.edu.au/~dons # LGPL version 2.1 or later (see http://www.gnu.org/copyleft/lesser.html) # +# SUBSTs go into config.mk.in (TOP,PREFIX,GHC,INSTAlL) +# AC_DEFINES go into config.h +# only AC_DEFINES are visible in Haskell src + # sanity test -AC_INIT(src/plugins/System/Plugins.hs) +AC_INIT(plugins/System/Plugins.hs) + +# Prepare to generate the config.h.in file +AC_CONFIG_HEADERS([config.h]) # untested on earlier than 2.52, but it won't work anyway AC_PREREQ(2.53) @@ -30,43 +37,35 @@ AC_SUBST(PREFIX) case $Platform in powerpc-apple-darwin*) MACOSX=yes + AC_DEFINE_UNQUOTED(MACOSX, [1], [Defined if compiling on the mac]) + LEADING_UNDERSCORE=1 ;; *) MACOSX=no + LEADING_UNDERSCORE=0 ;; esac -if test "$MACOSX" = "yes" -then - WHOLE_ARCHIVE_FLAG=-all_load - LEADING_UNDERSCORE=1 - SYMS="$SYMS -DMACOSX" -else - WHOLE_ARCHIVE_FLAG=--whole-archive - LEADING_UNDERSCORE=0 -fi - -AC_SUBST(WHOLE_ARCHIVE_FLAG) -AC_SUBST(LEADING_UNDERSCORE) if test "$build_os" = "mingw32" then + AC_DEFINE(__MINGW32__,[1],[Defined if compiling with mingw]) LEADING_UNDERSCORE=1 - SYMS="$SYMS -D__MINGW32__" fi -AC_SUBST(LEADING_UNDERSCORE) -AC_SUBST(SYMS) if test "$build_os" = "cygwin" then + AC_DEFINE(CYGWIN,[1],[Defined if compiling with mingw]) LEADING_UNDERSCORE=1 - SYMS="$SYMS -DCYGWIN" fi -AC_SUBST(LEADING_UNDERSCORE) -AC_SUBST(SYMS) + +AC_DEFINE_UNQUOTED(LEADING_UNDERSCORE, $LEADING_UNDERSCORE, + [Whether symbols are prefixed with a leading underscore]) # Find pwd, in a cygwin friendly way. # Suggested by: http://www.haskell.org/ghc/docs/latest/html/users_guide/ch11s04.html TOP=`echo "Directory.getCurrentDirectory >>= putStrLn.init.tail.show " | ghc --interactive -ignore-dot-ghci -v0` + +AC_DEFINE_UNQUOTED(TOP, "$TOP", [Path to top of build tree]) AC_SUBST(TOP) # necessary tools @@ -85,24 +84,9 @@ AC_ARG_WITH(ghc, fi ] ) +AC_DEFINE_UNQUOTED(WITH_GHC, $GHC, [Which ghc to use]) AC_SUBST(GHC) -# find path to GHC libs, for runtime_loader -if test -n "$GHC" ; then - AC_MSG_CHECKING([for ghc library directory]) - GHC_LIB_PATH=`$GHC --print-libdir` - AC_MSG_RESULT([$GHC_LIB_PATH]) -fi -AC_SUBST(GHC_LIB_PATH) - -# check ghc version here -if test -n "$GHC" ; then - AC_MSG_CHECKING([for ghc version]) - GHC_VERSION=`$GHC --numeric-version` - AC_MSG_RESULT([$GHC_VERSION]) -fi -AC_SUBST(GHC_VERSION) - # Work out value of __GLASGOW_HASKELL__ if test -n "$GHC" ; then AC_MSG_CHECKING([for value of __GLASGOW_HASKELL__]) @@ -113,94 +97,21 @@ if test -n "$GHC" ; then fi AC_SUBST(GLASGOW_HASKELL) -dnl ** quote char breaks sed -changequote(, )dnl -MAJOR=`echo "$GHC_VERSION" | sed 's/^\([^\.]*\)\.\([^\.]*\).*/\1/'` -MINOR=`echo "$GHC_VERSION" | sed 's/^\([^\.]*\)\.\([^\.]*\).*/\2/'` -changequote([, ])dnl - -if test "$MAJOR" -lt "6"; then - AC_MSG_ERROR(Found major $MAJOR. You need a ghc version >= 6.2) ; +# find path to GHC libs, for runtime_loader +if test -n "$GHC" ; then + AC_MSG_CHECKING([for ghc library directory]) + GHC_LIB_PATH=`$GHC --print-libdir` + AC_MSG_RESULT([$GHC_LIB_PATH]) fi -if test "$MINOR" -lt "2"; then - AC_MSG_ERROR(You need a ghc version >= 6.2) ; -fi - -#Allow plugins to be built with Cabal libraries -AC_ARG_ENABLE(cabal, - [ --enable-cabal Enable use of Cabal packages in pluggable-1-branch - of GHC], - [ CABAL=1 ], - [ CABAL=0 ]) - -# used by the Makefile`s to alter dependencies. -if test "$MAJOR" -ge "6" -a "$MINOR" -ge "4"; then - CABAL=1 -fi - -AC_SUBST(CABAL) +AC_DEFINE_UNQUOTED(GHC_LIB_PATH, "$GHC_LIB_PATH", [Path to ghc libraries]) # Allow a debugging version of hs-plugins to be built AC_ARG_ENABLE(debug, [ --enable-debug Enable a debug version of hs-plugins to be built], - [ DEBUG_OPTS=-DDEBUG ], - [ DEBUG_OPTS= ]) + [ AC_DEFINE_UNQUOTED(DEBUG, [1], [Defined if a debugging version is to be built]) ], + [ : ]) -AC_SUBST(DEBUG_OPTS) -# Search for ghc-pkg -AC_MSG_CHECKING([for ghc-pkg]) -ghc_pkg_guess=`echo $GHC | sed 's,ghc\(@<:@^/\\@:>@*\)$,ghc-pkg\1,'` -if "$ghc_pkg_guess" -l > /dev/null 2>&1; then - matching_ghc_pkg=$ghc_pkg_guess -else - matching_ghc_pkg=no -fi -if test x"$matching_ghc_pkg" = xno; then - AC_CHECK_PROG([GHCPKG], [ghc-pkg]) - if test -z "$GHCPKG" ; then - AC_MSG_ERROR([ghc-pkg not found.]) - fi -else - GHCPKG=$matching_ghc_pkg -fi -AC_MSG_RESULT([$GHCPKG]) -AC_SUBST(GHCPKG) - -AC_CHECK_PROG(HADDOCK,haddock,haddock) -if test -z "$HADDOCK" ; then - AC_MSG_WARN(You need Haddock if you want developer documentation) -fi - -AC_CHECK_PROG(HAPPY,happy,happy) -if test -z "$HAPPY" ; then - AC_MSG_WARN(If you change or remove the parser you'll need Happy) -fi - -AC_CHECK_PROG(ALEX,alex,alex) -if test -z "$ALEX" ; then - AC_MSG_WARN(If you change or remove the lexer files you'll need alex) -fi - -AC_CHECK_PROG(LD,ld,ld) -if test -z "$LD" ; then - AC_MSG_WARN(You need ld -export-dynamic) -fi - -AC_CHECK_PROG(AR,ar,ar) -if test -z "$AR" ; then - AC_MSG_WARN(You need ar to build the library) -fi - -AC_CHECK_PROG(RANLIB,ranlib,ranlib) -if test -z "$RANLIB" ; then - AC_MSG_WARN(You need randlib to build the library) -fi - -AC_CHECK_PROG(RM,rm,rm) -if test -z "$RM" ; then - AC_MSG_WARN(You need rm!) -fi AC_CHECK_PROG(TEX,tex,tex) if test -z "$TEX" ; then @@ -212,14 +123,11 @@ if test -z "$TEX2PAGE" ; then documentation: http://www.ccs.neu.edu/home/dorai/tex2page/tex2page-doc.html) fi -AC_CHECK_FUNC(arc4random, [SYMS="$SYMS -DHAVE_ARC4RANDOM"]) - -AC_SUBST(SYMS) +AC_CHECK_FUNCS(arc4random) AC_PROG_INSTALL # System.Process uses cmd or command.com shell on Windows, doen't use Cygwin or MSYS shell -AC_CONFIG_FILES(config.mk config.h examples/makewith/io/TestIO.conf examples/makewith/unsafeio/Unsafe.conf) - +AC_CONFIG_FILES([config.mk examples/makewith/io/TestIO.conf examples/makewith/unsafeio/Unsafe.conf]) AC_OUTPUT diff --git a/examples/build.mk b/examples/build.mk index d503cd0..62a0838 100644 --- a/examples/build.mk +++ b/examples/build.mk @@ -13,7 +13,6 @@ REALBIN= ./a.out API_OBJ= api/API.o INCLUDES= -i$(TOP)/examples/$(TEST)/api -PKGFLAGS= -package-conf $(TOP)/plugins.conf.inplace -package plugins GHCFLAGS= -Onot -cpp -fglasgow-exts .SUFFIXES : .o .hs .hi .lhs .hc .s diff --git a/examples/conf/simple/prog/Main.hs b/examples/conf/simple/prog/Main.hs index 8d0dae6..472abbf 100644 --- a/examples/conf/simple/prog/Main.hs +++ b/examples/conf/simple/prog/Main.hs @@ -8,6 +8,9 @@ apipath = "../api" main = do status <- makeWith conf stub ["-i"++apipath] + print status + return () +{- o <- case status of MakeFailure e -> mapM_ putStrLn e >> error "failed" MakeSuccess _ o -> return o @@ -20,3 +23,4 @@ main = do putStrLn user_editor makeCleaner o +-} diff --git a/examples/dynload/io/prog/Main.hs b/examples/dynload/io/prog/Main.hs index 93f7915..4fe15c5 100644 --- a/examples/dynload/io/prog/Main.hs +++ b/examples/dynload/io/prog/Main.hs @@ -4,7 +4,7 @@ import API main = do m_v <- dynload "../TestIO.o" ["../api"] - ["../../../../plugins.conf.inplace"] "resource_dyn" + [] "resource_dyn" case m_v of LoadFailure _ -> error "couldn't compile" LoadSuccess _ v -> do diff --git a/examples/dynload/poly/prog/Main.hs b/examples/dynload/poly/prog/Main.hs index 5d3d614..2bec249 100644 --- a/examples/dynload/poly/prog/Main.hs +++ b/examples/dynload/poly/prog/Main.hs @@ -7,7 +7,7 @@ import API main = do m_v <- dynload "../Plugin.o" ["../api"] - ["../../../../plugins.conf.inplace"] + [] "resource_dyn" case m_v of LoadFailure _ -> error "didn't compile" diff --git a/examples/dynload/should_fail/prog/Main.hs b/examples/dynload/should_fail/prog/Main.hs index c35d7f9..3b0ed0f 100644 --- a/examples/dynload/should_fail/prog/Main.hs +++ b/examples/dynload/should_fail/prog/Main.hs @@ -5,7 +5,7 @@ import API main = do m_v <- dynload "../Plugin.o" ["../api"] - ["../../../../plugins.conf.inplace"] + [] "resource_dyn" case m_v of diff --git a/examples/dynload/should_fail_1/prog/Main.hs b/examples/dynload/should_fail_1/prog/Main.hs index 0bcd25b..abdd2f7 100644 --- a/examples/dynload/should_fail_1/prog/Main.hs +++ b/examples/dynload/should_fail_1/prog/Main.hs @@ -4,7 +4,7 @@ import API main = do m_v <- dynload "../Plugin.o" ["../api"] - ["../../../../plugins.conf.inplace"] "resource_dyn" + [] "resource_dyn" case m_v of LoadFailure _ -> putStrLn "didn't compile" LoadSuccess _ v -> putStrLn $ (function v) diff --git a/examples/dynload/simple/prog/Main.hs b/examples/dynload/simple/prog/Main.hs index 7d6d8e4..7576f17 100644 --- a/examples/dynload/simple/prog/Main.hs +++ b/examples/dynload/simple/prog/Main.hs @@ -7,7 +7,7 @@ import API main = do m_v <- dynload "../Plugin.o" ["../api"] - ["../../../../plugins.conf.inplace"] + [] "resource_dyn" case m_v of LoadFailure _ -> error "didn't compile" diff --git a/examples/eval.mk b/examples/eval.mk index 4c081e0..4553193 100644 --- a/examples/eval.mk +++ b/examples/eval.mk @@ -1,8 +1,6 @@ include $(TOP)/config.mk include $(TOP)/examples/check.mk -PKGFLAGS= -package-conf $(TOP)/plugins.conf.inplace -package plugins - BIN=a.out SRC=Main.hs diff --git a/examples/foreign.mk b/examples/foreign.mk index 848a230..aa28127 100644 --- a/examples/foreign.mk +++ b/examples/foreign.mk @@ -3,7 +3,6 @@ include $(TOP)/examples/check.mk INCLUDES= -I$(TOP) -PKGFLAGS= -package-conf $(TOP)/plugins.conf.inplace -package plugins # compile with GHC to save us setting all the necessary include and # lib flags. use ghc -v to find out what these are if you wish to go diff --git a/src/altdata/AltData/Dynamic.hs b/plugins/AltData/Dynamic.hs similarity index 100% rename from src/altdata/AltData/Dynamic.hs rename to plugins/AltData/Dynamic.hs diff --git a/src/altdata/AltData/Typeable.hs b/plugins/AltData/Typeable.hs similarity index 100% rename from src/altdata/AltData/Typeable.hs rename to plugins/AltData/Typeable.hs diff --git a/src/hi/Language/Hi/Binary.hs b/plugins/Language/Hi/Binary.hs similarity index 100% rename from src/hi/Language/Hi/Binary.hs rename to plugins/Language/Hi/Binary.hs diff --git a/src/hi/Language/Hi/FastMutInt.hs b/plugins/Language/Hi/FastMutInt.hs similarity index 100% rename from src/hi/Language/Hi/FastMutInt.hs rename to plugins/Language/Hi/FastMutInt.hs diff --git a/src/hi/Language/Hi/FastString.hs b/plugins/Language/Hi/FastString.hs similarity index 100% rename from src/hi/Language/Hi/FastString.hs rename to plugins/Language/Hi/FastString.hs diff --git a/src/hi/Language/Hi/Parser.hs b/plugins/Language/Hi/Parser.hs similarity index 99% rename from src/hi/Language/Hi/Parser.hs rename to plugins/Language/Hi/Parser.hs index 89d0c83..db19b19 100644 --- a/src/hi/Language/Hi/Parser.hs +++ b/plugins/Language/Hi/Parser.hs @@ -48,8 +48,7 @@ import Language.Hi.Syntax import Language.Hi.Binary import Language.Hi.FastString - -#include "../../../../config.h" +#include "../../../config.h" -- --------------------------------------------------------------------------- -- how to get there from here diff --git a/src/hi/Language/Hi/PrimPacked.hs b/plugins/Language/Hi/PrimPacked.hs similarity index 100% rename from src/hi/Language/Hi/PrimPacked.hs rename to plugins/Language/Hi/PrimPacked.hs diff --git a/src/hi/Language/Hi/Syntax.hs b/plugins/Language/Hi/Syntax.hs similarity index 100% rename from src/hi/Language/Hi/Syntax.hs rename to plugins/Language/Hi/Syntax.hs diff --git a/src/hi/Language/Hi/hschooks.c b/plugins/Language/Hi/hschooks.c similarity index 100% rename from src/hi/Language/Hi/hschooks.c rename to plugins/Language/Hi/hschooks.c diff --git a/src/hi/Language/Hi/hschooks.h b/plugins/Language/Hi/hschooks.h similarity index 100% rename from src/hi/Language/Hi/hschooks.h rename to plugins/Language/Hi/hschooks.h diff --git a/src/plugins/System/Eval.hs b/plugins/System/Eval.hs similarity index 100% rename from src/plugins/System/Eval.hs rename to plugins/System/Eval.hs diff --git a/src/plugins/System/Eval/Haskell.hs b/plugins/System/Eval/Haskell.hs similarity index 100% rename from src/plugins/System/Eval/Haskell.hs rename to plugins/System/Eval/Haskell.hs diff --git a/src/plugins/System/Eval/Utils.hs b/plugins/System/Eval/Utils.hs similarity index 68% rename from src/plugins/System/Eval/Utils.hs rename to plugins/System/Eval/Utils.hs index 5a88263..a046b7f 100644 --- a/src/plugins/System/Eval/Utils.hs +++ b/plugins/System/Eval/Utils.hs @@ -28,7 +28,6 @@ module System.Eval.Utils ( symbol, escape, getPaths, - find_altdata_pkgconf, mkUniqueWith, cleanup, @@ -40,7 +39,6 @@ module System.Eval.Utils ( import System.Plugins.Load ( Symbol ) import System.Plugins.Utils -import System.Plugins.Consts ( top {- :{ -} ) import System.IO import System.Directory @@ -74,30 +72,8 @@ escape s = concatMap (\c -> showLitChar c $ "") s -- getPaths :: IO ([String],[String]) getPaths = do - m_pkg <- find_altdata_pkgconf - let load_path = if isJust m_pkg then fromJust m_pkg else [] - let make_line = - let compulsory = ["-Onot","-fglasgow-exts","-package","altdata"] - in if not $ null load_path - then "-package-conf":load_path:compulsory - else compulsory - let load_path' = if null load_path then [] else [load_path] - return (make_line,load_path') - --- --------------------------------------------------------------------- --- if we are in-tree eval() needs to use the inplace package.conf to --- find altdata, otherwise we need it to be in the ghc package system. --- --- fixing Typeable/Dynamic in ghc obsoletes this code. as would adding --- an extra param to eval, which I don't want to do. --- -find_altdata_pkgconf :: IO (Maybe String) -find_altdata_pkgconf = do - let f = top "plugins.conf.inplace" - b <- doesFileExist f - return $ if b - then Just f - else Nothing + let make_line = ["-Onot","-fglasgow-exts","-package","plugins"] + return (make_line,[]) -- --------------------------------------------------------------------- -- create the tmp file, and write source into it, using wrapper to diff --git a/src/plugins/System/MkTemp.hs b/plugins/System/MkTemp.hs similarity index 100% rename from src/plugins/System/MkTemp.hs rename to plugins/System/MkTemp.hs diff --git a/src/plugins/System/Plugins.hs b/plugins/System/Plugins.hs similarity index 100% rename from src/plugins/System/Plugins.hs rename to plugins/System/Plugins.hs diff --git a/src/plugins/System/Plugins/Consts.hs b/plugins/System/Plugins/Consts.hs similarity index 97% rename from src/plugins/System/Plugins/Consts.hs rename to plugins/System/Plugins/Consts.hs index fbad2a1..3ab254b 100644 --- a/src/plugins/System/Plugins/Consts.hs +++ b/plugins/System/Plugins/Consts.hs @@ -20,7 +20,7 @@ module System.Plugins.Consts where -#include "../../../../config.h" +#include "../../../config.h" #if __GLASGOW_HASKELL__ >= 604 @@ -33,7 +33,7 @@ import System.IO.Unsafe ( unsafePerformIO ) top = TOP -- | what is ghc called? -ghc = GHC +ghc = WITH_GHC -- | path to standard ghc libraries ghcLibraryPath = GHC_LIB_PATH diff --git a/src/plugins/System/Plugins/Env.hs b/plugins/System/Plugins/Env.hs similarity index 99% rename from src/plugins/System/Plugins/Env.hs rename to plugins/System/Plugins/Env.hs index 6f99f9c..cef8402 100644 --- a/src/plugins/System/Plugins/Env.hs +++ b/plugins/System/Plugins/Env.hs @@ -46,7 +46,7 @@ module System.Plugins.Env ( ) where -#include "../../../../config.h" +#include "../../../config.h" import System.Plugins.LoadTypes (Module) import System.Plugins.PackageAPI {- everything -} diff --git a/src/plugins/System/Plugins/Load.hs b/plugins/System/Plugins/Load.hs similarity index 99% rename from src/plugins/System/Plugins/Load.hs rename to plugins/System/Plugins/Load.hs index 887e044..b58839a 100644 --- a/src/plugins/System/Plugins/Load.hs +++ b/plugins/System/Plugins/Load.hs @@ -50,6 +50,8 @@ module System.Plugins.Load ( ) where +#include "../../../config.h" + import System.Plugins.Make ( build ) import System.Plugins.Env import System.Plugins.Utils diff --git a/src/plugins/System/Plugins/LoadTypes.hs b/plugins/System/Plugins/LoadTypes.hs similarity index 100% rename from src/plugins/System/Plugins/LoadTypes.hs rename to plugins/System/Plugins/LoadTypes.hs diff --git a/src/plugins/System/Plugins/Make.hs b/plugins/System/Plugins/Make.hs similarity index 100% rename from src/plugins/System/Plugins/Make.hs rename to plugins/System/Plugins/Make.hs diff --git a/src/plugins/System/Plugins/Package.hs b/plugins/System/Plugins/Package.hs similarity index 100% rename from src/plugins/System/Plugins/Package.hs rename to plugins/System/Plugins/Package.hs diff --git a/src/plugins/System/Plugins/PackageAPI.hs b/plugins/System/Plugins/PackageAPI.hs similarity index 98% rename from src/plugins/System/Plugins/PackageAPI.hs rename to plugins/System/Plugins/PackageAPI.hs index b9a9b02..4205e3d 100644 --- a/src/plugins/System/Plugins/PackageAPI.hs +++ b/plugins/System/Plugins/PackageAPI.hs @@ -37,7 +37,7 @@ module System.Plugins.PackageAPI ( , updLibraryDirs ) where -#include "../../../../config.h" +#include "../../../config.h" #if CABAL == 1 || __GLASGOW_HASKELL__ >= 604 import Distribution.InstalledPackageInfo diff --git a/src/plugins/System/Plugins/ParsePkgConfCabal.hs b/plugins/System/Plugins/ParsePkgConfCabal.hs similarity index 100% rename from src/plugins/System/Plugins/ParsePkgConfCabal.hs rename to plugins/System/Plugins/ParsePkgConfCabal.hs diff --git a/src/plugins/System/Plugins/ParsePkgConfCabal.y b/plugins/System/Plugins/ParsePkgConfCabal.y similarity index 100% rename from src/plugins/System/Plugins/ParsePkgConfCabal.y rename to plugins/System/Plugins/ParsePkgConfCabal.y diff --git a/src/plugins/System/Plugins/ParsePkgConfLite.hs b/plugins/System/Plugins/ParsePkgConfLite.hs similarity index 91% rename from src/plugins/System/Plugins/ParsePkgConfLite.hs rename to plugins/System/Plugins/ParsePkgConfLite.hs index ad32dfe..c6cf6d5 100644 --- a/src/plugins/System/Plugins/ParsePkgConfLite.hs +++ b/plugins/System/Plugins/ParsePkgConfLite.hs @@ -1,7 +1,5 @@ -{-# OPTIONS -fglasgow-exts -cpp -w #-} --- parser produced by Happy Version 1.14 - - +{-# OPTIONS -fglasgow-exts -cpp #-} +{-# OPTIONS -w #-} module System.Plugins.ParsePkgConfLite ( parsePkgConf, parseOnePkgConf @@ -18,6 +16,8 @@ import GHC.Exts import GlaExts #endif +-- parser produced by Happy Version 1.15 + newtype HappyAbsSyn = HappyAbsSyn (() -> ()) happyIn5 :: ([ PackageConfig ]) -> (HappyAbsSyn ) happyIn5 x = unsafeCoerce# x @@ -251,15 +251,15 @@ happyReduction_15 happy_x_3 (happy_var_3 : happy_var_1 )}} -happyReduce_16 = happyMonadReduce 1# 7# happyReduction_16 -happyReduction_16 (happy_x_1 `HappyStk` - happyRest) - = happyThen (case happyOutTok happy_x_1 of { (ITconid happy_var_1) -> - case happy_var_1 of { +happyReduce_16 = happySpecReduce_1 7# happyReduction_16 +happyReduction_16 happy_x_1 + = case happyOutTok happy_x_1 of { (ITconid happy_var_1) -> + happyIn12 + ( case happy_var_1 of { "True" -> True; "False" -> False; - _ -> error ("unknown constructor in config file: " ++ happy_var_1) }} - ) (\r -> happyReturn (happyIn12 r)) + _ -> error ("unknown constructor in config file: " ++ happy_var_1) } + )} happyNewToken action sts stk [] = happyDoAction 10# (error "reading EOF!") action sts stk [] @@ -276,17 +276,34 @@ happyNewToken action sts stk (tk:tks) = ITvarid happy_dollar_dollar -> cont 7#; ITconid happy_dollar_dollar -> cont 8#; ITstring happy_dollar_dollar -> cont 9#; - _ -> happyError tks + _ -> happyError' (tk:tks) } -happyThen = \m k -> k m -happyReturn = \a -> a -happyThen1 = happyThen -happyReturn1 = \a tks -> a +happyError_ tk tks = happyError' (tk:tks) -parse tks = happyThen (happyParse 0# tks) (\x -> happyReturn (happyOut5 x)) +newtype HappyIdentity a = HappyIdentity a +happyIdentity = HappyIdentity +happyRunIdentity (HappyIdentity a) = a -parseOne tks = happyThen (happyParse 1# tks) (\x -> happyReturn (happyOut7 x)) +instance Monad HappyIdentity where + return = HappyIdentity + (HappyIdentity p) >>= q = q p + +happyThen :: () => HappyIdentity a -> (a -> HappyIdentity b) -> HappyIdentity b +happyThen = (>>=) +happyReturn :: () => a -> HappyIdentity a +happyReturn = (return) +happyThen1 m k tks = (>>=) m (\a -> k a tks) +happyReturn1 :: () => a -> b -> HappyIdentity a +happyReturn1 = \a tks -> (return) a +happyError' :: () => [Token] -> HappyIdentity a +happyError' = HappyIdentity . happyError + +parse tks = happyRunIdentity happySomeParser where + happySomeParser = happyThen (happyParse 0# tks) (\x -> happyReturn (happyOut5 x)) + +parseOne tks = happyRunIdentity happySomeParser where + happySomeParser = happyThen (happyParse 1# tks) (\x -> happyReturn (happyOut7 x)) happySeq = happyDontSeq @@ -373,9 +390,13 @@ happyParse start_state = happyNewToken start_state notHappyAtAll notHappyAtAll ----------------------------------------------------------------------------- -- Accepting the parse -happyAccept j tk st sts (HappyStk ans _) = (happyTcHack j (happyTcHack st)) - - (happyReturn1 ans) +-- If the current token is 0#, it means we've just accepted a partial +-- parse (a %partial parser). We must ignore the saved token on the top of +-- the stack in this case. +happyAccept 0# tk st sts (_ `HappyStk` ans `HappyStk` _) = + happyReturn1 ans +happyAccept j tk st sts (HappyStk ans _) = + (happyTcHack j (happyTcHack st)) (happyReturn1 ans) ----------------------------------------------------------------------------- -- Arrays only: do the next action @@ -448,7 +469,7 @@ data HappyAddr = HappyA# Addr# ----------------------------------------------------------------------------- -- HappyState data type (not arrays) -{-# LINE 166 "GenericTemplate.hs" #-} +{-# LINE 170 "GenericTemplate.hs" #-} ----------------------------------------------------------------------------- -- Shifting a token @@ -527,8 +548,7 @@ happyGoto nt j tk st = -- parse error if we are in recovery and we fail again happyFail 0# tk old_st _ stk = -- trace "failing" $ - happyError - + happyError_ tk {- We don't need state discarding for our restricted implementation of "error". In fact, it can cause some bogus parses, so I've disabled it diff --git a/src/plugins/System/Plugins/ParsePkgConfLite.y b/plugins/System/Plugins/ParsePkgConfLite.y similarity index 100% rename from src/plugins/System/Plugins/ParsePkgConfLite.y rename to plugins/System/Plugins/ParsePkgConfLite.y diff --git a/src/plugins/System/Plugins/Parser.hs b/plugins/System/Plugins/Parser.hs similarity index 100% rename from src/plugins/System/Plugins/Parser.hs rename to plugins/System/Plugins/Parser.hs diff --git a/src/plugins/System/Plugins/Utils.hs b/plugins/System/Plugins/Utils.hs similarity index 99% rename from src/plugins/System/Plugins/Utils.hs rename to plugins/System/Plugins/Utils.hs index 8f9aa54..c0aa66b 100644 --- a/src/plugins/System/Plugins/Utils.hs +++ b/plugins/System/Plugins/Utils.hs @@ -18,8 +18,6 @@ -- USA -- -#include "../../../../config.h" - module System.Plugins.Utils ( Arg, @@ -60,6 +58,8 @@ module System.Plugins.Utils ( ) where +#include "../../../config.h" + import System.Plugins.Env ( isLoaded ) import System.Plugins.Consts ( objSuf, hiSuf, tmpDir ) import qualified System.MkTemp ( mkstemps ) diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index 5cdf520..0000000 --- a/src/Makefile +++ /dev/null @@ -1,30 +0,0 @@ - -# Copyright (c) 2004 Don Stewart - http://www.cse.unsw.edu.au/~dons -# GPL version 2 or later (see http://www.gnu.org/copyleft/gpl.html) - -.PHONY: all build altdata hi plugins -.PHONY: install i_altdata i_hi i_plugins - -build: altdata hi plugins - -altdata: - @cd altdata && $(MAKE) -hi: - @cd hi && $(MAKE) -plugins: altdata hi - @cd plugins && $(MAKE) - -install: i_altdata i_hi i_plugins - @true - -i_altdata: - @cd altdata && $(MAKE) install -i_hi: - @cd hi && $(MAKE) install -i_plugins: - @cd plugins && $(MAKE) install - -all: build - -TOP=.. -include build.mk diff --git a/src/README b/src/README deleted file mode 100644 index 8de08d0..0000000 --- a/src/README +++ /dev/null @@ -1,23 +0,0 @@ -Don's Haskell Libraries ------------------------ - -* altdata -An alternative implementation of Typeable and Dynamic that -works in the presence of (completely) separate compilation - -* hi -A parser for .hi files - -* plugins -A dynamic loader for GHC-produce object files. Also provides type -checking of object interfaces via dynamic typing. - -* eval -A system for reflecting strings of Haskell source into native code at -runtime, via runtime compilation and dynamic linking. -Also implements a staged computation doo-hickey. - -* printf -An implementation of printf(3) that uses eval to generate new Haskell -functions from format strings, at runtime, and dynamic typing to -retain type safety. diff --git a/src/altdata/Makefile b/src/altdata/Makefile deleted file mode 100644 index e4d9d09..0000000 --- a/src/altdata/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -PKG = altdata -UPKG = AltData -PATHS = AltData - -ALL_SRCS=$(wildcard $(patsubst ./%, %, $(patsubst %, %/*.hs, . $(UPKG)))) - -TOP=../.. -include ../build.mk - -install: install-me - --include depend diff --git a/src/altdata/altdata.conf.in.cpp b/src/altdata/altdata.conf.in.cpp deleted file mode 100644 index 6cb7d1d..0000000 --- a/src/altdata/altdata.conf.in.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#if CABAL == 0 && GLASGOW_HASKELL < 604 -Package { - name = "altdata", - auto = False, - hs_libraries = [ "HSaltdata" ], -#ifdef INSTALLING - import_dirs = [ "${LIBDIR}/imports" ], - library_dirs = [ "${LIBDIR}" ], -#else - import_dirs = [ "${TOP}/src/altdata" ], - library_dirs = [ "${TOP}/src/altdata" ], -#endif - include_dirs = [], - c_includes = [], - source_dirs = [], - extra_libraries = [], - package_deps = [ "base" ], - extra_ghc_opts = [], - extra_cc_opts = [], - extra_ld_opts = [] -} -#else -name: altdata -version: 0.9.10 -license: LGPL -maintainer: dons@cse.unsw.edu.au -exposed: True -exposed-modules: - AltData.Dynamic, - AltData.Typeable - -hidden-modules: -#ifdef INSTALLING -import-dirs: LIBDIR/imports -library-dirs: LIBDIR -#else -import-dirs: TOP/src/altdata -library-dirs: TOP/src/altdata -#endif -hs-libraries: HSaltdata -extra-libraries: -include-dirs: -includes: -depends: base -hugs-options: -cc-options: -ld-options: -framework-dirs: -frameworks: -haddock-interfaces: -haddock-html: -#endif diff --git a/src/build.mk b/src/build.mk deleted file mode 100644 index 985b532..0000000 --- a/src/build.mk +++ /dev/null @@ -1,131 +0,0 @@ -# -# Copyright (c) 2004-5 Don Stewart - http://www.cse.unsw.edu.au/~dons -# LGPL version 2.1 or later (see http://www.gnu.org/copyleft/lesser.html) -# - -MAKEFLAGS += --no-builtin-rules -.SUFFIXES: - -include $(TOP)/config.mk - -# If $(way) is set then we define $(way_) and $(_way) from it in the -# obvious fashion. -ifeq "$(way)" "p" - way_ := $(way)_ - _way := _$(way) -endif - -# -# building the profiled way -# -ifeq "$(way)" "p" -PROF_OPTS = -prof -auto-all -Icbits -LD_OPTS += $(PROF_OPTS) -HC_OPTS += $(PROF_OPTS) -HC_OPTS += -hisuf $(way_)hi -hcsuf $(way_)hc -osuf $(way_)o -endif - -MAIN = $(UPKG).hs -LIBRARY = libHS$(PKG)$(_way).a -GHCI_LIBRARY = $(patsubst lib%.a,%.o,$(LIBRARY)) -OBJS = $(UPKG).o $(UPKG)/*.o - -HC_OPTS += -package-name $(PKG) -HC_OPTS += -O -Wall -Werror -fno-warn-missing-signatures $(GHC_EXTRA_OPTS) -HC_OPTS += -threaded - -CLEANS += $(LIBRARY) $(GHCI_LIBRARY) -CLEAN_FILES += *.conf.inplace* *.conf.*.old *.conf.in *.h *.in - -OBJS= $(addsuffix .$(way_)o,$(basename $(ALL_SRCS))) - -.PHONY: clean all alt_objs plugins.conf.inplace happy banner - -all : $(LIBRARY) $(TOP)/plugins.conf.inplace $(PKG).conf.in - -# libraries -$(LIBRARY): depend $(COBJ) $(XOBJ) $(YOBJ) $(OBJS) - @$(RM) -f $@ - @$(AR) cq $@ $(OBJS) $(COBJ) $(STUBOBJS) - @$(RANLIB) $@ - -$(GHCI_LIBRARY) : $(OBJS) - $(LD_X) -r -o $@ $(OBJS) $(COBJ) $(STUBOBJS) - -# -# Dependency generation -# -depend: $(ALL_SRCS) - @echo -n "Rebuilding dependencies ... " - @$(GHC) -cpp $(HC_OPTS) $(PKG_OPTS) $(HTOOLKIT) -M -optdep-f \ - -optdepdepend $(ALL_SRCS) || rm depend - @echo "done." - -%.$(way_)hi : %.$(way_)o - @: - -%.$(way_)o: %.hs - $(GHC) $(HC_OPTS) -c $< -o $@ -ohi $(basename $@).$(way_)hi - -# Now a rule for hs-boot files. -%.$(way_)o-boot : %.hs-boot - $(GHC) $(HC_OPTS) $(PKG_OPTS) -c $< -o $@ -ohi $(basename $@).$(way_)hi-boot - -# happy files -$(YOBJ): $(YSRC) - $(HAPPY) $(HAPPY_OPTS) -o $@ $(YSRC) - -# alex files -$(XOBJ): $(XSRC) - $(ALEX) $(ALEX_OPTS) -o $@ $(XSRC) - -$(COBJ): $(CSRC) - $(GHC) -c $(CSRC) -o $@ - -# package.confs and friends -# ghc-6.2.2 needs TOP as env var. -$(TOP)/plugins.conf.inplace: $(PKG).conf.in.cpp $(LIBRARY) $(GHCI_LIBRARY) - @cpp -DTOP=$(TOP) -DGLASGOW_HASKELL=$(GLASGOW_HASKELL) -DCABAL=$(CABAL) -undef < $(PKG).conf.in.cpp | sed -e 's/""//g' -e 's/\[ *,/[ /g' -e '/^#/d' > $(PKG).conf.inplace.in - @(cd $(TOP) ;\ - if [ ! -f $(TOP)/plugins.conf.inplace ]; then echo [] > $(TOP)/plugins.conf.inplace; fi;\ - env TOP=$(TOP) $(GHC_PKG) --force -f $@ -u < src/$(PKG)/$(PKG).conf.inplace.in) - -# installation pkg.confs -$(PKG).conf.in : $(PKG).conf.in.cpp - @cpp -DLIBDIR=$(LIBDIR) -DGLASGOW_HASKELL=$(GLASGOW_HASKELL) -DCABAL=$(CABAL) -DINSTALLING -Uunix < $(PKG).conf.in.cpp | sed -e 's/""//g' -e 's/\[ *,/[ /g' -e '/^#/d' > $@ - -# -# todo. need to re-ranlib the library -# -HS_IFACES = $(addsuffix .$(way_)hi,$(basename $(ALL_SRCS))) - -.PHONY: install install-me -install-me: - @for i in $(PATHS) ; do \ - $(INSTALL_DATA_DIR) $(LIBDIR)/imports/$$i ;\ - done - @for j in $(HS_IFACES) ; do \ - echo $(INSTALL_DATA) $(TOP)/src/$(PKG)/$$j $(LIBDIR)/imports/$$j ; \ - $(INSTALL_DATA) $(TOP)/src/$(PKG)/$$j $(LIBDIR)/imports/$$j ; \ - done - $(INSTALL_DATA) $(TOP)/src/$(PKG)/libHS$(PKG)$(_way).a $(LIBDIR) - $(RANLIB) $(LIBDIR)/libHS$(PKG).a - $(INSTALL_DATA) $(TOP)/src/$(PKG)/HS$(PKG).o $(LIBDIR) - $(INSTALL_DATA) $(TOP)/src/$(PKG)/$(PKG).conf.in $(LIBDIR) - -clean: - rm -f $(CLEAN_FILES) - find . -name '*.a' -exec rm {} \; - find . -name depend -exec rm {} \; - find . -name '*.in' -exec rm {} \; - find . -name '*~' -exec rm {} \; - find . -name 'a.out' -exec rm {} \; - find . -name '*.hi' -exec rm {} \; - find . -name '*.p_hi' -exec rm {} \; - find . -name '*.o' -exec rm {} \; - find . -name '*.p_o' -exec rm {} \; - find . -name '*.old' -exec rm {} \; - find . -name '*.core' -exec rm {} \; - find . -name '*_stub.c' -exec rm {} \; - find . -name '*_stub.h' -exec rm {} \; - diff --git a/src/hi/Makefile b/src/hi/Makefile deleted file mode 100644 index 0698b30..0000000 --- a/src/hi/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -PKG = hi -UPKG = Hi - -CSRC = Language/$(UPKG)/hschooks.c -COBJ = Language/$(UPKG)/hschooks.o - -PATHS = Language Language/$(UPKG) - -ALL_SRCS=$(wildcard $(patsubst ./%, %, $(patsubst %, %/*.hs, Language Language/$(UPKG)))) - -TOP=../.. -include ../build.mk - -HC_OPTS += -ILanguage/$(UPKG) - -install: install-me - --include depend diff --git a/src/hi/hi.conf.in.cpp b/src/hi/hi.conf.in.cpp deleted file mode 100644 index 4d8bfeb..0000000 --- a/src/hi/hi.conf.in.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#if CABAL == 0 && GLASGOW_HASKELL < 604 -Package { - name = "hi", - auto = False, - hs_libraries = [ "HShi" ], -#ifdef INSTALLING - import_dirs = [ "${LIBDIR}/imports" ], - library_dirs = [ "${LIBDIR}/" ], -#else - import_dirs = [ "${TOP}/src/hi" ], - library_dirs = [ "${TOP}/src/hi" ], -#endif - include_dirs = [], - c_includes = [], - source_dirs = [], - extra_libraries = [], - package_deps = [ "base", "haskell98" ], - extra_ghc_opts = [], - extra_cc_opts = [], - extra_ld_opts = [] -} -#else -name: hi -version: 0.9.10 -license: BSD3 -maintainer: libraries@haskell.org -exposed: True -exposed-modules: - Language.Hi.Parser - -hidden-modules: - Language.Hi.Binary, - Language.Hi.FastString, - Language.Hi.Syntax, - Language.Hi.FastMutInt, - Language.Hi.PrimPacked - -#ifdef INSTALLING -import-dirs: LIBDIR/imports -library-dirs: LIBDIR -#else -import-dirs: TOP/src/hi -library-dirs: TOP/src/hi -#endif -hs-libraries: HShi -extra-libraries: -include-dirs: -includes: -depends: base, haskell98 -hugs-options: -cc-options: -ld-options: -framework-dirs: -frameworks: -haddock-interfaces: -haddock-html: -#endif diff --git a/src/plugins/Makefile b/src/plugins/Makefile deleted file mode 100644 index 8065f14..0000000 --- a/src/plugins/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -PKG = plugins -UPKG = Plugins - -PATHS = System System/Eval System/Plugins - -TOP=../.. -include $(TOP)/config.mk - -ifeq ($(CABAL),1) -YOBJ = System/$(UPKG)/ParsePkgConfCabal.hs -YSRC = System/$(UPKG)/ParsePkgConfCabal.y -OTHER = System/$(UPKG)/ParsePkgConfLite.hs -else -YOBJ = System/$(UPKG)/ParsePkgConfLite.hs -YSRC = System/$(UPKG)/ParsePkgConfLite.y -OTHER = System/$(UPKG)/ParsePkgConfCabal.hs -endif - -STUBOBJS =System/Eval/Haskell_stub.$(way_)o - -ALL_SRCS= $(filter-out $(OTHER), \ - $(wildcard $(patsubst ./%, %, \ - $(patsubst %, %/*.hs, System System/$(UPKG) System/Eval)))) - -include ../build.mk - -HC_OPTS += -package-conf $(TOP)/plugins.conf.inplace -HC_OPTS += -package altdata -package hi -HC_OPTS += -O -funbox-strict-fields -HC_OPTS += -Wall -fno-warn-missing-signatures - -ifeq ($(GLASGOW_HASKELL),602) -HC_OPTS += -package posix -else -#HC_OPTS += -package Cabal -endif - -install: install-me - --include depend diff --git a/src/plugins/plugins.conf.in.cpp b/src/plugins/plugins.conf.in.cpp deleted file mode 100644 index 41efd4e..0000000 --- a/src/plugins/plugins.conf.in.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#if CABAL == 0 && GLASGOW_HASKELL < 604 -Package { - name = "plugins", - auto = False, -#ifdef INSTALLING - import_dirs = [ "${LIBDIR}/imports" ], - library_dirs = [ "${LIBDIR}/" ], -#else - import_dirs = [ "${TOP}/src/plugins" ], - library_dirs = [ "${TOP}/src/plugins" ], -#endif - hs_libraries = [ "HSplugins" ], - c_includes = [ "Linker.h" ], - include_dirs = [], - source_dirs = [], - extra_libraries = [], - package_deps = [ "altdata", "hi", "unix", "haskell-src-exts", "posix" ], - extra_ghc_opts = [], - extra_cc_opts = [], - extra_ld_opts = [] -} - -#else - -name: plugins -version: 0.9.10 -license: LGPL -maintainer: dons@cse.unsw.edu.au -exposed: True -exposed-modules: - System.Plugins.Load, - System.Plugins.LoadTypes, - System.Plugins.Make, - System.Plugins, - System.MkTemp, - System.Eval, - System.Eval.Haskell - -hidden-modules: - System.Plugins.Consts, - System.Plugins.Env, - System.Plugins.Package, - System.Plugins.PackageAPI, - System.Plugins.ParsePkgConfCabal, - System.Plugins.ParsePkgConfLite, - System.Plugins.Parser, - System.Plugins.Utils, - System.Eval.Utils - -#ifdef INSTALLING -import-dirs: LIBDIR/imports -library-dirs: LIBDIR -#else -import-dirs: TOP/src/plugins -library-dirs: TOP/src/plugins -#endif -hs-libraries: HSplugins -extra-libraries: -include-dirs: -includes: Linker.h -depends: altdata, hi, haskell-src-exts, Cabal -hugs-options: -cc-options: -ld-options: -framework-dirs: -frameworks: -haddock-interfaces: -haddock-html: - -#endif