]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
libgmp-mpz: require Baillie-PSW primality test
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 15 Jun 2025 05:45:48 +0000 (22:45 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 15 Jun 2025 05:46:33 +0000 (22:46 -0700)
* m4/libgmp.m4 (gl_LIBGMP): Reject GMP 6.1.2 (2016) and earlier,
as these older versions had an inferior primality test and
coreutils factor.c will need Baillie-PSW.  mini-gmp.c already has
Baillie-PSW, so it can serve as a fallback.

ChangeLog
m4/libgmp.m4

index 80fbd2b39747006311e57fb16c30fda570932af5..b2578a3ca1971c26b0c06efb20cf8dc4229a4ff6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-06-14  Paul Eggert  <eggert@cs.ucla.edu>
+
+       libgmp-mpz: require Baillie-PSW primality test
+       * m4/libgmp.m4 (gl_LIBGMP): Reject GMP 6.1.2 (2016) and earlier,
+       as these older versions had an inferior primality test and
+       coreutils factor.c will need Baillie-PSW.  mini-gmp.c already has
+       Baillie-PSW, so it can serve as a fallback.
+
 2025-06-13  Bruno Haible  <bruno@clisp.org>
 
        stat: Support the file name "/dev/null" on native Windows.
index baed8ab1a0aada9806a3b0e4a4b878493f0f26d1..abf677949dd2e75d2322ede472cee7c99d157fb5 100644 (file)
@@ -1,5 +1,5 @@
 # libgmp.m4
-# serial 8
+# serial 9
 # Configure the GMP library or a replacement.
 dnl Copyright 2020-2025 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
@@ -34,7 +34,11 @@ AC_DEFUN([gl_LIBGMP],
               # include <gmp.h>
               #else
               # include <gmp/gmp.h>
-              #endif],
+              #endif
+              #if ! (6 < __GNU_MP_VERSION + (2 <= __GNU_MP_VERSION_MINOR))
+              # error "GMP < 6.2.0, so mpz_probab_prime_p lacks Baillie-PSW"
+              #endif
+              ],
              [static const mp_limb_t x[2] = { 0x73, 0x55 };
               mpz_t tmp;
               mpz_roinit_n (tmp, x, 2);