Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Trac #27265: Add spkg-configure.m4 for ntl
Browse files Browse the repository at this point in the history
Includes SAGE_NTL_PREFIX and NTL_CONFIGURE variables in sage-env-config for use
by flint or other packages that look for ntl at configure time.
  • Loading branch information
dimpase committed May 22, 2019
1 parent 32b79af commit b986753
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 5 deletions.
5 changes: 4 additions & 1 deletion build/pkgs/barvinok/spkg-install
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ cd src
if [ -n "$SAGE_GMP_PREFIX" ]; then
GMP_CONFIGURE="--with-gmp-prefix=$SAGE_GMP_PREFIX"
fi
if [ -n "$SAGE_NTL_PREFIX" ]; then
NTL_CONFIGURE="--with-ntl-prefix=$SAGE_NTL_PREFIX"
fi

sdh_configure $GMP_CONFIGURE \
--with-ntl-prefix=${SAGE_LOCAL} \
$NTL_CONFIGURE \
--with-isl=system \
--with-polylib=system \
--enable-shared-barvinok
Expand Down
2 changes: 1 addition & 1 deletion build/pkgs/eclib/spkg-install
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ rm -rf "$SAGE_LOCAL"/include/eclib/
cd src/


sdh_configure --with-ntl="$SAGE_LOCAL" \
sdh_configure $SAGE_CONFIGURE_NTL \
--with-pari="$SAGE_LOCAL" \
--with-flint="$SAGE_LOCAL" \
--with-boost="no" \
Expand Down
2 changes: 1 addition & 1 deletion build/pkgs/flint/spkg-install
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ echo "Configuring FLINT."
--prefix="$SAGE_LOCAL" \
$SAGE_CONFIGURE_GMP \
$SAGE_CONFIGURE_MPFR \
--with-ntl="$SAGE_LOCAL" \
$SAGE_CONFIGURE_NTL \
$FLINT_CONFIGURE || sdh_die "Error: Failed to configure FLINT."

sdh_make verbose
Expand Down
2 changes: 1 addition & 1 deletion build/pkgs/latte_int/spkg-install
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cd src

sdh_configure --enable-shared=yes --enable-static=false \
$SAGE_CONFIGURE_GMP --with-ntl=$SAGE_LOCAL \
$SAGE_CONFIGURE_GMP $SAGE_CONFIGURE_NTL \
--with-cddlib=$SAGE_LOCAL --with-4ti2=$SAGE_LOCAL \
--with-lidia=$SAGE_LOCAL
sdh_make
Expand Down
48 changes: 48 additions & 0 deletions build/pkgs/ntl/spkg-configure.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
SAGE_SPKG_CONFIGURE([ntl], [
AC_REQUIRE([SAGE_SPKG_CONFIGURE_GMP])
AC_MSG_CHECKING([installing gmp/mpir? ])
if test x$sage_spkg_install_mpir = xyes -o x$sage_spkg_install_gmp = xyes; then
AC_MSG_RESULT([yes; install ntl as well])
sage_spkg_install_ntl=yes
else
AC_MSG_RESULT([no])
fi
m4_pushdef(SAGE_NTL_VERSION_MAJOR, [10])
m4_pushdef(SAGE_NTL_VERSION_MINOR, [3])
if test x$sage_spkg_install_ntl != xyes; then
AC_CHECK_HEADER([NTL/ZZ.h], [], [sage_spkg_install_ntl=yes])
AC_MSG_CHECKING([whether we can link a program using NTL])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[#include <NTL/ZZ.h>]],
[[NTL::ZZ a;]]
)], [AC_MSG_RESULT([yes])], [
AC_MSG_RESULT([no]); sage_spkg_install_ntl=yes
])
AC_MSG_CHECKING([NTL version >= ]SAGE_NTL_VERSION_MAJOR[.]SAGE_NTL_VERSION_MINOR)
AC_RUN_IFELSE([
AC_LANG_PROGRAM(
[[#include <NTL/version.h>
#include <stdio.h>
]], [[
printf("%s\n", NTL_VERSION);
if (NTL_MAJOR_VERSION >]] SAGE_NTL_VERSION_MAJOR[[) return 0;
else if (NTL_MAJOR_VERSION ==]] SAGE_NTL_VERSION_MAJOR[[ &&
NTL_MINOR_VERSION >=]] SAGE_NTL_VERSION_MINOR[[) return 0;
else return 1;
]])], [], [sage_spkg_install_ntl=yes])
fi
m4_popdef([SAGE_NTL_VERSION_MAJOR])
m4_popdef([SAGE_NTL_VERSION_MINOR])
], [], [], [
if test x$sage_spkg_install_ntl = xyes; then
AC_SUBST(SAGE_NTL_PREFIX, ['$SAGE_LOCAL'])
AC_MSG_RESULT([using Sage's ntl SPKG])
else
AC_SUBST(SAGE_NTL_PREFIX, [''])
AC_MSG_RESULT([using ntl library from the system])
fi
])

2 changes: 1 addition & 1 deletion build/pkgs/singular/spkg-install
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ config()
sdh_configure --exec-prefix="$SAGE_LOCAL" \
--bindir="$SAGE_LOCAL/bin" \
$SAGE_CONFIGURE_GMP \
--with-ntl="$SAGE_LOCAL" \
$SAGE_CONFIGURE_NTL \
--with-flint="$SAGE_LOCAL" \
--enable-gfanlib \
--enable-Singular \
Expand Down
10 changes: 10 additions & 0 deletions src/bin/sage-env-config.in
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,13 @@ if [ -n "$SAGE_MPC_PREFIX" ]; then
# their ./configure scripts. Thus we deal with this just as with GMP above.
export SAGE_CONFIGURE_MPC="--with-mpc=$SAGE_MPC_PREFIX"
fi

# This is usually blank if the system NTL is used, or $SAGE_LOCAL otherwise
export SAGE_NTL_PREFIX="@SAGE_NTL_PREFIX@"
if [ -n "$SAGE_NTL_PREFIX" ]; then
# Many packages that depend on NTL accept a --with-ntl=<prefix> flag to
# their ./configure scripts. When using the system's NTL this is not
# generally necessary, but when using the NTL package installed in
# SAGE_LOCAL it is useful to pass it.
export SAGE_CONFIGURE_NTL="--with-ntl=$SAGE_NTL_PREFIX"
fi

0 comments on commit b986753

Please sign in to comment.