 <chapter>
  <title>Configuration Options</title>

  <sect1>
   <title>Parameters for Configuration
    (<application>configure</application>)</title>

   <para>
    The full set of parameters available in <application>configure</application>
    can be obtained by typing
   
    <programlisting>
$ ./configure --help
    </programlisting>
   </para>

   <para>
    The following parameters may be of interest to installers:
   
    <programlisting>
Directories to install PostgreSQL in:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local/pgsql]
  --bindir=DIR            user executables in DIR [EPREFIX/bin]
  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
  --includedir=DIR        C header files in DIR [PREFIX/include]
  --mandir=DIR            man documentation in DIR [PREFIX/man]
Features and packages:
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
--enable and --with options recognized:
  --with-template=<replaceable>template</replaceable>
                          use operating system template file
                              see template directory
  --with-includes=<replaceable>dirs</replaceable>    look for header files for tcl/tk, etc in DIRS
  --with-libraries=<replaceable>dirs</replaceable>   look for additional libraries in DIRS
  --with-libs=<replaceable>dirs</replaceable>        alternate spelling of --with-libraries
  --enable-locale         enable locale support
  --enable-recode         enable cyrillic recode support
  --enable-multibyte      enable multibyte character support
  --with-pgport=<replaceable>portnum</replaceable>   change default postmaster port
  --with-maxbackends=<replaceable>n</replaceable>    set default maximum number of server processes 
  --with-tcl              build Tcl interfaces and pgtclsh
  --with-tclconfig=<replaceable>tcldir</replaceable>
                          tclConfig.sh and tkConfig.sh are in DIR
  --with-perl             build Perl interface and plperl
  --with-odbc             build ODBC driver package
  --with-odbcinst=<replaceable>odbcdir</replaceable>
                          change default directory for odbcinst.ini
  --enable-cassert        enable assertion checks (for debugging)
  --enable-debug          build with debugging symbols (-g) 
  --with-CC=<replaceable>compiler</replaceable>
                          use specific C compiler
  --with-CXX=<replaceable>compiler</replaceable>
                          use specific C++ compiler
  --without-CXX           prevent building C++ code 
    </programlisting>
   </para>

   <para>
    Some systems may have trouble building a specific feature of
    <productname>Postgres</productname>. For example, systems with a damaged
    C++ compiler may need to specify <option>--without-CXX</option> to instruct
    the build procedure to skip construction of <filename>libpq++</filename>.
   </para>

   <para>
    Use the <option>--with-includes</option> and
    <option>--with-libraries</option> options if you want to build
    <productname>Postgres</productname> using include files or libraries
    that are not installed in your system's standard search path.  For
    example, you might use these to build with an experimental version of
    Tcl.  If you need to specify more than one nonstandard directory for
    include files or libraries, do it like this:

    <programlisting>
--with-includes="/opt/tcl/include /opt/perl5/include"
    </programlisting>
   </para>
  </sect1>

  <sect1>
   <title>Parameters for Building (<application>make</application>)</title>
  
   <para>
    Many installation-related parameters can be set in the building
    stage of <productname>Postgres</productname> installation.
   </para>

   <para>
    In most cases, these parameters should be placed in a file,
    <filename>Makefile.custom</filename>, intended just for that purpose.
    The default distribution does not contain this optional file, so you
    will create it using a text editor of your choice. When upgrading installations,
    you can simply copy your old Makefile.custom to the new installation before
    doing the build.
   </para>

   <para>
    Alternatively, you can set variables on the <application>make</application>
    command line:

    <programlisting>
make [ <replaceable>variable</replaceable>=<replaceable>value</replaceable> [...] ]
    </programlisting>
   </para>

   <para>
    A few of the many variables that can be specified are:
   
    <variablelist>
     <varlistentry>
      <term>
       <envar>POSTGRESDIR</envar>
      </term>
      <listitem>
       <para>
	Top of the installation tree.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term>
       <envar>BINDIR</envar>
      </term>
      <listitem>
       <para>
	Location of applications and utilities.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term>
       <envar>LIBDIR</envar>
      </term>
      <listitem>
       <para>
	Location of object libraries, including shared libraries.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term>
       <envar>HEADERDIR</envar>
      </term>
      <listitem>
       <para>
	Location of include files.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term>
       <envar>ODBCINST</envar>
      </term>
      <listitem>
       <para>
	Location of installation-wide <application>psqlODBC</application>
	(<acronym>ODBC</acronym>) configuration file.
       </para>
      </listitem>
     </varlistentry>

    </variablelist>
   </para>
   <para>
    There are other optional parameters which are not as commonly used.
    Many of those listed below are appropriate when doing 
    <application>Postgres</application> server code development.

    <variablelist>
     <varlistentry>
      <term>
       <envar>CFLAGS</envar>
      </term>
      <listitem>
       <para>
	Set flags for the C compiler. 
	Should be assigned with "+=" to retain relevant default parameters.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term>
       <envar>YFLAGS</envar>
      </term>
      <listitem>
       <para>
	Set flags for the yacc/bison parser. <option>-v</option> might be
	used to help diagnose problems building a new parser.
	Should be assigned with "+=" to retain relevant default parameters.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term>
       <envar>USE_TCL</envar>
      </term>
      <listitem>
       <para>
	Enable Tcl interface building.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term>
       <envar>HSTYLE</envar>
      </term>
      <listitem>
       <para>
	DocBook <acronym>HTML</acronym> style sheets for building the 
	documentation from scratch.
	Not used unless you are developing new documentation from the
	DocBook-compatible <acronym>SGML</acronym> source documents in
	<filename>doc/src/sgml/</filename>.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term>
       <envar>PSTYLE</envar>
      </term>
      <listitem>
       <para>
	DocBook style sheets for building printed documentation from scratch.
	Not used unless you are developing new documentation from the
	DocBook-compatible <acronym>SGML</acronym> source documents in
	<filename>doc/src/sgml/</filename>.
       </para>
      </listitem>
     </varlistentry>

    </variablelist>
   </para>

   <para>
    Here is an example <filename>Makefile.custom</filename> for a
    PentiumPro Linux system:
   
    <programlisting>
# Makefile.custom
# Thomas Lockhart 1999-06-01

POSTGRESDIR= /opt/postgres/current
CFLAGS+= -m486 -O2

# documentation

HSTYLE= /home/tgl/SGML/db118.d/docbook/html
PSTYLE= /home/tgl/SGML/db118.d/docbook/print
    </programlisting>
   </para>
  </sect1>

</chapter>

<!-- Keep this comment at the end of the file
Local variables:
mode:sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"./reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:("/usr/lib/sgml/catalog")
sgml-local-ecat-files:nil
End:
-->
