Skip to content

Commit

Permalink
Trac #30231: Fix gp2c spkg-configure
Browse files Browse the repository at this point in the history
https://groups.google.com/d/msg/sage-devel/rZpwyAT2EZU/jiNWFinQBgAJ

Broken in b5d16d9 (#29491)

URL: https://trac.sagemath.org/30231
Reported by: mkoeppe
Ticket author(s): Michael Orlitzky
Reviewer(s): Samuel Lelièvre, Matthias Koeppe
  • Loading branch information
Release Manager committed Aug 3, 2020
2 parents 34e01d1 + 252633c commit b539712
Showing 1 changed file with 28 additions and 25 deletions.
53 changes: 28 additions & 25 deletions build/pkgs/gp2c/spkg-configure.m4
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
SAGE_SPKG_CONFIGURE([gp2c], [
# Default to installing the SPKG
# Default to installing the SPKG, if the check is run at all.
sage_spkg_install_gp2c=yes
# And to using sage's pari.cfg (from the pari SPKG).
libpari_pari_cfg='$SAGE_LOCAL/lib/pari/pari.cfg'
SAGE_SPKG_DEPCHECK([pari], [
AS_IF([test "x$USING_SYSTEM_PARI" = "xyes"], [
# We're using the system pari, so we can use the system gp2c
# if we find a suitable one.
AC_PATH_PROG([GP2C], [gp2c])
if test -n "$GP2C"; then
AS_IF([test -n "$GP2C"], [
# We found gp2c on the system; use it.
sage_spkg_install_gp2c=no
fi
# Either way, if we're using the system pari, we no longer want
# to use sage's pari.cfg.
libpari_pari_cfg=''
])
])
],[],[],[
],[],[
# Pre-check phase. We need to determine the location of pari.cfg
# regardless of whether or not we're using the system copy of pari.
#
# Store the depcheck result to be reused in this macro's check and
# post-check phases. We do this in pre-check because the "check"
# phase itself may be skipped via --with-system-gp2c=no.
USING_SYSTEM_PARI=no
SAGE_SPKG_DEPCHECK([pari], [USING_SYSTEM_PARI=yes])
],[
# Post-check phase. Here we may need to locate pari.cfg if we're using
# the system's pari (which can put pari.cfg wherever it wants) but sage's
# gp2c (which needs to know where pari.cfg lives).
#
# Can we avoid this if the user hasn't passed --enable-gp2c to ./configure?
#
if test "x$sage_spkg_install_gp2c" = "xyes"; then
if test -z "$libpari_pari_cfg"; then
AS_IF([test "x$sage_spkg_install_gp2c" = "xyes"], [
AS_IF([test "x$USING_SYSTEM_PARI" = "xyes"], [
# Installing the gp2c package but don't know where pari.cfg is. There's
# no good way to do this, except to try every known location. If you
# have two copies of pari.cfg in two locations, this loop will overwrite
Expand All @@ -42,10 +44,10 @@ SAGE_SPKG_CONFIGURE([gp2c], [
# Arch/Conda: $gp_prefix/lib/pari/pari.cfg
# Fedora: $gp_prefix/share/doc/pari/pari.cfg
m4_foreach([pari_cfg_path], [share/pari,lib/pari,share/doc/pari], [
if test -f "${gp_prefix}/pari_cfg_path/pari.cfg"; then
AS_IF([test -f "${gp_prefix}/pari_cfg_path/pari.cfg"], [
libpari_pari_cfg="${gp_prefix}/pari_cfg_path/pari.cfg"
AC_MSG_NOTICE([found a pari.cfg at $libpari_pari_cfg])
fi
])
])
# Debian: $gp_prefix/lib/<arch-tuple>/pari/pari.cfg
Expand All @@ -55,20 +57,21 @@ SAGE_SPKG_CONFIGURE([gp2c], [
# right one. If it doesn't, the "-f" test below prevents anything
# too bad from happening.
debian_arch=$(dpkg-architecture -qDEB_BUILD_MULTIARCH 2>/dev/null)
if test -f "${gp_prefix}/lib/${debian_arch}/pari/pari.cfg"; then
AS_IF([test -f "${gp_prefix}/lib/${debian_arch}/pari/pari.cfg"], [
libpari_pari_cfg="${gp_prefix}/lib/${debian_arch}/pari/pari.cfg"
AC_MSG_NOTICE([found a pari.cfg at $libpari_pari_cfg])
fi
])
# If we can't find pari.cfg, gp2c isn't going to work.
if test -z "$libpari_pari_cfg"; then
AC_MSG_ERROR([unable to locate pari.cfg])
fi
fi
AS_IF([test -z "$libpari_pari_cfg"], [
AC_MSG_ERROR([using system pari and unable to locate pari.cfg])
])
], [
# Not using the system pari
libpari_pari_cfg='$SAGE_LOCAL/lib/pari/pari.cfg'
])
# Only print out the location of pari.cfg if we're not using the
# system gp2c, because if we're using the system gp2c, who cares.
AC_MSG_NOTICE([pari.cfg is $libpari_pari_cfg])
fi
])
AC_SUBST(SAGE_PARI_CFG, [$libpari_pari_cfg])
])

0 comments on commit b539712

Please sign in to comment.