<!---
N.B.  The definitive Markdown source of this file is located in the
doc/wiki_source subdirectory of the PLplot source tree.  So only use
the ctrl-v and delete capabilities of the GUI file editor at
SourceForge to make changes to the SourceForge version of this file,
where ctrl-v is used to complete a cut and paste from the definitive
version of this file in the PLplot source tree that is being edited
with your favorite file editor, and delete used to remove extraneous
unmodified text whose changed form has been copied with the cut and
paste.
-->

Description
-----------

[SWIG](http://www.swig.org/) is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages. SWIG is used with different types of languages including common scripting languages such as Perl, PHP, Python, Tcl and Ruby.

Instructions for Mac OS X
-------------------------

-   The SWIG executable which is provided by Apple (*/usr/bin/swig*, version 1.3.31) is too old, at least for the [Lua](Lua "wikilink") bindings. For Python and Java there is maybe no need to install a new version of SWIG.
-   Download [SWIG 1.3.40 tar file](http://sourceforge.net/projects/swig/files/swig/swig-1.3.40/swig-1.3.40.tar.gz/download)
-   Untar *swig-1.3.40.tar.gz* into a folder of your choice
-   Cd into the folder and create a build folder

`mkdir build`
`cd build`

-   Configure, build and install SWIG. Omit the *--prefix* flag if you intend to install swig in the standard path (*/usr/local*)

`./configure --prefix=$HOME/local/swig-1.3.40`
`make && make install`

-   If you installed SWIG to a nonstandard location add the bin directory to the path by editing your *.profile* file in your home directory. Add the following lines

`# add swig to PATH`
`export PATH=$HOME/local/swig-1.3.40/bin:$PATH`

Instructions for Linux
----------------------

N/A

Instructions for Windows
------------------------

-   Download [SWIG zip](http://prdownloads.sourceforge.net/swig/swigwin-1.3.36.zip)
-   Unzip swigwin-1.3.36.zip into a folder of your choice

### Set CMake paths

-   set environment variables (for MinGW and Visual C++) and add SWIG directory to PATH

`set SWIGDIR=C:\tools\swigwin-1.3.36`
`set PATH=%SWIGDIR%;%PATH%`
`set CMAKE_INCLUDE_PATH=%SWIGDIR%\lib;%CMAKE_INCLUDE_PATH%`

CMake is now able to find SWIG.


The content of this page is available under the [GNU Free Documentation License 1.2](http://www.gnu.org/copyleft/fdl.html).
