Permalink
Browse files

Switch between gmp and mpir.

  • Loading branch information...
lgremy committed Dec 18, 2017
1 parent 292f8b9 commit 7a190c9e0c57d5de92e0d0e66f62d81274eb2ed4
Showing with 53 additions and 31 deletions.
  1. +12 −14 README.md
  2. +31 −12 configure.ac
  3. +1 −1 fplll.pc.in
  4. +1 −1 fplll/Makefile.am
  5. +6 −1 fplll/defs.h
  6. +2 −2 tests/Makefile.am
@@ -54,24 +54,11 @@ fplll is distributed under the [GNU Lesser General Public License](COPYING) (eit
### Required ###
- GNU MP 4.2.0 or higher [http://gmplib.org/](http://gmplib.org/)
- GNU MP 4.2.0 or higher [http://gmplib.org/](http://gmplib.org/) or MPIR 1.0.0 or higher [http://mpir.org](http://mpir.org)
- MPFR 2.3.0 or higher, COMPLETE INSTALLATION [http://www.mpfr.org/](http://www.mpfr.org/)
- autotools 2.61 or higher
- g++ 4.9.3 or higher
If GMP and/or MPFR include and lib files are not in the default directories `/usr/include` and
`/usr/lib`, you have to set the environment variables `CFLAGS` and `LDFLAGS` for instance through the
configure command line
./configure CPPFLAGS="-I/mpfrinclude -I/gmpinclude" LDFLAGS="-L/mpfrlib -L/gmplib"
or
./configure CPPFLAGS="-I/mpfrinclude -I/gmpinclude $CPPFLAGD" LDFLAGS="-L/mpfrlib -L/gmplib $LDFLAGS"
if these variables already exist in your environment. This should be modified soon for using
standard `--with-gmp` and `--with-mpfr` package specifications. The same philosophy applies to the
(optional) QD library.
### Optional ###
- QD 2.3.15 or higher (a C++/Fortran-90 double-double and quad-double package), compile and install
@@ -93,6 +80,17 @@ Then, to compile and install type
make
make install # (as root)
If GMP, MPFR and/or MPIR are not in the `$LD_LIBRARY_PATH`, you have to point to the directories where the libraries are, with
./configure --with-gmp=/path/to/gmp
or
./configure --with-mpfr=/path/to/mpfr
The same philosophy applies to the (optional) QD library. If you want to use
mpir instead of gmp, use `--enable-mpir`.
You can remove the program binaries and object files from the source code directory by typing `make
clean`. To also remove the files that `./configure` created (so you can compile the package for a
different kind of computer), type `make distclean`. By default, `make install` installs the package
@@ -56,18 +56,37 @@ AC_PROG_MAKE_SET
AX_CXX_COMPILE_STDCXX([11],[noext],[mandatory])
# Checks for libraries.
AC_ARG_WITH(mpir,
AS_HELP_STRING([--with-mpir=@<:@=DIR@:>@], [GMP install directory]), [
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
mpir_lib_path="$withval/lib"
])
AC_CHECK_LIB(mpir, __gmpz_init, , [AC_MSG_ERROR(
[MPIR not found, see http://mpir.org])])
AC_CHECK_LIB(mpir, __gmp_get_memory_functions, , [AC_MSG_ERROR(
[MPIR version too old, need >= 1.0.0, see http://mpir.org])])
AC_ARG_ENABLE(mpir,
AS_HELP_STRING([--enable-mpir],
[Enable MPIR instead of GMP]))
AS_IF([test "x$enable_mpir" = "xyes"], [
AC_ARG_WITH(mpir,
AS_HELP_STRING([--with-mpir=@<:@=DIR@:>@], [MPIR install directory]), [
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
mpir_lib_path="$withval/lib"
])
AC_CHECK_LIB(mpir, __gmpz_init, , [AC_MSG_ERROR(
[MPIR not found, see http://mpir.org])])
AC_CHECK_LIB(mpir, __gmp_get_memory_functions, , [AC_MSG_ERROR(
[MPIR version too old, need >= 1.0.0, see http://mpir.org])])
LIBGMP="-lmpir"
])
AS_IF([test "x$enable_mpir" != "xyes"], [
AC_ARG_WITH(gmp,
AS_HELP_STRING([--with-gmp=@<:@=DIR@:>@], [GMP install directory]), [
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
mpir_lib_path="$withval/lib"
])
AC_CHECK_LIB(gmp, __gmpz_init, , [AC_MSG_ERROR(
[GNU MP not found, see http://mpir.org])])
AC_CHECK_LIB(gmp, __gmp_get_memory_functions, , [AC_MSG_ERROR(
[GMP version too old, need >= 4.2.0, see http://gmplib.org])])
LIBGMP="-lgmp"
])
AC_ARG_WITH(mpfr,
AS_HELP_STRING([--with-mpfr=@<:@=DIR@:>@], [MPFR install directory]), [
@@ -6,4 +6,4 @@ includedir=@includedir@
Name: @PACKAGE_NAME@
Description: lattice algorithms with floating-point computations
Version: @PACKAGE_VERSION@
Libs: -L${libdir} @LIBQD_LIBADD@ -lmpir -lmpfr -lfplll
Libs: -L${libdir} @LIBQD_LIBADD@ @LIBGMP@ -lmpfr -lfplll
@@ -93,7 +93,7 @@ libfplll_la_SOURCES=fplll.cpp fplll.h \
sieve/sampler_basic.cpp
EXTRA_libfplll_la_SOURCES= svpcvp.cpp
libfplll_la_LIBADD=-lmpir -lmpfr $(LIBQD_LIBADD)
libfplll_la_LIBADD=$(LIBGMP) -lmpfr $(LIBQD_LIBADD)
libfplll_la_LDFLAGS=-no-undefined -version-info @FPLLL_LT_CURRENT@:@FPLLL_LT_REVISION@:@FPLLL_LT_AGE@
libfplllv_la_SOURCES=$(libfplll_la_SOURCES)
@@ -50,8 +50,13 @@
#endif
#include "fplll_config.h"
#include <mpfr.h>
#ifdef HAVE_LIBMPIR
#include <mpir.h>
#endif
#ifdef HAVE_LIBGMP
#include <gmp.h>
#endif
#include <mpfr.h>
#ifdef FPLLL_WITH_DPE
#include "nr/dpe.h"
#endif
@@ -39,8 +39,8 @@ AM_LDFLAGS = -L$(STAGEDIR) -Wl,-rpath,$(STAGEDIR) -lfplll -no-install $(LIBQD_LI
TESTS = test_nr test_lll test_cvp test_svp test_bkz test_pruner test_sieve test_gso test_lll_gram
test_pruner_LDADD=-lmpir -lmpfr $(LIBQD_LIBADD)
test_sieve_LDADD=-lmpir -lmpfr $(LIBQD_LIBADD)
test_pruner_LDADD=$(LIBGMP) -lmpfr $(LIBQD_LIBADD)
test_sieve_LDADD=$(LIBGMP) -lmpfr $(LIBQD_LIBADD)
test_nr_SOURCES = test_nr.cpp
test_lll_SOURCES = test_lll.cpp

0 comments on commit 7a190c9

Please sign in to comment.