Go to the first, previous, next, last section, table of contents.


Build Options

All the usual autoconf configure options are available, run `./configure --help' for a summary.

Non-Unix Systems
`configure' needs various Unix-like tools installed. On an MS-DOS system cygwin or djgpp should work. It might be possible to build without the help of `configure', certainly all the code is there, but unfortunately you'll be on your own.
Object Directory
To compile in a separate object directory, cd to that directory, and prefix the configure command with the path to the GMP source directory. For example `../src/gmp/configure'. Not all `make' programs have the necessary features (VPATH) to support this. In particular, SunOS and Slowaris make have bugs that make them unable to build from a separate object directory. Use GNU make instead.
@option{--disable-shared, @option{--disable-static}}
By default both shared and static libraries are built (where possible), but one or other can be disabled. Shared libraries are very slightly slower, having a small cost on each function call, but result in smaller executables and permit code sharing between separate running processes.
@option{--target=CPU-VENDOR-OS}
The build target can be specified in the usual way, for either native or cross compilation. If @option{--target} isn't given, `./configure' builds for the host system as determined by `./config.guess'. On some systems this can't distinguish between different CPUs in a family, and you should check the guess. Running `./config.guess' on the target system will also show the relevant `VENDOR-OS', if you don't already know what it should be. 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. The following CPU targets have specific assembly code support. See `configure.in' for which `mpn' subdirectories get used by each. CPUs not listed use generic C code. If some of the assembly code causes problems, the generic C code can be selected with CPU `none'.
@option{CC, @option{CFLAGS}}
The C compiler used is chosen from among some likely candidates, with GCC normally preferred if it's present. The usual `CC=whatever' can be passed to `./configure' to choose something different. For some configurations specific compiler flags are set based on the target CPU and compiler, see `CFLAGS' in the generated `Makefile's. The usual `CFLAGS="-whatever"' can be passed to `./configure' to use something different or to set good flags for systems GMP doesn't otherwise know. Note that if `CC' is set then `CFLAGS' must also be set. This applies even if `CC' is merely one of the choices GMP would make itself. This may change in a future release.
@option{--disable-alloca}
By default, GMP allocates temporary workspace using alloca if that function is available, or malloc if not. If you're working with large numbers and alloca overflows the available stack space, you can build with @option{--disable-alloca} to use malloc instead. malloc will probably be slightly slower than alloca. When not using alloca, it's actually the allocation function selected with mp_set_memory_functions that's used, this being malloc by default. See section Custom Allocation. Depending on your system, the only indication of stack overflow might be a segmentation violation. It might be possible to increase available stack space with limit, ulimit or setrlimit, or under DJGPP with stubedit or _stklen.
@option{--enable-fft}
By default multiplications are done using Karatsuba and 3-way Toom-Cook algorithms, but a Fermat FFT can be enabled, for use on large to very large operands. Currently the FFT is recommended only for knowledgeable users who check the algorithm thresholds for their CPU.
@option{--enable-mpbsd}
The Berkeley MP compatibility library (`libmp.a') and header file (`mp.h') are built and installed only if @option{--enable-mpbsd} is used. See section Berkeley MP Compatible Functions.
@option{MPN_PATH}
Various assembler versions of mpn subroutines are provided, and, for a given CPU target, a search is made though a path to choose a version of each. For example `sparcv8' has path `"sparc32/v8 sparc32 generic"', which means it looks first for v8 code, falls back on plain sparc32, and finally falls back on generic C. Knowledgeable users with special requirements can specify a path with `MPN_PATH="dir list"'. This will normally be unnecessary because all sensible paths should be available under one or other CPU target.
Demonstration Programs
The `demos' subdirectory has some sample programs using GMP. These aren't built or installed, but there's a `Makefile' with rules for them. For instance, `make pexpr' and then `./pexpr 68^975+10'.
Documentation
The document you're now reading is `gmp.texi'. The usual automake targets are available to make `gmp.ps' and/or `gmp.dvi'. Some supplementary notes can be found in the `doc' subdirectory.


Go to the first, previous, next, last section, table of contents.