After a little research I have found why Configure.pl succeeds while
determining if some FreeBSDs (like 4.9, 4.10) supports GMP and why
compilation fails in the same systems complaining about undefined
references to `mpz_fits_slong_p'.

The test about GMP support is at:
         config/auto/gmp.pl
         config/auto/gmp/gmp.in

The point is that the so-called mpz_fits_* functions were defined back
in 2004-04-07 according to the GMP ChangeLog file and that corresponds
to version 3.0. In a FreeBSD 4.10 box I have found a "gmp.h" at
"/usr/include" which corresponds to version 2.0 and does not have
mpz_fits_* functions. Configure.pl succeeds because the test don't use
these and compilation fails when the class 'bigint' uses
'mpz_fits_slong_p'.

When I proceeded to install GMP as I told Will Coleda before, a more
recent GMP was installed (actually 4.1.2 in this machine). Compilation
now succeds. But as Will have said, Configure.pl is still broken.

At this point, I should submit a patch, but I don't know the kind of
changes that would be more appropriate. Maybe a conditional
              #if __GNU_MP_VERSION>3 
Maybe just an addition to the probing files.

The attached patch does only the later. In config/auto/gmp/gmp.in the
problematic function is used and its answer reaches STDOUT too. Then
config/auto/gmp.pl tests for the extended expected output.

Regards,
Adriano.
--- config/auto/gmp.pl
+++ config/auto/gmp.pl
@@ -51,7 +51,7 @@
     my $has_gmp = 0;
     if (! $@) {
 my $test = cc_run();
-if ($test eq "499999500000\n") {
+if ($test eq "499999500000 0\n") {
             $has_gmp = 1;
     print " (yes) " if $verbose;
             $Configure::Step::result = 'yes';

--- config/auto/gmp/gmp.in
+++ config/auto/gmp/gmp.in
@@ -8,7 +8,7 @@
 int main(int argc, char *argv[])
 {
     mpz_t i, j, k;
-    char *s;
+    char *s; int y;
 
     mpz_init(i);
     mpz_set_si(i, 999999);
@@ -19,9 +19,10 @@
     mpz_set_si(i, 2);
     mpz_div(k, k, i);
 
+    y = mpz_fits_slong_p(k);
 
     s = mpz_get_str(NULL, 10, k);
-    printf("%s\n", s);
+    printf("%s %d\n", s, y);
     free(s);
     return 0;
 }

Reply via email to