The GNU Modula-2 front end to GCC

Building GNU Modula-2 grafted on the gcc-4.1.2 branch

Unless you have a specific reason, it is advisable to use the 4.7 graft of gm2 (see the next section).

On a GNU/Linux system you should also be able to build it using these commands. If you are building on a system which supports multiarch then you should type:

$ CFLAGS=-B/usr/lib/x86_64-linux-gnu
$ export CFLAGS
$ LIBRARY_PATH=/usr/lib/x86_64-linux-gnu

The above is necessary on a Debian Wheezy x86_64 system, but not on Debian Squeeze.

The following commands assume your shell is /bin/bash. To build GNU Modula-2 type:

$ mkdir -p $HOME/opt
$ mkdir -p build-4.1.2
$ cd build-4.1.2
$ ../gcc-4.1.2+gm2-git-latest/gm2/gcc-versionno/configure \
     --enable-languages=c,c++,gm2 \
     --disable-multilib --enable-checking=all --prefix=$HOME/opt
$ make "SHELL=/bin/bash"

To install GNU Modula-2, after a successful build, type:

$ make "SHELL=/bin/bash" install
$ cd ..

Now you should be able to perform:

$ export PATH=$HOME/opt/bin:$PATH
$ cd build-4.1.2/gcc/gm2/examples/hello
$ make post-install

which will create an a.out for the infamous hello world example.