Bill Allombert on Mon, 30 Mar 2009 00:49:16 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Incorrect result with GMP 4.2.4 under Mac OS X (PowerPC)


On Tue, Mar 10, 2009 at 01:22:53AM +0100, Vincent Lefevre wrote:
> On 2009-03-09 17:28:21 +0100, Bill Allombert wrote:
> > Sure. Would the attached file do the trick ? (to be put as
> > config/gmp_version.c).
> 
> Configure (get_gmp) doesn't complain on the non-zero exit status.
> Odarwin-ppc/pari.cfg has:
> 
> pretty='PowerPC running darwin (PPC/GMP- kernel) 32-bit version'
> 
> One can see that the printf didn't occur (as expected on my machine).

OK, thanks.

Here a new patch that should aork and be more informative.

Cheers,
Bill.
diff --git a/config/get_gmp b/config/get_gmp
index e3c1728..cfe37a5 100644
--- a/config/get_gmp
+++ b/config/get_gmp
@@ -46,7 +46,12 @@ if test -n "$gmp"; then
   $CC $extraflag $GMPINCLUDE -o $exe gmp_version.c $GMPLIBS 2> /dev/null
   if test -r $exe; then
     gmp_version=`env LD_LIBRARY_PATH="$LD_LIBRARY_PATH$dir_sep$gmp" $exe`;
-  else
+  fi
+  if test $gmp_version = "unsupported"; then
+    echo "### Your GMP library ABI is unsupported."
+    gmp=
+  fi
+  if test -z "$gmp_version"; then
     echo "### Your version of GMP is too old for PARI. Please upgrade"
     gmp=
   fi
diff --git a/config/gmp_version.c b/config/gmp_version.c
index 179de82..cd3f7c4 100644
--- a/config/gmp_version.c
+++ b/config/gmp_version.c
@@ -1,4 +1,10 @@
 #include <stdio.h>
 #include <gmp.h>
 void f(void) { mpn_gcdext(NULL,NULL, NULL, NULL, 0, NULL, 0); }
-main(){ printf("%s", gmp_version); }
+main()
+{ 
+  if (sizeof(mp_limb_t) == sizeof(long))
+    printf("%s", gmp_version);
+  else
+    printf("unsupported");
+}