===========================================================================
                          OpenSource Erlang/OTP 
===========================================================================


Please read the whole file before attempting to build and install Erlang.
You can find more information about OpenSource Erlang at

  http://www.erlang.org/


Portability
-----------

Erlang/OTP should be possible to build from source on any Unix
system, including Mac OS X.

Instructions for building from source on Windows are in the file README.win32.
Binary releases for Windows can be found at http://www.erlang.org/

At Ericsson we have a "Daily Build and Test" that runs on:
 
    Operating system        Version
    -----------------------------------------------------------
    Solaris/Sparc           2.8      (1)
    Linux/Suse x86	    9.2
    Linux/Suse Amd64	    9.2
    Linux/Suse Amd64	    10.0
    Linux/Montavista PPC    3.1
    FreeBSD x86             5.0
    Mac OS X/PPC            10.4.8   (2)
    Mac OS X/Intel          10.4.8   (3)
    Windows 		    XP
    Windows 		    2003

(1) Older versions of Solaris should work as well, but we don't test them 
    any longer.
(2) Runs on an Apple eMac. See notes below.
(3) Runs on an Mac Mini. See notes below.

Versions known *not* to work
-------------------------------------

Suse linux 9.1 is shipped with a patched GCC version 3.3.3, having the
rpm named gcc-3.3.3-41. That version has a serious optimization bug
that makes it unusable for building the erlang emulator. Please
upgrade GCC to a newer version before building on Suse 9.1. Suse Linux
EnterpriSe edition 9 (SLES9) has gcc-3.3.3-43 and is not affected.

Required utilities
------------------

These are the tools you will need in order to unpack and build Erlang/OTP.

  Unpacking
  ---------

  GNU unzip, or a modern uncompress.

  A TAR program that understands the GNU TAR format for long
  filenames (such as GNU TAR).
  

  Compiling
  ---------

  GNU make

  GNU C compiler

  Perl 5

  OpenSSL	        Optional but needed for building the Erlang/OTP
                        applications 'ssl' and 'crypto'. You need the
                        "development package" of OpenSSL, i.e. including
                        the header files. For building the application 'ssl'
			the OpenSSL binary command program 'openssl' is also
			needed. 

			At least version 0.9.7 of OpenSSL is required.

  Sun Java jdk-1.2.2    Or higher. Optional but needed for building
			the Erlang/OTP application 'jinterface' and parts
			of 'ic' and 'orber'. In addition to 1.2.2, we have
			tested jdk-1.3.1 and jdk-1.4.2.

  X Windows             Optional, but development headers and libraries
                        are needed to build the Erlang/OTP application 'gs'
			on Unix/Linux.

  sed			There seem to be some problems with some of the
			'sed' version on Solaris. Make sure "/bin/sed"
			or "/usr/bin/sed" is used on the Solaris platform.

  Flex                  Optional, headers and libraries are needed to 
                        build the flex scanner for the megaco application
                        on Unix/Linux.

  Installing
  ----------

  An install program that can take multiple file names.


How to build and install Erlang/OTP
-----------------------------------

Start by unpacking the Erlang/OTP distribution file with your
GNU compatible TAR

  1)    gunzip -c otp_src_R11B-0.tar.gz | tar xf -
  1)    zcat otp_src_R11B-0.tar.gz | tar xf -

Now cd into the base directory

  2)    cd otp_src_R11B-0

On some platforms Perl may behave strangely if certain locales are set,
so optionally you may need to set the LANG variable:

  3a) LANG=C; export LANG #Bourne shell
or
  3b) setenv LANG C #C-shell

Run the following commands

  4)    ./configure  [ options ]

If you upgraded the source with the patch you may need to clean up
from previous builds before the new build. Do a "make clean", see
"Caveats" below.

  5)    make
  6)    make install

Let's go through them in some detail:

    Step 4 runs a configuration script created by the GNU autoconf
utility, which checks for system specific features and then creates a
number of makefiles. The configure script allows you to customize a
number of parameters; type "./configure --help" for details. One of
the things you can specify is where Erlang/OTP should be installed; by
default Erlang/OTP will install in /usr/local/{bin,lib/erlang,man/man1};
to keep the same structure but install in a different place, let's
call it <Dir> rather than /usr/local use the --prefix argument. Like so:
"./configure --prefix=<Dir>". This step will also configure any
additional libraries unpacked in step 3 (if you didn't add any of the
extra libraries configure will issue a warning saying that there is no
configuration information in lib, this warning can safely be ignored).

You can also specify where the OpenSSL include and library files are
located, or else disable the use of SSL and Crypto. 

