# 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 depend
       make

(The `make depend` step is optional, but is helpful to ensure that things will be rebuild if you change a header file.)

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

### 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 group-depend
       make program-depend
       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

### 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 depend`, `make install`, `make clean` and `make clobber` will operate only on the programs you have configured.

## Building Windows Programs with 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. At the top level of the suite3270 source directory, use:

       nmake /fMsc\Makefile

More-specific targets can be used. (program is wc3270, ws3270 or wpr3287.)

       nmake /fMsc\Makefile program

Additional targets are available:

       nmake /fMsc\Makefile clean
       nmake /fMsc\Makefile program-clean
       nmake /fMsc\Makefile clobber
       nmake /fMsc\Makefile program-clobber

Note that the 'configure' step is not necessary with Visual Studio builds, and there are no configurable options.

## Building Windows Programs with Visual Studio (GUI)

The Visual Studio solution is called `suite3270.sln` in the `VS2010` 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-Win32\include`.

## 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

## 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 these packages:

- mingw-runtime from the Devel group
- mingw-w32api from the Devel group

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

Note that there is currently a bug in one of Cygwin's MinGW libraries that prevents the wc3270 or ws3270 from running -- it is looking for the non-existent DLL winspool.dll. There is no known workaround for this problem; it has long since been fixed in MinGW and Cygwin simply needs to update their package version. Users are encouraged to report this issue to Cygwin or to amend existing problem reports to get it fixed.

## 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