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

Commit

Permalink
Refactor the mpir/spkg-configure.m4 (and to a lesser extent the one f…
Browse files Browse the repository at this point in the history
…or gmp) to use the new pre and post arguments to SAGE_SPKG_CONFIGURE

This allows us to ensure that certain actions (such as providing a default
value for SAGE_MP_LIBRARY) are always performed by the configure script even if
the SPKG will not otherwise be installed for some reason (e.g. due to skipping
a configure check).
  • Loading branch information
embray committed May 10, 2019
1 parent d9bbdd4 commit a360518
Showing 1 changed file with 30 additions and 20 deletions.
50 changes: 30 additions & 20 deletions build/pkgs/mpir/spkg-configure.m4
Original file line number Diff line number Diff line change
@@ -1,22 +1,4 @@
SAGE_SPKG_CONFIGURE([mpir], [
AC_ARG_WITH([mp],
[AS_HELP_STRING([--with-mp=system],
[use the system GMP as multiprecision library, if possible (default)])]
[AS_HELP_STRING([--with-mp=mpir],
[use the Sage SPKG for MPIR as multiprecision library])]
[AS_HELP_STRING([--with-mp=gmp],
[use the Sage SPKG for GMP as multiprecision library])])
dnl Just part the options here
case "$with_mp" in
system) ;;
MPIR|mpir) with_mp=mpir;;
GMP|gmp) with_mp=gmp;;
"") with_mp=system;;
*)
AC_MSG_ERROR([allowed values for --with-mp are system, mpir, or gmp]);;
esac
dnl Implement cases for what to do on different options here
case "$with_mp" in
system)
Expand All @@ -36,7 +18,37 @@ dnl Implement cases for what to do on different options here
SAGE_MP_LIBRARY=gmp
;;
esac
], [], [
AC_ARG_WITH([mp],
[AS_HELP_STRING([--with-mp=system],
[use the system GMP as multiprecision library, if possible (default)])]
[AS_HELP_STRING([--with-mp=mpir],
[use the Sage SPKG for MPIR as multiprecision library])]
[AS_HELP_STRING([--with-mp=gmp],
[use the Sage SPKG for GMP as multiprecision library])])
dnl Just parse the options here
case "$with_mp" in
system) ;;
MPIR|mpir) with_mp=mpir;;
GMP|gmp) with_mp=gmp;;
"") with_mp=system;;
*)
AC_MSG_ERROR([allowed values for --with-mp are system, mpir, or gmp]);;
esac
dnl Set SAGE_MP_LIBRARY depending on the with_mp option
case "$with_mp" in
mpir|system)
SAGE_MP_LIBRARY=mpir
;;
gmp)
SAGE_MP_LIBRARY=gmp
;;
esac
AC_SUBST([SAGE_MP_LIBRARY], [$SAGE_MP_LIBRARY])
], [
if test x$sage_spkg_install_mpir = xyes -o x$sage_spkg_install_gmp = xyes; then
AC_SUBST(SAGE_GMP_PREFIX, ['$SAGE_LOCAL'])
AC_SUBST(SAGE_GMP_INCLUDE, ['$SAGE_LOCAL/include'])
Expand All @@ -56,7 +68,5 @@ dnl Implement cases for what to do on different options here
AC_SUBST(SAGE_GMP_PREFIX, [''])
AC_MSG_RESULT([using GMP-compatible library from the system])
fi
AC_SUBST([SAGE_MP_LIBRARY], [$SAGE_MP_LIBRARY])
])

0 comments on commit a360518

Please sign in to comment.