Other options are:

	--enable-smp-support	See the next section.

	--disable-smp-support	See the next section.

	--disable-threads	Disable support for threaded I/O;
				this option also disables building
				of the SMP emulator. (See the next section.)

	--enable-threads	Enable support for threaded I/O.
				(This is the default is SMP support is enabled.
				See the next section.)
				
	--disable-hipe   	Disable HiPE (High-Performance Erlang).
				HiPE will automatically be enabled on
				supported platforms.
	

    Step 5 first builds the Erlang emulator, this will take
approximately five minutes on a reasonably fast machine. It then
proceeds to build the Erlang/OTP libraries in the "lib" subdirectory
using the built emulator and the bootstrap libraries provided in the
"bootstrap" subdirectory.  Compiling everything can take quite a long
time, expect half an hour up to a couple of hours. After step 4 is
completed you should have a working Erlang/OTP system which you can
try by typing "bin/erl". This should start up Erlang/OTP and give you
a prompt.

    Step 6 is optional. It installs Erlang/OTP (if you change your
mind about where you wish to install you can rerun step 4, without
having to do step 5 again).

If you or your system has special requirements please read the
Makefile for additional configuration information.


Support for SMP (Symmetric Multi Processing)
--------------------------------------------

New for this release is support for SMP (Symmetric Multi Processing).
For more details, see the release notes for ERTS application and the
documentation. Here follows some brief information.

For platforms that are known by us to support the SMP emulator, the
SMP emulator will be built automatically. Use "erl -smp" to start it.
See the release notes for a list of the platforms.

To force building of an SMP emulator, use "./configure --enable-smp-support".
For more details about this, see the release notes.

Use "./configure --disable-smp-support" if you for some reason don't
want to have the SMP emulator built.


If SMP support is enabled, support for threaded I/O will also be turned on
(even in the standard, non-SMP emulator).


How to install the Erlang/OTP documentation
-------------------------------------------

For some graphical tools to find the on-line help you have to install
the HTML documentation on top of the installed OTP applications, i.e.

        cd <PrefixDir>/lib/erlang
        gunzip -c otp_html_R11B-0.tar.gz | tar xf -

For "erl -man <page>" to work the Unix manual pages have to be
installed in the same way, i.e.

        cd <PrefixDir>/lib/erlang
        gunzip -c otp_man_R11B-0.tar.gz | tar xf -


GS (Graphic System)
-------------------

GS now requires Tcl/Tk 8.3. It will be searched for when starting GS.

Using HiPE
----------

If you are running on a platform supporting HiPE and if
you have not disabled HiPE, you can compile a module into
native code like this from the Erlang shell:

	c(Module, native).

or

	c(Module, [native|OtherOptions]).

Using the erlc program, write like this:

	erlc +native Module.erl

The native code will be placed into the beam file and automatically
loaded when the beam file is loaded.

To add hipe options, write like this from the Erlang shell:

	c(Module, [native,{hipe,HipeOptions}|MoreOptions]).

Use

	hipe:help_options().

to print out the available options.


Mac OS X (Darwin)
-----------------

Mac OS X version 10.4 (Tiger) or later is recommended.

Earlier releases of Mac OS X might work, but we have not
tested them. On earlier releases, use the "gnutar" command
to unpack the sources. (If a non-GNU tar is used, some files
will not be correctly extracted and the build will fail.)

Erlang/OTP will read the network configuration files in "/etc" at
startup.  In Darwin these are normally not used by the operating
system. The easiest way to force Erlang/OTP avoid reading the files
is to put the line (including the ending '.')

  {lookup,["native"]}.

into the "$HOME/.inetrc" file.

Make sure that the command "hostname" returns a valid fully qualified
host name (this is configured in "/etc/hostconfig").

If you develop linked in drivers (shared library) you need to link
using "cc" and the flags "-bundle -flat_namespace -undefined
suppress". You also include "-fno-common" in CFLAGS when
compiling. Use ".so" as the library suffix.


Make and the variable "ERL_TOP"
-------------------------------

All the makefiles in the entire directory tree use the environment
variable ERL_TOP to find the absolute path of the installation. The
configure script will figure this out and set it in the top level
Makefile (which, when building, it will pass on). However, when
developing it is sometimes convenient to be able to run make in a
subdirectory. To do this you must set the ERL_TOP variable
before you run make.

For example, assume your GNU make program is called "make" and you
want to rebuild the application STDLIB, then you could do:

  cd lib/stdlib; env ERL_TOP=<Dir> make

where <Dir> would be what you find ERL_TOP is set to in the top level
Makefile.


More Information
----------------

More information can be found at http://www.erlang.org.

For commercial inquires (printed documentation, support, etc) please
visit http://www.erlang.se.
