manpagez: man pages & more
info mpc
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2 Installing GNU MPC

To build GNU MPC, you first have to install GNU MP (version 4.3.2 or higher) and GNU MPFR (version 2.4.2 or higher) on your computer. You need a C compiler; GCC version 4.4 or higher is recommended, since GNU MPC may trigger a bug in previous versions, see the thread at And you need a standard Unix ‘make’ program, plus some other standard Unix utility programs.

Here are the steps needed to install the library on Unix systems:

  1. tar xzf mpc-1.0.1.tar.gz
  2. cd mpc-1.0.1
  3. ./configure

    if GMP and GNU MPFR are installed into standard directories, that is, directories that are searched by default by the compiler and the linking tools.

    ./configure --with-gmp=<gmp_install_dir>

    is used to indicate a different location where GMP is installed. Alternatively, you can specify directly GMP include and GMP lib directories with ‘./configure --with-gmp-lib=<gmp_lib_dir> --with-gmp-include=<gmp_include_dir>’.

    ./configure --with-mpfr=<mpfr_install_dir>

    is used to indicate a different location where GNU MPFR is installed. Alternatively, you can specify directly GNU MPFR include and GNU MPFR lib directories with ‘./configure --with-mpf-lib=<mpfr_lib_dir> --with-mpfr-include=<mpfr_include_dir>’.

    Another useful parameter is ‘--prefix’, which can be used to specify an alternative installation location instead of ‘/usr/local’; see ‘make install’ below.

    To enable checking for memory leaks using valgrind during make check, add the parameter --enable-valgrind-tests.

    If for debugging purposes you wish to log calls to GNU MPC functions from within your code, add the parameter ‘--enable-logging’. In your code, replace the inclusion of ‘mpc.h’ by ‘mpc-log.h’ and link the executable dynamically. Then all calls to functions with only complex arguments are printed to ‘stderr’ in the following form: First, the function name is given, followed by its type such as ‘c_cc’, meaning that the function has one complex result (one ‘c’ in front of the ‘_’), computed from two complex arguments (two ‘c’ after the ‘_’). Then, the precisions of the real and the imaginary part of the first result is given, followed by the second one and so on. Finally, for each argument, the precisions of its real and imaginary part are specified and the argument itself is printed in hexadecimal via the function mpc_out_str (see section String and Stream Input and Output). The option requires a dynamic library, so it may not be combined with --disable-shared.

    Use ‘./configure --help’ for an exhaustive list of parameters.

  4. make

    This compiles GNU MPC in the working directory.

  5. make check

    This will make sure GNU MPC was built correctly.

    If you get error messages, please report them to ‘’ (See section Reporting Bugs, for information on what to include in useful bug reports).

  6. make install

    This will copy the file ‘mpc.h’ to the directory ‘/usr/local/include’, the file ‘libmpc.a’ to the directory ‘/usr/local/lib’, and the file ‘’ to the directory ‘/usr/local/share/info’ (or if you passed the ‘--prefix’ option to ‘configure’, using the prefix directory given as argument to ‘--prefix’ instead of ‘/usr/local’). Note: you need write permissions on these directories.

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on September 15, 2012 using texi2html 5.0.

© 2000-2017
Individual documents may contain additional copyright information.