You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
569 lines
26 KiB
HTML
569 lines
26 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<!-- This manual describes how to install and use the GNU multiple precision
|
|
arithmetic library, version 6.1.0.
|
|
|
|
Copyright 1991, 1993-2015 Free Software Foundation, Inc.
|
|
|
|
Permission is granted to copy, distribute and/or modify this document under
|
|
the terms of the GNU Free Documentation License, Version 1.3 or any later
|
|
version published by the Free Software Foundation; with no Invariant Sections,
|
|
with the Front-Cover Texts being "A GNU Manual", and with the Back-Cover
|
|
Texts being "You have freedom to copy and modify this GNU Manual, like GNU
|
|
software". A copy of the license is included in
|
|
GNU Free Documentation License. -->
|
|
<!-- Created by GNU Texinfo 6.4, http://www.gnu.org/software/texinfo/ -->
|
|
<head>
|
|
<title>Build Options (GNU MP 6.1.0)</title>
|
|
|
|
<meta name="description" content="How to install and use the GNU multiple precision arithmetic library, version 6.1.0.">
|
|
<meta name="keywords" content="Build Options (GNU MP 6.1.0)">
|
|
<meta name="resource-type" content="document">
|
|
<meta name="distribution" content="global">
|
|
<meta name="Generator" content="makeinfo">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<link href="index.html#Top" rel="start" title="Top">
|
|
<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
|
|
<link href="Installing-GMP.html#Installing-GMP" rel="up" title="Installing GMP">
|
|
<link href="ABI-and-ISA.html#ABI-and-ISA" rel="next" title="ABI and ISA">
|
|
<link href="Installing-GMP.html#Installing-GMP" rel="prev" title="Installing GMP">
|
|
<style type="text/css">
|
|
<!--
|
|
a.summary-letter {text-decoration: none}
|
|
blockquote.indentedblock {margin-right: 0em}
|
|
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
|
blockquote.smallquotation {font-size: smaller}
|
|
div.display {margin-left: 3.2em}
|
|
div.example {margin-left: 3.2em}
|
|
div.lisp {margin-left: 3.2em}
|
|
div.smalldisplay {margin-left: 3.2em}
|
|
div.smallexample {margin-left: 3.2em}
|
|
div.smalllisp {margin-left: 3.2em}
|
|
kbd {font-style: oblique}
|
|
pre.display {font-family: inherit}
|
|
pre.format {font-family: inherit}
|
|
pre.menu-comment {font-family: serif}
|
|
pre.menu-preformatted {font-family: serif}
|
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
|
pre.smallexample {font-size: smaller}
|
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
|
pre.smalllisp {font-size: smaller}
|
|
span.nolinebreak {white-space: nowrap}
|
|
span.roman {font-family: initial; font-weight: normal}
|
|
span.sansserif {font-family: sans-serif; font-weight: normal}
|
|
ul.no-bullet {list-style: none}
|
|
-->
|
|
</style>
|
|
|
|
|
|
</head>
|
|
|
|
<body lang="en">
|
|
<a name="Build-Options"></a>
|
|
<div class="header">
|
|
<p>
|
|
Next: <a href="ABI-and-ISA.html#ABI-and-ISA" accesskey="n" rel="next">ABI and ISA</a>, Previous: <a href="Installing-GMP.html#Installing-GMP" accesskey="p" rel="prev">Installing GMP</a>, Up: <a href="Installing-GMP.html#Installing-GMP" accesskey="u" rel="up">Installing GMP</a> [<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
|
|
</div>
|
|
<hr>
|
|
<a name="Build-Options-1"></a>
|
|
<h3 class="section">2.1 Build Options</h3>
|
|
<a name="index-Build-options"></a>
|
|
|
|
<p>All the usual autoconf configure options are available, run ‘<samp>./configure
|
|
--help</samp>’ for a summary. The file <samp>INSTALL.autoconf</samp> has some generic
|
|
installation information too.
|
|
</p>
|
|
<dl compact="compact">
|
|
<dt>Tools</dt>
|
|
<dd><a name="index-Non_002dUnix-systems"></a>
|
|
<p>‘<samp>configure</samp>’ requires various Unix-like tools. See <a href="Notes-for-Particular-Systems.html#Notes-for-Particular-Systems">Notes for Particular Systems</a>, for some options on non-Unix systems.
|
|
</p>
|
|
<p>It might be possible to build without the help of ‘<samp>configure</samp>’, certainly
|
|
all the code is there, but unfortunately you’ll be on your own.
|
|
</p>
|
|
</dd>
|
|
<dt>Build Directory</dt>
|
|
<dd><a name="index-Build-directory"></a>
|
|
<p>To compile in a separate build directory, <code>cd</code> to that directory, and
|
|
prefix the configure command with the path to the GMP source directory. For
|
|
example
|
|
</p>
|
|
<div class="example">
|
|
<pre class="example">cd /my/build/dir
|
|
/my/sources/gmp-6.1.0/configure
|
|
</pre></div>
|
|
|
|
<p>Not all ‘<samp>make</samp>’ programs have the necessary features (<code>VPATH</code>) to
|
|
support this. In particular, SunOS and Slowaris <code>make</code> have bugs that
|
|
make them unable to build in a separate directory. Use GNU <code>make</code>
|
|
instead.
|
|
</p>
|
|
</dd>
|
|
<dt><samp>--prefix</samp> and <samp>--exec-prefix</samp></dt>
|
|
<dd><a name="index-Prefix"></a>
|
|
<a name="index-Exec-prefix"></a>
|
|
<a name="index-Install-prefix"></a>
|
|
<a name="index-_002d_002dprefix"></a>
|
|
<a name="index-_002d_002dexec_002dprefix"></a>
|
|
<p>The <samp>--prefix</samp> option can be used in the normal way to direct GMP to
|
|
install under a particular tree. The default is ‘<samp>/usr/local</samp>’.
|
|
</p>
|
|
<p><samp>--exec-prefix</samp> can be used to direct architecture-dependent files like
|
|
<samp>libgmp.a</samp> to a different location. This can be used to share
|
|
architecture-independent parts like the documentation, but separate the
|
|
dependent parts. Note however that <samp>gmp.h</samp> and <samp>mp.h</samp> are
|
|
architecture-dependent since they encode certain aspects of <samp>libgmp</samp>, so
|
|
it will be necessary to ensure both <samp>$prefix/include</samp> and
|
|
<samp>$exec_prefix/include</samp> are available to the compiler.
|
|
</p>
|
|
</dd>
|
|
<dt><samp>--disable-shared</samp>, <samp>--disable-static</samp></dt>
|
|
<dd><a name="index-_002d_002ddisable_002dshared"></a>
|
|
<a name="index-_002d_002ddisable_002dstatic"></a>
|
|
<p>By default both shared and static libraries are built (where possible), but
|
|
one or other can be disabled. Shared libraries result in smaller executables
|
|
and permit code sharing between separate running processes, but on some CPUs
|
|
are slightly slower, having a small cost on each function call.
|
|
</p>
|
|
</dd>
|
|
<dt>Native Compilation, <samp>--build=CPU-VENDOR-OS</samp></dt>
|
|
<dd><a name="index-Native-compilation"></a>
|
|
<a name="index-Build-system"></a>
|
|
<a name="index-_002d_002dbuild"></a>
|
|
<p>For normal native compilation, the system can be specified with
|
|
‘<samp>--build</samp>’. By default ‘<samp>./configure</samp>’ uses the output from running
|
|
‘<samp>./config.guess</samp>’. On some systems ‘<samp>./config.guess</samp>’ can determine
|
|
the exact CPU type, on others it will be necessary to give it explicitly. For
|
|
example,
|
|
</p>
|
|
<div class="example">
|
|
<pre class="example">./configure --build=ultrasparc-sun-solaris2.7
|
|
</pre></div>
|
|
|
|
<p>In all cases the ‘<samp>OS</samp>’ part is important, since it controls how libtool
|
|
generates shared libraries. Running ‘<samp>./config.guess</samp>’ is the simplest way
|
|
to see what it should be, if you don’t know already.
|
|
</p>
|
|
</dd>
|
|
<dt>Cross Compilation, <samp>--host=CPU-VENDOR-OS</samp></dt>
|
|
<dd><a name="index-Cross-compiling"></a>
|
|
<a name="index-Host-system"></a>
|
|
<a name="index-_002d_002dhost"></a>
|
|
<p>When cross-compiling, the system used for compiling is given by ‘<samp>--build</samp>’
|
|
and the system where the library will run is given by ‘<samp>--host</samp>’. For
|
|
example when using a FreeBSD Athlon system to build GNU/Linux m68k binaries,
|
|
</p>
|
|
<div class="example">
|
|
<pre class="example">./configure --build=athlon-pc-freebsd3.5 --host=m68k-mac-linux-gnu
|
|
</pre></div>
|
|
|
|
<p>Compiler tools are sought first with the host system type as a prefix. For
|
|
example <code>m68k-mac-linux-gnu-ranlib</code> is tried, then plain
|
|
<code>ranlib</code>. This makes it possible for a set of cross-compiling tools
|
|
to co-exist with native tools. The prefix is the argument to ‘<samp>--host</samp>’,
|
|
and this can be an alias, such as ‘<samp>m68k-linux</samp>’. But note that tools
|
|
don’t have to be setup this way, it’s enough to just have a <code>PATH</code> with a
|
|
suitable cross-compiling <code>cc</code> etc.
|
|
</p>
|
|
<p>Compiling for a different CPU in the same family as the build system is a form
|
|
of cross-compilation, though very possibly this would merely be special
|
|
options on a native compiler. In any case ‘<samp>./configure</samp>’ avoids depending
|
|
on being able to run code on the build system, which is important when
|
|
creating binaries for a newer CPU since they very possibly won’t run on the
|
|
build system.
|
|
</p>
|
|
<p>In all cases the compiler must be able to produce an executable (of whatever
|
|
format) from a standard C <code>main</code>. Although only object files will go to
|
|
make up <samp>libgmp</samp>, ‘<samp>./configure</samp>’ uses linking tests for various
|
|
purposes, such as determining what functions are available on the host system.
|
|
</p>
|
|
<p>Currently a warning is given unless an explicit ‘<samp>--build</samp>’ is used when
|
|
cross-compiling, because it may not be possible to correctly guess the build
|
|
system type if the <code>PATH</code> has only a cross-compiling <code>cc</code>.
|
|
</p>
|
|
<p>Note that the ‘<samp>--target</samp>’ option is not appropriate for GMP. It’s for use
|
|
when building compiler tools, with ‘<samp>--host</samp>’ being where they will run,
|
|
and ‘<samp>--target</samp>’ what they’ll produce code for. Ordinary programs or
|
|
libraries like GMP are only interested in the ‘<samp>--host</samp>’ part, being where
|
|
they’ll run. (Some past versions of GMP used ‘<samp>--target</samp>’ incorrectly.)
|
|
</p>
|
|
</dd>
|
|
<dt>CPU types</dt>
|
|
<dd><a name="index-CPU-types-1"></a>
|
|
<p>In general, if you want a library that runs as fast as possible, you should
|
|
configure GMP for the exact CPU type your system uses. However, this may mean
|
|
the binaries won’t run on older members of the family, and might run slower on
|
|
other members, older or newer. The best idea is always to build GMP for the
|
|
exact machine type you intend to run it on.
|
|
</p>
|
|
<p>The following CPUs have specific support. See <samp>configure.ac</samp> for details
|
|
of what code and compiler options they select.
|
|
</p>
|
|
<ul>
|
|
<li> Alpha:
|
|
‘<samp>alpha</samp>’,
|
|
‘<samp>alphaev5</samp>’,
|
|
‘<samp>alphaev56</samp>’,
|
|
‘<samp>alphapca56</samp>’,
|
|
‘<samp>alphapca57</samp>’,
|
|
‘<samp>alphaev6</samp>’,
|
|
‘<samp>alphaev67</samp>’,
|
|
‘<samp>alphaev68</samp>’
|
|
‘<samp>alphaev7</samp>’
|
|
|
|
</li><li> Cray:
|
|
‘<samp>c90</samp>’,
|
|
‘<samp>j90</samp>’,
|
|
‘<samp>t90</samp>’,
|
|
‘<samp>sv1</samp>’
|
|
|
|
</li><li> HPPA:
|
|
‘<samp>hppa1.0</samp>’,
|
|
‘<samp>hppa1.1</samp>’,
|
|
‘<samp>hppa2.0</samp>’,
|
|
‘<samp>hppa2.0n</samp>’,
|
|
‘<samp>hppa2.0w</samp>’,
|
|
‘<samp>hppa64</samp>’
|
|
|
|
</li><li> IA-64:
|
|
‘<samp>ia64</samp>’,
|
|
‘<samp>itanium</samp>’,
|
|
‘<samp>itanium2</samp>’
|
|
|
|
</li><li> MIPS:
|
|
‘<samp>mips</samp>’,
|
|
‘<samp>mips3</samp>’,
|
|
‘<samp>mips64</samp>’
|
|
|
|
</li><li> Motorola:
|
|
‘<samp>m68k</samp>’,
|
|
‘<samp>m68000</samp>’,
|
|
‘<samp>m68010</samp>’,
|
|
‘<samp>m68020</samp>’,
|
|
‘<samp>m68030</samp>’,
|
|
‘<samp>m68040</samp>’,
|
|
‘<samp>m68060</samp>’,
|
|
‘<samp>m68302</samp>’,
|
|
‘<samp>m68360</samp>’,
|
|
‘<samp>m88k</samp>’,
|
|
‘<samp>m88110</samp>’
|
|
|
|
</li><li> POWER:
|
|
‘<samp>power</samp>’,
|
|
‘<samp>power1</samp>’,
|
|
‘<samp>power2</samp>’,
|
|
‘<samp>power2sc</samp>’
|
|
|
|
</li><li> PowerPC:
|
|
‘<samp>powerpc</samp>’,
|
|
‘<samp>powerpc64</samp>’,
|
|
‘<samp>powerpc401</samp>’,
|
|
‘<samp>powerpc403</samp>’,
|
|
‘<samp>powerpc405</samp>’,
|
|
‘<samp>powerpc505</samp>’,
|
|
‘<samp>powerpc601</samp>’,
|
|
‘<samp>powerpc602</samp>’,
|
|
‘<samp>powerpc603</samp>’,
|
|
‘<samp>powerpc603e</samp>’,
|
|
‘<samp>powerpc604</samp>’,
|
|
‘<samp>powerpc604e</samp>’,
|
|
‘<samp>powerpc620</samp>’,
|
|
‘<samp>powerpc630</samp>’,
|
|
‘<samp>powerpc740</samp>’,
|
|
‘<samp>powerpc7400</samp>’,
|
|
‘<samp>powerpc7450</samp>’,
|
|
‘<samp>powerpc750</samp>’,
|
|
‘<samp>powerpc801</samp>’,
|
|
‘<samp>powerpc821</samp>’,
|
|
‘<samp>powerpc823</samp>’,
|
|
‘<samp>powerpc860</samp>’,
|
|
‘<samp>powerpc970</samp>’
|
|
|
|
</li><li> SPARC:
|
|
‘<samp>sparc</samp>’,
|
|
‘<samp>sparcv8</samp>’,
|
|
‘<samp>microsparc</samp>’,
|
|
‘<samp>supersparc</samp>’,
|
|
‘<samp>sparcv9</samp>’,
|
|
‘<samp>ultrasparc</samp>’,
|
|
‘<samp>ultrasparc2</samp>’,
|
|
‘<samp>ultrasparc2i</samp>’,
|
|
‘<samp>ultrasparc3</samp>’,
|
|
‘<samp>sparc64</samp>’
|
|
|
|
</li><li> x86 family:
|
|
‘<samp>i386</samp>’,
|
|
‘<samp>i486</samp>’,
|
|
‘<samp>i586</samp>’,
|
|
‘<samp>pentium</samp>’,
|
|
‘<samp>pentiummmx</samp>’,
|
|
‘<samp>pentiumpro</samp>’,
|
|
‘<samp>pentium2</samp>’,
|
|
‘<samp>pentium3</samp>’,
|
|
‘<samp>pentium4</samp>’,
|
|
‘<samp>k6</samp>’,
|
|
‘<samp>k62</samp>’,
|
|
‘<samp>k63</samp>’,
|
|
‘<samp>athlon</samp>’,
|
|
‘<samp>amd64</samp>’,
|
|
‘<samp>viac3</samp>’,
|
|
‘<samp>viac32</samp>’
|
|
|
|
</li><li> Other:
|
|
‘<samp>arm</samp>’,
|
|
‘<samp>sh</samp>’,
|
|
‘<samp>sh2</samp>’,
|
|
‘<samp>vax</samp>’,
|
|
</li></ul>
|
|
|
|
<p>CPUs not listed will use generic C code.
|
|
</p>
|
|
</dd>
|
|
<dt>Generic C Build</dt>
|
|
<dd><a name="index-Generic-C"></a>
|
|
<p>If some of the assembly code causes problems, or if otherwise desired, the
|
|
generic C code can be selected with the configure <samp>--disable-assembly</samp>.
|
|
</p>
|
|
<p>Note that this will run quite slowly, but it should be portable and should at
|
|
least make it possible to get something running if all else fails.
|
|
</p>
|
|
</dd>
|
|
<dt>Fat binary, <samp>--enable-fat</samp></dt>
|
|
<dd><a name="index-Fat-binary"></a>
|
|
<a name="index-_002d_002denable_002dfat"></a>
|
|
<p>Using <samp>--enable-fat</samp> selects a “fat binary” build on x86, where
|
|
optimized low level subroutines are chosen at runtime according to the CPU
|
|
detected. This means more code, but gives good performance on all x86 chips.
|
|
(This option might become available for more architectures in the future.)
|
|
</p>
|
|
</dd>
|
|
<dt><samp>ABI</samp></dt>
|
|
<dd><a name="index-ABI"></a>
|
|
<p>On some systems GMP supports multiple ABIs (application binary interfaces),
|
|
meaning data type sizes and calling conventions. By default GMP chooses the
|
|
best ABI available, but a particular ABI can be selected. For example
|
|
</p>
|
|
<div class="example">
|
|
<pre class="example">./configure --host=mips64-sgi-irix6 ABI=n32
|
|
</pre></div>
|
|
|
|
<p>See <a href="ABI-and-ISA.html#ABI-and-ISA">ABI and ISA</a>, for the available choices on relevant CPUs, and what
|
|
applications need to do.
|
|
</p>
|
|
</dd>
|
|
<dt><samp>CC</samp>, <samp>CFLAGS</samp></dt>
|
|
<dd><a name="index-C-compiler"></a>
|
|
<a name="index-CC"></a>
|
|
<a name="index-CFLAGS"></a>
|
|
<p>By default the C compiler used is chosen from among some likely candidates,
|
|
with <code>gcc</code> normally preferred if it’s present. The usual
|
|
‘<samp>CC=whatever</samp>’ can be passed to ‘<samp>./configure</samp>’ to choose something
|
|
different.
|
|
</p>
|
|
<p>For various systems, default compiler flags are set based on the CPU and
|
|
compiler. The usual ‘<samp>CFLAGS="-whatever"</samp>’ can be passed to
|
|
‘<samp>./configure</samp>’ to use something different or to set good flags for systems
|
|
GMP doesn’t otherwise know.
|
|
</p>
|
|
<p>The ‘<samp>CC</samp>’ and ‘<samp>CFLAGS</samp>’ used are printed during ‘<samp>./configure</samp>’,
|
|
and can be found in each generated <samp>Makefile</samp>. This is the easiest way
|
|
to check the defaults when considering changing or adding something.
|
|
</p>
|
|
<p>Note that when ‘<samp>CC</samp>’ and ‘<samp>CFLAGS</samp>’ are specified on a system
|
|
supporting multiple ABIs it’s important to give an explicit
|
|
‘<samp>ABI=whatever</samp>’, since GMP can’t determine the ABI just from the flags and
|
|
won’t be able to select the correct assembly code.
|
|
</p>
|
|
<p>If just ‘<samp>CC</samp>’ is selected then normal default ‘<samp>CFLAGS</samp>’ for that
|
|
compiler will be used (if GMP recognises it). For example ‘<samp>CC=gcc</samp>’ can
|
|
be used to force the use of GCC, with default flags (and default ABI).
|
|
</p>
|
|
</dd>
|
|
<dt><samp>CPPFLAGS</samp></dt>
|
|
<dd><a name="index-CPPFLAGS"></a>
|
|
<p>Any flags like ‘<samp>-D</samp>’ defines or ‘<samp>-I</samp>’ includes required by the
|
|
preprocessor should be set in ‘<samp>CPPFLAGS</samp>’ rather than ‘<samp>CFLAGS</samp>’.
|
|
Compiling is done with both ‘<samp>CPPFLAGS</samp>’ and ‘<samp>CFLAGS</samp>’, but
|
|
preprocessing uses just ‘<samp>CPPFLAGS</samp>’. This distinction is because most
|
|
preprocessors won’t accept all the flags the compiler does. Preprocessing is
|
|
done separately in some configure tests.
|
|
</p>
|
|
</dd>
|
|
<dt><samp>CC_FOR_BUILD</samp></dt>
|
|
<dd><a name="index-CC_005fFOR_005fBUILD"></a>
|
|
<p>Some build-time programs are compiled and run to generate host-specific data
|
|
tables. ‘<samp>CC_FOR_BUILD</samp>’ is the compiler used for this. It doesn’t need
|
|
to be in any particular ABI or mode, it merely needs to generate executables
|
|
that can run. The default is to try the selected ‘<samp>CC</samp>’ and some likely
|
|
candidates such as ‘<samp>cc</samp>’ and ‘<samp>gcc</samp>’, looking for something that works.
|
|
</p>
|
|
<p>No flags are used with ‘<samp>CC_FOR_BUILD</samp>’ because a simple invocation like
|
|
‘<samp>cc foo.c</samp>’ should be enough. If some particular options are required
|
|
they can be included as for instance ‘<samp>CC_FOR_BUILD="cc -whatever"</samp>’.
|
|
</p>
|
|
</dd>
|
|
<dt>C++ Support, <samp>--enable-cxx</samp></dt>
|
|
<dd><a name="index-C_002b_002b-support"></a>
|
|
<a name="index-_002d_002denable_002dcxx"></a>
|
|
<p>C++ support in GMP can be enabled with ‘<samp>--enable-cxx</samp>’, in which case a
|
|
C++ compiler will be required. As a convenience ‘<samp>--enable-cxx=detect</samp>’
|
|
can be used to enable C++ support only if a compiler can be found. The C++
|
|
support consists of a library <samp>libgmpxx.la</samp> and header file
|
|
<samp>gmpxx.h</samp> (see <a href="Headers-and-Libraries.html#Headers-and-Libraries">Headers and Libraries</a>).
|
|
</p>
|
|
<p>A separate <samp>libgmpxx.la</samp> has been adopted rather than having C++ objects
|
|
within <samp>libgmp.la</samp> in order to ensure dynamic linked C programs aren’t
|
|
bloated by a dependency on the C++ standard library, and to avoid any chance
|
|
that the C++ compiler could be required when linking plain C programs.
|
|
</p>
|
|
<p><samp>libgmpxx.la</samp> will use certain internals from <samp>libgmp.la</samp> and can
|
|
only be expected to work with <samp>libgmp.la</samp> from the same GMP version.
|
|
Future changes to the relevant internals will be accompanied by renaming, so a
|
|
mismatch will cause unresolved symbols rather than perhaps mysterious
|
|
misbehaviour.
|
|
</p>
|
|
<p>In general <samp>libgmpxx.la</samp> will be usable only with the C++ compiler that
|
|
built it, since name mangling and runtime support are usually incompatible
|
|
between different compilers.
|
|
</p>
|
|
</dd>
|
|
<dt><samp>CXX</samp>, <samp>CXXFLAGS</samp></dt>
|
|
<dd><a name="index-C_002b_002b-compiler"></a>
|
|
<a name="index-CXX"></a>
|
|
<a name="index-CXXFLAGS"></a>
|
|
<p>When C++ support is enabled, the C++ compiler and its flags can be set with
|
|
variables ‘<samp>CXX</samp>’ and ‘<samp>CXXFLAGS</samp>’ in the usual way. The default for
|
|
‘<samp>CXX</samp>’ is the first compiler that works from a list of likely candidates,
|
|
with <code>g++</code> normally preferred when available. The default for
|
|
‘<samp>CXXFLAGS</samp>’ is to try ‘<samp>CFLAGS</samp>’, ‘<samp>CFLAGS</samp>’ without ‘<samp>-g</samp>’, then
|
|
for <code>g++</code> either ‘<samp>-g -O2</samp>’ or ‘<samp>-O2</samp>’, or for other compilers
|
|
‘<samp>-g</samp>’ or nothing. Trying ‘<samp>CFLAGS</samp>’ this way is convenient when using
|
|
‘<samp>gcc</samp>’ and ‘<samp>g++</samp>’ together, since the flags for ‘<samp>gcc</samp>’ will
|
|
usually suit ‘<samp>g++</samp>’.
|
|
</p>
|
|
<p>It’s important that the C and C++ compilers match, meaning their startup and
|
|
runtime support routines are compatible and that they generate code in the
|
|
same ABI (if there’s a choice of ABIs on the system). ‘<samp>./configure</samp>’
|
|
isn’t currently able to check these things very well itself, so for that
|
|
reason ‘<samp>--disable-cxx</samp>’ is the default, to avoid a build failure due to a
|
|
compiler mismatch. Perhaps this will change in the future.
|
|
</p>
|
|
<p>Incidentally, it’s normally not good enough to set ‘<samp>CXX</samp>’ to the same as
|
|
‘<samp>CC</samp>’. Although <code>gcc</code> for instance recognises <samp>foo.cc</samp> as
|
|
C++ code, only <code>g++</code> will invoke the linker the right way when
|
|
building an executable or shared library from C++ object files.
|
|
</p>
|
|
</dd>
|
|
<dt>Temporary Memory, <samp>--enable-alloca=<choice></samp></dt>
|
|
<dd><a name="index-Temporary-memory"></a>
|
|
<a name="index-Stack-overflow"></a>
|
|
<a name="index-alloca"></a>
|
|
<a name="index-_002d_002denable_002dalloca"></a>
|
|
<p>GMP allocates temporary workspace using one of the following three methods,
|
|
which can be selected with for instance
|
|
‘<samp>--enable-alloca=malloc-reentrant</samp>’.
|
|
</p>
|
|
<ul>
|
|
<li> ‘<samp>alloca</samp>’ - C library or compiler builtin.
|
|
</li><li> ‘<samp>malloc-reentrant</samp>’ - the heap, in a re-entrant fashion.
|
|
</li><li> ‘<samp>malloc-notreentrant</samp>’ - the heap, with global variables.
|
|
</li></ul>
|
|
|
|
<p>For convenience, the following choices are also available.
|
|
‘<samp>--disable-alloca</samp>’ is the same as ‘<samp>no</samp>’.
|
|
</p>
|
|
<ul>
|
|
<li> ‘<samp>yes</samp>’ - a synonym for ‘<samp>alloca</samp>’.
|
|
</li><li> ‘<samp>no</samp>’ - a synonym for ‘<samp>malloc-reentrant</samp>’.
|
|
</li><li> ‘<samp>reentrant</samp>’ - <code>alloca</code> if available, otherwise
|
|
‘<samp>malloc-reentrant</samp>’. This is the default.
|
|
</li><li> ‘<samp>notreentrant</samp>’ - <code>alloca</code> if available, otherwise
|
|
‘<samp>malloc-notreentrant</samp>’.
|
|
</li></ul>
|
|
|
|
<p><code>alloca</code> is reentrant and fast, and is recommended. It actually allocates
|
|
just small blocks on the stack; larger ones use malloc-reentrant.
|
|
</p>
|
|
<p>‘<samp>malloc-reentrant</samp>’ is, as the name suggests, reentrant and thread safe,
|
|
but ‘<samp>malloc-notreentrant</samp>’ is faster and should be used if reentrancy is
|
|
not required.
|
|
</p>
|
|
<p>The two malloc methods in fact use the memory allocation functions selected by
|
|
<code>mp_set_memory_functions</code>, these being <code>malloc</code> and friends by
|
|
default. See <a href="Custom-Allocation.html#Custom-Allocation">Custom Allocation</a>.
|
|
</p>
|
|
<p>An additional choice ‘<samp>--enable-alloca=debug</samp>’ is available, to help when
|
|
debugging memory related problems (see <a href="Debugging.html#Debugging">Debugging</a>).
|
|
</p>
|
|
</dd>
|
|
<dt>FFT Multiplication, <samp>--disable-fft</samp></dt>
|
|
<dd><a name="index-FFT-multiplication"></a>
|
|
<a name="index-_002d_002ddisable_002dfft"></a>
|
|
<p>By default multiplications are done using Karatsuba, 3-way Toom, higher degree
|
|
Toom, and Fermat FFT. The FFT is only used on large to very large operands
|
|
and can be disabled to save code size if desired.
|
|
</p>
|
|
</dd>
|
|
<dt>Assertion Checking, <samp>--enable-assert</samp></dt>
|
|
<dd><a name="index-Assertion-checking"></a>
|
|
<a name="index-_002d_002denable_002dassert"></a>
|
|
<p>This option enables some consistency checking within the library. This can be
|
|
of use while debugging, see <a href="Debugging.html#Debugging">Debugging</a>.
|
|
</p>
|
|
</dd>
|
|
<dt>Execution Profiling, <samp>--enable-profiling=prof/gprof/instrument</samp></dt>
|
|
<dd><a name="index-Execution-profiling"></a>
|
|
<a name="index-_002d_002denable_002dprofiling"></a>
|
|
<p>Enable profiling support, in one of various styles, see <a href="Profiling.html#Profiling">Profiling</a>.
|
|
</p>
|
|
</dd>
|
|
<dt><samp>MPN_PATH</samp></dt>
|
|
<dd><a name="index-MPN_005fPATH"></a>
|
|
<p>Various assembly versions of each mpn subroutines are provided. For a given
|
|
CPU, a search is made though a path to choose a version of each. For example
|
|
‘<samp>sparcv8</samp>’ has
|
|
</p>
|
|
<div class="example">
|
|
<pre class="example">MPN_PATH="sparc32/v8 sparc32 generic"
|
|
</pre></div>
|
|
|
|
<p>which means look first for v8 code, then plain sparc32 (which is v7), and
|
|
finally fall back on generic C. Knowledgeable users with special requirements
|
|
can specify a different path. Normally this is completely unnecessary.
|
|
</p>
|
|
</dd>
|
|
<dt>Documentation</dt>
|
|
<dd><a name="index-Documentation-formats"></a>
|
|
<a name="index-Texinfo"></a>
|
|
<p>The source for the document you’re now reading is <samp>doc/gmp.texi</samp>, in
|
|
Texinfo format, see <a href="http://www.gnu.org/software/texinfo/manual/texinfo/html_node/index.html#Top">Texinfo</a> in <cite>Texinfo</cite>.
|
|
</p>
|
|
<a name="index-Postscript"></a>
|
|
<a name="index-DVI"></a>
|
|
<a name="index-PDF"></a>
|
|
<p>Info format ‘<samp>doc/gmp.info</samp>’ is included in the distribution. The usual
|
|
automake targets are available to make PostScript, DVI, PDF and HTML (these
|
|
will require various TeX and Texinfo tools).
|
|
</p>
|
|
<a name="index-DocBook"></a>
|
|
<a name="index-XML"></a>
|
|
<p>DocBook and XML can be generated by the Texinfo <code>makeinfo</code> program
|
|
too, see <a href="http://www.gnu.org/software/texinfo/manual/texinfo/html_node/makeinfo-options.html#makeinfo-options">Options for <code>makeinfo</code></a> in <cite>Texinfo</cite>.
|
|
</p>
|
|
<p>Some supplementary notes can also be found in the <samp>doc</samp> subdirectory.
|
|
</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
<hr>
|
|
<div class="header">
|
|
<p>
|
|
Next: <a href="ABI-and-ISA.html#ABI-and-ISA" accesskey="n" rel="next">ABI and ISA</a>, Previous: <a href="Installing-GMP.html#Installing-GMP" accesskey="p" rel="prev">Installing GMP</a>, Up: <a href="Installing-GMP.html#Installing-GMP" accesskey="u" rel="up">Installing GMP</a> [<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
|
|
</div>
|
|
|
|
|
|
|
|
</body>
|
|
</html>
|