Prerequisites
=============

The current version of `msolve` does not support 32 bit architectures.

If you are working with the git repository OR the *tar.gz from github
=====================================================================

NOTE: You need to have autotools installed on your system.

1. Run `./autogen.sh` which generates configure and the Makefiles.
2. Run `./configure` (possibly with options, see `./configure -h` for
   more information).
3. Run `make` (possibly with CFLAGS and LDFLAGS adjusted).
4. Run `make check`.
5. Run `make install` in order to globally install the library and the binary
   of msolve.



If you are working on a distribution, e.g. the PRECONFIGURED *.tar.gz from
msolve.lip6.fr (note this *.tar.gz differs from the unconfigured one provided
via github releases)
==========================================================

1. Run `./configure` (possibly with options, see `./configure --help` for more
   information).
2. Run `make` (possibly with CFLAGS and LDFLAGS adjusted).
3. Run `make check`.
4. Run `make install` in order to globally install the library and the binary
   of msolve.

Note to macOS users
===================

On macOS, we recommend building msolve with LLVM Clang rather than Apple Clang,
as LLVM Clang provides better OpenMP support. You can install LLVM Clang and
the required dependencies with Homebrew:

```shell
brew install autoconf automake flint gmp libomp libtool llvm mpfr
```

Before building as described above, make sure to set these environment
variables so the build uses the correct compiler and flags:

```shell
export CC="$(brew --prefix llvm)/bin/clang"
export CFLAGS="-I$(brew --prefix)/include -I$(brew --prefix libomp)/include"
export LDFLAGS="-L$(brew --prefix)/lib -L$(brew --prefix libomp)/lib"
```

If you choose to use Apple Clang while linking against Homebrew's `libomp`
(note that this setup is not officially supported), set the environment
variables as follows:

```shell
export CC="/usr/bin/clang"
export CFLAGS="-I$(brew --prefix)/include -I$(brew --prefix libomp)/include"
export CPPFLAGS="-Xpreprocessor -fopenmp"
export LDFLAGS="-L$(brew --prefix)/lib -L$(brew --prefix libomp)/lib -lomp"
```

For other compiler toolchains, such as GCC, make sure only one OpenMP runtime
is linked. You can verify this with

```shell
otool -L path/to/libmsolve.dylib
```

If both `libomp` (LLVM's OpenMP runtime) and `libgomp` (GCC's OpenMP runtime)
are listed, rebuild with a consistent toolchain and matching linker flags.

If you want to generate a distribution
======================================

Run `make dist`.



If you want to generate a static binary
=======================================

Add `-all-static` to your LDFLAGS as follows `make LDFLAGS="-all-static"`.
