# Compiling psqlODBC on Unix

Following psqlODBC's move away from the main PostgreSQL source tree, Peter Eisentraut was kind enough provide a build environment for us which is now included in psqlODBC tarballs.

## Installation

To install, just try something like:

>     % tar -zxvf psqlodbc-7.2.3.tar.gz
>     % cd postgresql-7.2.3
>     % ./configure
>     % make
>     % make install

The configure script will accept the following useful options:

- --with-iodbc
- --with-unixodbc
- --with-odbcinst=DIR
- --with-libpq (build a libpq enabled version of psqlodbc. default = yes)
- --with-pgsql-include=DIR (Look for postgreSQL include files in DIR if libpq is enabled)
- --with-pgsql=DIR (look for PostgreSQL libraries and headers in DIR if libpq is enabled)
- --enable-pthreads (thread-safe driver on some platforms)
- --help

## Building a distribution

### Prerequisites

- Autoconf 2.52 or higher
- Automake 1.6.* (Lower versions are rejected, version 1.7 untested.)
- Libtool 1.4.2a (CVS from stable branch, maybe 1.4.2 works as well)
- PostgreSQL source tree (7.3 branch)

### Bootstrapping

First, copy libtool.m4 into source directory. Be sure to pick the one from the right Libtool version. Then run:

>     aclocal -I . -I $PGSRC/config
>     libtoolize --force --copy
>     autoconf
>     autoheader
>     automake --add-missing --copy

You can run 'make maintainer-clean' to remove all the files this generates.

### Building

>     ./configure
>     make
>     make install

configure has the same options that the PostgreSQL configure used to have for ODBC, namely --with-iodbc, --with-unixodbc, and --with-odbcinst=DIR.

### Making a Source Distribution

'make dist' makes a file psqlodbc-xx.xx.xxxx.tar.gz. It's even better to use 'make distcheck', which runs a number of tests to see if the distribution is internally consistent.

The distribution does not contain any Windows-specific files (*.def, maybe others). If it is desired to include them, edit Makefile.am.