This is step where you will configure the source tree and specify installation options specific to your needs. To use the default installation script, use the following command:

 ./configure [options]

If you are curious about all of the possible configure options, you can use the --help option with configure .

 ./configure --help 

The configure script is used to check for software dependencies that are required to compile PostgreSQL. As configure checks for dependencies it will create the necessary files for use with the make command.

There is a good chance that the default source configuration that configure uses will not be the setup you require. Therefore, in order to customize the default set up, you can enable certain options with configure . Table 2-1 contains a summarized list of available configuration options.

Table 2-1. Configuration Options

Option

Description

--prefix= PREFIX

The default install directory is /usr/local/pgsql . You can use this option to change the default installation directory. For example, /usr/pgsql .

--exec-prefix= EXEC-PREFIX

This is used for architecture dependent files. For PostgreSQL purposes it is the same as --prefix= files between different hosts.

--bindir= DIRECTORY

The directory you would like the executable programs such as psql and postmaster into. The default is EXEC-PREFIX/bin.

--datadir= DIRECTORY

The directory that contains read-only data files. This directory also includes sample configuration files such as the pg_hba.conf. The default is EXEC-PREFIX/share

--sysconfdir= DIRECTORY

The directory that contains certain configuration files. Typically the ODBC configuration files are held here. The default is PREFIX/etc

--libdir= DIRECTORY

The directory that contains the required PostgreSQL libs. You will want to make sure this directory is placed in your ld.so.conf if you are running Linux. The default is EXEC-PREFIX/lib.

--includedir= DIRECTORY

The directory that contains the C and C++ header files. The default is PREFIX/include.

--docdir= DIRECTORY

The directory that contains the documentation files. This excludes the man pages which are installed in EXEC-PREFIX/man. The default is PREFIX/doc.

--mandir= DIRECTORY

Sets this directory to hold PostgreSQL man pages. The default is EXEC-PREFIX/man.

--with-includes= DIRECTORIES

A colon separated list directories to be searched for additional header files. For example --with-includes=/usr/include:/usr/local/include . This should only be required for non-standard installation locations.

--with-libraries= DIRECTORIES

The DIRECTORIES A colon separated list of directories to be searched for additional libraries. The syntax is the same as --with-includes= .

--enable-locale

This will enable locale support. The use of the locale support will incur a performance penalty and should only be activated if you will need to support non-English environments.

--enable-recode

This will enable the recode translation library.

--enable-multibyte

This will enable the use of multibyte character encodings. Multibyte is traditionally used with languages such as Japanese, Korean, and Chinese.

--with-pgport= NUMBER

The will allow the setting of an alternative default port for PostgreSQL. The normal default is 5432. You can change this with run time parameters.

--with-CXX

Turns on the compilation of the C++ interface library. If you are going to be developing in C++ for PostgreSQL you will need this.

--with-perl

This will compile the PostgreSQL Perl interface. You will likely need to be a privileged user (such as root) to compile with this option.

--with-python

This will compile the PostgreSQL Python interface. You will likely need to be a privileged user (such as root) to compile with this option.

--with-tcl

This will compile the PostgreSQL TCL interface. This is option is recommended if you would like to use PgAccess or pl/TCL.

--without-tk

If you would like to compile support for TCL but you do not need the graphical (TK) applications enable this option. If this option is specified with the --with-tcl option, then programs that require Tk (such as pgtksh and pgaccess) will not be included.

--with-tclconfig= DIRECTORY , --with-tkconfig= DIRECTORY

Sets this directory to hold tcl or tk Config.sh files. These files are automatically installed by Tcl/Tk and it contains configuration information needed to build interface modules.

--enable-odbc

This will enable support for ODBC.

--with-odbcinst= DIRECTORY

This will set the directory to hold the odbcinst.ini configuration file. The default is /usr/local/pgsql/etc . This location can be overridden by using the --sysconfdir option.

--with-krb4= DIRECTORY , --with-krb5= DIRECTORY

This will enable support for the Kerberos authentication system. The use of Kerberos is not covered within this book.

--with-krb-srvnam= NAME

This will set the name of the Kerberos service principal. The name 'postgres' is the default.

--with-openssl= DIRECTORY

This will enable the use of SSL for encrypted connections. You will need to have OpenSSL installed to use this feature. The default OpenSSL location is /usr/local/ssl . It is suggested that you enable this option if you wish to utilize Stunnel.

--with-java

This will enable Java/JDBC support. The Ant and JDK packages are required for this to compile correctly. We suggest you enable this option if you wish to utilize the JDBC chapter in this book. Information on ANT, and the Java JDK can be found respectively at: http://jakarta.apache.org/ant/index.html and http://java.sun.com/j2se/1.3/

--enable-syslog

If you are running the syslog daemon, you can enable this to allow PostgreSQL to log to your syslog . This is also commonly known as the messages file on Linux.

--enable-debug

This will compile PostgreSQL with the debugging options turned on. This will make PostgreSQL more resource intensive and should only be used if you are developing the PostgreSQL database itself.

--enable-cassert

This will enable assertion checking on the PostgreSQL server. This feature should only be used if you are developing the PostgreSQL database itself.

Note PgAccess and TCL
 

If you are interested in using PgAccess to interface with your PostgreSQL database, be sure to pass the --with-tcl option to the configure script.

You can change the C or C++ compiler chosen by the configure command. To do so, set the environment variables CC and CXX to the program that you want to use instead of gcc .

Note Oops!
 

If you compile PostgreSQL and find that you are missing a feature, you can reconfigure and then continue with the subsequent steps to build and install PostgreSQL. If you choose to reconfigure the PostgreSQL source before you install, make sure you use the gmake clean command within the source tree. This will delete all object files and partially compiled files.