2
<!--Copyright 1997-2002 by Sleepycat Software, Inc.-->
3
<!--All rights reserved.-->
4
<!--See the file LICENSE for redistribution information.-->
7
<title>Berkeley DB Reference Guide: Changing compile or load options</title>
8
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
9
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
12
<a name="2"><!--meow--></a><a name="3"><!--meow--></a>
13
<table width="100%"><tr valign=top>
14
<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Building Berkeley DB for UNIX systems</dl></h3></td>
15
<td align=right><a href="../../ref/build_unix/conf.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/build_unix/install.html"><img src="../../images/next.gif" alt="Next"></a>
18
<h1 align=center>Changing compile or load options</h1>
19
<p>You can specify compiler and/or compile and load time flags by using
20
environment variables during Berkeley DB configuration. For example, if you
21
want to use a specific compiler, specify the CC environment variable
22
before running configure:
23
<p><blockquote><pre>prompt: env CC=gcc ../dist/configure</pre></blockquote>
24
<p>Using anything other than the native compiler will almost certainly mean
25
that you'll want to check the flags specified to the compiler and
27
<p>To specify debugging and optimization options for the C compiler,
28
use the CFLAGS environment variable:
29
<p><blockquote><pre>prompt: env CFLAGS=-O2 ../dist/configure</pre></blockquote>
30
<p>To specify header file search directories and other miscellaneous options
31
for the C preprocessor and compiler, use the CPPFLAGS environment variable:
32
<p><blockquote><pre>prompt: env CPPFLAGS=-I/usr/contrib/include ../dist/configure</pre></blockquote>
33
<p>To specify debugging and optimization options for the C++ compiler,
34
use the CXXFLAGS environment variable:
35
<p><blockquote><pre>prompt: env CXXFLAGS=-Woverloaded-virtual ../dist/configure</pre></blockquote>
36
<p>To specify miscellaneous options or additional library directories for
37
the linker, use the LDFLAGS environment variable:
38
<p><blockquote><pre>prompt: env LDFLAGS="-N32 -L/usr/local/lib" ../dist/configure</pre></blockquote>
39
<p>If you want to specify additional libraries, set the LIBS environment
40
variable before running configure. For example, the following would
41
specify two additional libraries to load, "posix" and "socket":
42
<p><blockquote><pre>prompt: env LIBS="-lposix -lsocket" ../dist/configure</pre></blockquote>
43
<p>Make sure that you prepend -L to any library directory names and that you
44
prepend -I to any include file directory names! Also, if the arguments
45
you specify contain blank or tab characters, be sure to quote them as
46
shown previously; that is with single or double quotes around the values
47
you are specifying for LIBS.
48
<p>The env command, which is available on most systems, simply sets one or
49
more environment variables before running a command. If the env command
50
is not available to you, you can set the environment variables in your
51
shell before running configure. For example, in sh or ksh, you could
53
<p><blockquote><pre>prompt: LIBS="-lposix -lsocket" ../dist/configure</pre></blockquote>
54
<p>In csh or tcsh, you could do the following:
55
<p><blockquote><pre>prompt: setenv LIBS "-lposix -lsocket"
56
prompt: ../dist/configure</pre></blockquote>
57
<p>See your command shell's manual page for further information.
58
<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/build_unix/conf.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/build_unix/install.html"><img src="../../images/next.gif" alt="Next"></a>
60
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>