Source: singular
Version: 1:4.1.1-p2+ds-4
Tags: patch upstream
User: [email protected]
Usertags: ftcbfs
singular fails to cross build for a few reasons. In this bug report, I'm
addressing one of them. The check for GMP uses AC_TRY_RUN, which doesn't
work during cross compilation and the implemented fallback code doesn't
work either. Thus it thinks that GMP is missing and gives up. I've
reimplemented that part to not rely on AC_TRY_RUN as what we need here
can be examined using AC_COMPUTE_INT. What do you think about the
attached patch? Please close this bug when solving the gmp detection
issue even if singular still fails to cross build.
Helmut
--- singular-4.1.1-p2+ds.orig/m4/gmp-check.m4
+++ singular-4.1.1-p2+ds/m4/gmp-check.m4
@@ -56,50 +56,29 @@
[#include <gmp.h>],
[mpz_t a; mpz_init (a);],
[
- AC_TRY_RUN(
- [#include <gmp.h>
- int main () { if (__GNU_MP_VERSION < 3) return -1; else return 0; }
- ],[
- AC_MSG_RESULT(found)
- AC_SUBST(GMP_CPPFLAGS)
- AC_SUBST(GMP_LIBS)
- AC_DEFINE(HAVE_GMP,1,[Define if GMP is installed])
- # See if we are running GMP 4.0
- AC_MSG_CHECKING(whether GMP is 4.0 or greater)
- AC_TRY_RUN(
- [#include <gmp.h>
- int main () { if (__GNU_MP_VERSION < 4) return -1; else return 0; }
- ],[
- gmp_found="yes"
- AC_MSG_RESULT(yes)
- GMP_VERSION=""
- AC_SUBST(GMP_VERSION)
- ],[
- AC_MSG_RESULT(no)
- AC_DEFINE(GMP_VERSION_3,1,[Define if GMP is version 3.xxx])
- GMP_VERSION="-DGMP_VERSION_3"
- AC_SUBST(GMP_VERSION)
- ],[
- dnl This should never happen
- AC_MSG_RESULT(no)
- ])
- ifelse([$2], , :, [$2])
- break
- ],[
+ AC_COMPUTE_INT(GMP_VERSION_MAJOR,__GNU_MP_VERSION,[#include <gmp.h>],
+ [
+ GMP_VERSION_MAJOR=
gmp_problem="$gmp_problem $GMP_HOME"
unset GMP_CPPFLAGS
unset GMP_LIBS
- ],[
- AC_MSG_RESULT(unknown)
- echo "WARNING: You appear to be cross compiling, so there is no way to determine"
- echo "whether your GMP version is new enough. I am assuming it is."
- AC_SUBST(GMP_CPPFLAGS)
- AC_SUBST(GMP_LIBS)
- AC_SUBST(GMP_HOME)
- HAVE_GMP=yes
- AC_DEFINE(HAVE_GMP,1,[Define if GMP is installed])
+ ])
+ AS_IF([test "x$GMP_VERSION_MAJOR" != x && test "$GMP_VERSION_MAJOR" -ge 4],[
+ gmp_found=yes
+ AC_MSG_RESULT([yes ($GMP_VERSION_MAJOR.X)])
+ GMP_VERSION=
+ AC_SUBST(GMP_VERSION)
+ ifelse([$2], , :, [$2])
+ break
+ ],[test "x$GMP_VERSION_MAJOR" != x && test "$GMP_VERSION_MAJOR" -ge 3],[
+ AC_MSG_RESULT([no (found 3.X)])
+ AC_DEFINE(GMP_VERSION_3,1,[Define if GMP is version 3.xxx])
+ GMP_VERSION="-DGMP_VERSION_3"
+ AC_SUBST(GMP_VERSION)
ifelse([$2], , :, [$2])
break
+ ],[
+ AC_MSG_RESULT([no (cannot determine gmp version)])
])
],[
gmp_found="no"