On Thursday 14 April 2005 08:36, Leopold Toetsch wrote:
> Lambeck <[EMAIL PROTECTED]> wrote:
> > Hi all,
> > Configure.pl failed to find the GNU Math Lib (GMP) on my system
> > eventhough it is installed properly (version 4.1.4) .
> > I compiled  config/auto/gmp/gmp.in by hand and it returned:
> > 499999500000 1 but expected was:
> > 499999500000 0
> >
> > Everything seems to be right, except that mpz_fits_slong_p(k) returned
> > "1" instead of "0". Could not find anything usefull to explain what it
> > means. I am on amd64 running Linux.
>           ^^^^^
>
> Yeah. The test is bogus for 64-bit systems. The tested number fits
> within a 64-bit long. Could you please patch gmp.in and gmp.pl to use
> some bigger numbers > 64 bit.

I changed the test to calculate a mersenne prime number. I have tested it
on amd 64 and it finds amd64.

Ok to commit?
boe
Index: config/auto/gmp/gmp.in
===================================================================
--- config/auto/gmp/gmp.in	(revision 7853)
+++ config/auto/gmp/gmp.in	(working copy)
@@ -7,21 +7,17 @@
 
 int main(int argc, char *argv[])
 {
-    mpz_t i, j, k;
+    mpz_t prime;
     char *s; int y;
 
-    mpz_init(i);
-    mpz_set_si(i, 999999);
-    mpz_init(j);
-    mpz_set_si(j, 1000000);
-    mpz_init(k);
-    mpz_mul(k, i, j);
-    mpz_set_si(i, 2);
-    mpz_div(k, k, i);
+    /* Calculate the 13th Mersenne prime 2^521 - 1 */
+    mpz_init(prime);
+    mpz_ui_pow_ui(prime, 2, 521);
+    mpz_sub_ui(prime, prime, 1);
 
-    y = mpz_fits_slong_p(k);
+    y = mpz_fits_slong_p(prime);
 
-    s = mpz_get_str(NULL, 10, k);
+    s = mpz_get_str(NULL, 10, prime);
     printf("%s %d\n", s, y);
     free(s);
     return 0;
Index: config/auto/gmp.pl
===================================================================
--- config/auto/gmp.pl	(revision 7853)
+++ config/auto/gmp.pl	(working copy)
@@ -55,7 +55,7 @@
     my $has_gmp = 0;
     if (! $@) {
 	my $test = cc_run();
-	if ($test eq "499999500000 0\n") {
+	if ($test eq "6864797660130609714981900799081393217269435300143305409394463459185543183397656052122559640661454554977296311391480858037121987999716643812574028291115057151 0\n") {
             $has_gmp = 1;
 	    print " (yes) " if $verbose;
             $Configure::Step::result = 'yes';

Reply via email to