flags.html   [plain text]


<!--$Id: flags.so,v 10.13 2006/10/05 01:06:05 bostic Exp $-->
<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
<!--See the file LICENSE for redistribution information.-->
<html>
<head>
<title>Berkeley DB Reference Guide: Changing compile or load options</title>
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
</head>
<body bgcolor=white>
<a name="2"><!--meow--></a><a name="3"><!--meow--></a>
<table width="100%"><tr valign=top>
<td><b><dl><dt>Berkeley DB Reference Guide:<dd>Building Berkeley DB for UNIX/POSIX systems</dl></b></td>
<td align=right><a href="../build_unix/small.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../build_unix/install.html"><img src="../../images/next.gif" alt="Next"></a>
</td></tr></table>
<p align=center><b>Changing compile or load options</b></p>
<p>You can specify compiler and/or compile and load time flags by using
environment variables during Berkeley DB configuration.  For
example, if you want to use a specific compiler, specify the CC
environment variable before running configure:</p>
<blockquote><pre>prompt: env CC=gcc ../dist/configure</pre></blockquote>
<p>Using anything other than the native compiler will almost certainly mean
that you'll want to check the flags specified to the compiler and
loader, too.</p>
<p>To specify debugging and optimization options for the C compiler,
use the CFLAGS environment variable:</p>
<blockquote><pre>prompt: env CFLAGS=-O2 ../dist/configure</pre></blockquote>
<p>To specify header file search directories and other miscellaneous options
for the C preprocessor and compiler, use the CPPFLAGS environment variable:</p>
<blockquote><pre>prompt: env CPPFLAGS=-I/usr/contrib/include ../dist/configure</pre></blockquote>
<p>To specify debugging and optimization options for the C++ compiler,
use the CXXFLAGS environment variable:</p>
<blockquote><pre>prompt: env CXXFLAGS=-Woverloaded-virtual ../dist/configure</pre></blockquote>
<p>To specify miscellaneous options or additional library directories for
the linker, use the LDFLAGS environment variable:</p>
<blockquote><pre>prompt: env LDFLAGS="-N32 -L/usr/local/lib" ../dist/configure</pre></blockquote>
<p>If you want to specify additional libraries, set the LIBS environment
variable before running configure.  For example, the following would
specify two additional libraries to load, "posix" and "socket":</p>
<blockquote><pre>prompt: env LIBS="-lposix -lsocket" ../dist/configure</pre></blockquote>
<p>Make sure that you prepend -L to any library directory names and that you
prepend -I to any include file directory names!  Also, if the arguments
you specify contain blank or tab characters, be sure to quote them as
shown previously; that is with single or double quotes around the values
you are specifying for LIBS.</p>
<p>The env command, which is available on most systems, simply sets one or
more environment variables before running a command.  If the env command
is not available to you, you can set the environment variables in your
shell before running configure.  For example, in sh or ksh, you could
do the following:</p>
<blockquote><pre>prompt: LIBS="-lposix -lsocket" ../dist/configure</pre></blockquote>
<p>In csh or tcsh, you could do the following:</p>
<blockquote><pre>prompt: setenv LIBS "-lposix -lsocket"
prompt: ../dist/configure</pre></blockquote>
<p>See your command shell's manual page for further information.</p>
<table width="100%"><tr><td><br></td><td align=right><a href="../build_unix/small.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../build_unix/install.html"><img src="../../images/next.gif" alt="Next"></a>
</td></tr></table>
<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
</body>
</html>