The following procedure is suggested for installation of Hugs on a Unix machine. (Precompiled binaries are provided for common PC platforms, although similar installation procedures can be used for these machines if you have a suitable C compiler.) Short version (for Unix-like environments): cd Hugs98/src/unix ./configure --prefix=$HOME cd .. make install make clean $HOME/bin/hugs $HOME/share/hugs/demos/Say putStr (say " /Hugs") :quit Long version: 0) Choose a directory (or directories) for the Hugs files to go in. In the following, we'll assume: /usr/local/solaris/bin user executables /usr/local/solaris/lib/hugs architecture dependent files /usr/local/lib/hugs architecture independent files Check that these directories have appropriate permission settings. 1) Run the configure script On Unix, MacOS X, or other platform providing sh, sed and related tools: cd Hugs98/src/unix ./configure --exec-prefix=/usr/local/solaris --datadir=/usr/local/lib -- This tests the capabilities of your C compiler and OS -- and arranges to install binaries in the directories places. Read Hugs98/src/unix/INSTALL to find out about other configuration options. Hugs specific options are listed at the end of this file. On Windows: Pick one of the following configurations: msc: Microsoft Visual C++ winhugs: Microsoft Visual C++, Hugs for Windows bcc32: 32 bit Borland C djgpp2: DJGPP2 cd Hugs98\src\{msc,winhugs,bcc32,djgpp2} config.bat If you haven't used Visual C++ or Borland C from the command line before, you might have to define some environment variables (in autoexec.bat or using "Control Panel|System") before you can use the compiler - check your compiler documentation. make hugs.exe (or nmake hugs.exe with Visual C++) If you prefer to use an integrated development environment, run "make hugs.exe -n" to get a list of the files we compile and add them to your project. On MacOS (pre MacOS X): Open CodeWarrior Pro 5 and choose [File->Import Project...]. Select the file ":hugs98:src:machugs:hugs.mcp.xml". When the file dialog appears, name the new project "hugs.mcp", and save it in the same folder as the imported xml file. Then choose [Project->Make]. The Hugs 98 application will be created in the hugs98 folder. Preferences in the form of a Hugs command line string can be saved in a file "Hugs Preferences" in the same folder as the application. On another platform: If you can't run the configure script, pick one of the Windows configurations and use it as a basis for constructing the following files Hugs98/src/Makefile Hugs98/src/options.h # Configuration options Hugs98/src/config.h # Description of your machine/compiler/OS 2) Build Hugs and associated files cd .. make At this point, you might like to run a few tests to make sure everything's working. ./hugs -P../lib -- Run a few tests like 1+2, [1..], etc. Use ":quit" to exit On Windows, you have to "move hugs.exe .." before running it. 3) Install Hugs in chosen directories make install (Note that the permissions of the installed files will be affected by your "umask" setting. If you want the installed files to be world readable, you need to set umask accordingly.) Try a few simple tests: /usr/local/solaris/bin/hugs [1..10] :quit cat > echo < module Main(main) where > import System(getArgs) > > main = do { args <- getArgs; putStrLn (unwords args) } EOF chmod 755 echo ./echo Hello World Administrators of sites with multiple architectures often prefer to install a shell script in /usr/local/bin which will select an appropriate binary according to the architecture on which it is run rather than a binary. Configuration should be the same as above (use a different --bindir argument for each architecture but, if you want, save a small amount of space by using the same --datadir) and use a shell script like the following. #! /bin/sh HW_OS=${HW_OS-`/usr/local/gnu/bin/hw_os`} BINDIR=/local/lib/Hugs1.4/$HW_OS exec $BINDIR/hugs $* This kind of script would also be a good place to set system-wide default options (eg to select an editor or to switch on the "show types" option). 4) Cleanup after yourself You can now run "make clean" to delete all machine-generated files. If you ran "make install", you could delete the entire Hugs source tree - but you might want to keep the Hugs98/doc directory. Hugs specific configuration options: --with-readline Use command line editor if available. We highly recommend this option. However, it changes Hugs' user interface in a way that will cause every single regression test to fail. (On Unix, regression tests are run by "make install; make check".) There are two choices of command line editor that can be used with Hugs: GNU readline: usual GNU sources (e.g. bash distribution) editline: (comp.sources.misc, vol 31, issue 71) As you might expect, the GNU library is a bit larger but more powerful. --enable-timer Time how long each evaluation takes. Timing is included for the purpose of benchmarking the Hugs interpreter, comparing its performance across a variety of different machines, and with other systems for similar languages. It would be somewhat foolish to try to use the timings produced in this way for any other purpose. In particular, using timings to compare the performance of different versions of an algorithm is likely to give very misleading results. The current implementation of Hugs as an interpreter, without any significant optimizations, means that there are much more significant overheads than can be accounted for by small variations in Hugs code. --enable-profiling Gather statistics about heap allocation during evaluation. Statistics are written to a file profile.hp which may be viewed using the hp2ps program. This option makes Hugs use much more memory and run much slower. The ":set -d" command can be used to reduce the time overhead by controlling the frequency with which statistics are gathered. --with-nmake Try to generate a Makefile that will work with Microsoft's nmake. --disable-large-banner Print a single-line startup banner instead of the 9 line banner. (This option will also cause the "make check" regression tests to fail.) --with-gui Used when generating Hugs for Windows. Only works with Borland C++ --enable-internal-prims Enable experimental features used in Hugs98/lib/hugs/HugsInternals.hs --enable-stack-dumps Enable printing of the top and bottom few objects on the stack when stack overflow happens. This feature is currently (Sept'97) just a proof of concept. We welcome suggestions (and/or code) to make it useful for people who don't have an intimate knowledge of how the G machine operates. --enable-debug --enable-tag-checks --enable-lint For use when debugging Hugs. --with-preprocessor This is an experimental feature and may change in future versions. Enable the use of a preprocessor for processing Haskell source files before compiling them with Hugs. When configured with preprocessing on, you can use the "-F" option to specify which preprocessor to use. For example, if your preprocessor is in /users/JFH/bin/hscpp, you might say :set -F"/users/JFH/bin/hscpp" If you have perl and gcc installed on your machine, the following script provides a simple cpp-like preprocessor. eval "exec perl -S $0 $*" if $running_under_some_random_shell; # # Reads CPP output and turns #line things into appropriate Haskell # pragmas. This program is derived from the "hscpp" script # distributed with the Glasgow Haskell Compiler. # $Cpp = 'gcc -E -xc -traditional'; open(INPIPE, "$Cpp @ARGV |") || die "Can't open C pre-processor pipe\n"; while () { # line directives come in flavo[u]rs: # s/^#\s*line\s+\d+$/\{\-# LINE \-\}/; IGNORE THIS ONE FOR NOW s/^#\s*line\s+(\d+)\s+(\".+\")$/\{\-# LINE \1 \2 \-\}/; s/^#\s*(\d+)\s+(\".*\").*/\{\-# LINE \1 \2 \-\}/; print $_; } close(INPIPE) || exit(1); # exit is so we reflect any errors. exit(0); Note that Hugs currently ignores the {-# LINE _ _ #-} pragmas so error messages will refer to the wrong line numbers.