# suite3270 Build and Install Instructions

## Building on Unix or Cygwin

To build the entire 3270 emulation suite, including native Unix programs and cross-compiled Windows programs, use:

       ./configure
       make

To install Unix binaries in the default install directory (`/usr/local`), use:

       make install

To install Unix manual pages, use:

       make install.man

To remove intermediate files, use:

       make clean

To remove all derived files, use:

       make clobber

Object files will be placed in directories named `obj/architecture`. For example, 64-bit Linux object files are placed in `obj/x86_64-unknown-gnu-linux`. 32-bit Windows object files are placed in `obj/win32`. 64-bit Windows object files are placed in `obj/win64`.

### Selective configure

If you only want to build a subset of the programs, you can limit the scope of the configure script with the following options. Note that the options are cumulative, so you can specify exactly the set of programs you want:

`--enable-unix` | Include all of the Unix programs
`--enable-windows` | Include all of the Windows programs
`--enable-x3270` | Include x3270
`--enable-c3270` | Include c3270
`--enable-s3270` | Include s3270
`--enable-tcl3270` | Include tcl3270
`--enable-pr3287` | Include pr3287
`--enable-ws3270` | Include ws3270
`--enable-wc3270` | Include wc3270
`--enable-wpr3287` | Include wpr3287

When you limit the configuration this way, it changes the top-level make targets, so `make`, `make install`, `make clean` and `make clobber` will operate only on the programs you have configured.

### Summary of Common configure Options

The top-level `configure` script accepts the following options. Note that these apply only to Unix; the options for Windows programs are fixed.

`--help` | Print a help message.
`--prefix=prefix` | Install architecture-independent files under prefix (defaults to `/usr/local`)
`--exec-prefix=eprefix` | Install architecture-dependent files (executables) under eprefix (defaults to same as prefix)
`--bindir=dir` | Install user executables dir (defaults to `eprefix/bin`)
`--sysconfdir=dir` | Install configuration files (`ibm_hosts`, character sets) in dir (defaults to `prefix/etc`).
`--disable-apl` | Leave out APL character support.
`--disable-dbcs` | Leave out DBCS (Double Byte Character Set) support.
`--disable-local-process` | Leave out local process (connecting to "-e shell_command") support. This will be automatically disabled if the local system does not support the forkpty() library call.
`--disable-ssl` | Leave out SSL (Secure Sockets Layer) support. SSL support requires the OpenSSL library.
`--with-ssl=dir` | Specify the directory where the OpenSSL library is installed.

There are also `configure` options that are specific to individual programs. These can be passed to the top-level `configure` script. See each individual program's additional build information for details.

- x3270
- c3270
- tcl3270

### Selective Build Targets

To build just the Unix programs, use:

       make unix

To cross-compile just the Windows programs, use:

       make windows

To build an individual program, such as s3270, just make it:

       make s3270

Each of the top-level symbolic targets can be limited to a group (unix or windows) or to a program, by adding the desired prefix:

       make unix-install
       make unix-install.man
       make program-install
       make program-install.man
       make group-clean
       make program-clean
       make group-clobber
       make program-clobber

### Notes for Cygwin

The minimum set of extra Cygwin packages needed to build the 3270 suite are:

- The make package from the Devel group
- The gcc-core package from the Devel group
- For SSL support, the openssl-devel package from the Devel group

To cross-compile native Windows binaries, you need this package:

- mingw-w64-gcc from the Devel group

Other packages are needed by the specific programs, and are listed in those programs' build instructions.

### Notes for Mac OS X

Everything except x3270 is built the usual (Unix) way on Mac OS X. But to build x3270, you first need to install XQuartz (http://xquartz.macosforge.org/). Then to build all of the emulators, use the following commands:

       export PATH=$PATH:/opt/X11/bin
       ./configure --enable-unix --x-includes=/opt/X11/include
       make

### Notes for Solaris 2.x and Sun's C Compiler

Do not use Sun's BSD-compatibility compiler, `/usr/ucb/cc`. This is good advice in general, but in particular, the 3270 suite will not build with it. You should have a directory containing `gcc` (recommended) or Sun's standard compiler in your $PATH ahead of `/usr/ucb`.

### Building on FreeBSD

FreeBSD's iconv library is installed in `/usr/local`, so the the following options must be passed to the `configure` script:

       ./configure LDFLAGS=-L/usr/local/lib CPPFLAGS=-I/usr/local/include

## Building with Visual Studio 2013

### Visual Studio GUI

The Visual Studio solution is called `suite3270.sln` in the `VS2013` folder. There are individual projects for each of the programs and components. The Debug and Release configurations build code without OpenSSL support. The SSL-Debug and SSL-Release configurations build code with OpenSSL support, and require standard OpenSSL header files to be installed in the folder `C:\OpenSSL-Win64\include`.

### Visual Studio Command Line

To build with Microsoft Visual Studio from the command prompt, first open a command console with Visual Studio build environment variables set. Switch to the `VS2013` directory, and type:

       msbuild

The usual msbuild options are available, such as /m, /p:Configuration (which can specify Debug, Release, SSL-Debug or SSL-Release) and /p:Platform (which can specify x86 or x64).