From a2f0fd388c12ca0b9f4525c6cfbc515418dcbaf8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Emmanuel=20Thom=C3=A9?= <Emmanuel.Thome@inria.fr>
Date: Thu, 17 Sep 2020 23:40:54 +0200
Subject: [PATCH] fix #include in configure test

See there: https://trac.sagemath.org/ticket/30494
---
 config/acinclude.m4 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/config/acinclude.m4 b/config/acinclude.m4
index 53faf0b..07c1384 100644
--- a/config/acinclude.m4
+++ b/config/acinclude.m4
@@ -661,6 +661,7 @@ AC_DEFUN([GF2X_PROG_CC_FOR_BUILD_WORKS],
 # remove anything that might look like compiler output to our "||" expression
 rm -f conftest* a.out b.out a.exe a_out.exe
 cat >conftest.c <<EOF
+#include <stdlib.h>
 int
 main ()
 {
@@ -699,6 +700,7 @@ AC_DEFUN([GF2X_PROG_EXEEXT_FOR_BUILD],
 AC_CACHE_CHECK([for build system executable suffix],
                gf2x_cv_prog_exeext_for_build,
 [cat >conftest.c <<EOF
+#include <stdlib.h>
 int
 main ()
 {
-- 
GitLab

Source: https://src.fedoraproject.org/rpms/gf2x/raw/rawhide/f/gf2x-mismatched-decls.patch
--- gf2x-gf2x-1.3.0/fft/gf2x-cantor-fft.c.orig	2019-12-10 06:35:45.000000000 -0700
+++ gf2x-gf2x-1.3.0/fft/gf2x-cantor-fft.c	2022-07-08 14:32:27.802452501 -0600
@@ -95,7 +95,7 @@ static Kfield K;
  * data in the high part is during the ift operation, and even then the
  * data that comes out of the ift still has zero high part.
  */
-size_t gf2x_cantor_fft_transform_size(const gf2x_cantor_fft_info_t p)
+size_t gf2x_cantor_fft_transform_size(gf2x_cantor_fft_info_srcptr p)
 {
     return 1UL << p->k;
 }
@@ -1444,7 +1444,7 @@ static void recomposeK_bits(unsigned lon
 #endif
 
 /* nF is a number of coefficients == number of bits ; a.k.a. degree + 1 */
-int gf2x_cantor_fft_info_init(gf2x_cantor_fft_info_t p, size_t nF, size_t nG)
+int gf2x_cantor_fft_info_init(gf2x_cantor_fft_info_ptr p, size_t nF, size_t nG)
 {
     unsigned int k;
     size_t Hl;
@@ -1467,7 +1467,7 @@ int gf2x_cantor_fft_info_init(gf2x_canto
     return 0;
 }
 
-int gf2x_cantor_fft_info_init_mp(gf2x_cantor_fft_info_t p, size_t nF, size_t nG)
+int gf2x_cantor_fft_info_init_mp(gf2x_cantor_fft_info_ptr p, size_t nF, size_t nG)
 {
     unsigned int k;
 
@@ -1572,7 +1572,7 @@ char * GF2X_EXPORTED gf2x_cantor_fft_inf
 }
 
 /* nF is a number of coefficients */
-int gf2x_cantor_fft_dft(const gf2x_cantor_fft_info_t p, gf2x_cantor_fft_ptr x, const unsigned long * F, size_t nF, gf2x_cantor_fft_ptr temp1 GF2X_MAYBE_UNUSED)
+int gf2x_cantor_fft_dft(gf2x_cantor_fft_info_srcptr p, gf2x_cantor_fft_ptr x, const unsigned long * F, size_t nF, gf2x_cantor_fft_ptr temp1 GF2X_MAYBE_UNUSED)
 {
     size_t Fl = W(nF);
     if (R(nF)) {
@@ -1602,7 +1602,7 @@ int gf2x_cantor_fft_dft(const gf2x_canto
 }
 
 
-int gf2x_cantor_fft_compose(const gf2x_cantor_fft_info_t p, gf2x_cantor_fft_ptr y, gf2x_cantor_fft_srcptr x1, gf2x_cantor_fft_srcptr x2, gf2x_cantor_fft_ptr temp2 GF2X_MAYBE_UNUSED)
+int gf2x_cantor_fft_compose(gf2x_cantor_fft_info_srcptr p, gf2x_cantor_fft_ptr y, gf2x_cantor_fft_srcptr x1, gf2x_cantor_fft_srcptr x2, gf2x_cantor_fft_ptr temp2 GF2X_MAYBE_UNUSED)
 {
     for (size_t j = 0; j < significant_transform_size(p) ; j++) {
         Kmul(y[j], x1[j], x2[j]);
@@ -1610,7 +1610,7 @@ int gf2x_cantor_fft_compose(const gf2x_c
     return 0;
 }
 
-int gf2x_cantor_fft_addcompose_n(const gf2x_cantor_fft_info_t p, gf2x_cantor_fft_ptr y, gf2x_cantor_fft_srcptr * x1, gf2x_cantor_fft_srcptr * x2, size_t n, gf2x_cantor_fft_ptr temp2 GF2X_MAYBE_UNUSED, gf2x_cantor_fft_ptr temp1 GF2X_MAYBE_UNUSED)
+int gf2x_cantor_fft_addcompose_n(gf2x_cantor_fft_info_srcptr p, gf2x_cantor_fft_ptr y, gf2x_cantor_fft_srcptr * x1, gf2x_cantor_fft_srcptr * x2, size_t n, gf2x_cantor_fft_ptr temp2 GF2X_MAYBE_UNUSED, gf2x_cantor_fft_ptr temp1 GF2X_MAYBE_UNUSED)
 {
     Kelt er;
 #if 0
@@ -1684,20 +1684,20 @@ int gf2x_cantor_fft_addcompose_n(const g
     return 0;
 }
 
-int gf2x_cantor_fft_addcompose(const gf2x_cantor_fft_info_t p, gf2x_cantor_fft_ptr y, gf2x_cantor_fft_srcptr x1, gf2x_cantor_fft_srcptr x2, gf2x_cantor_fft_ptr temp2, gf2x_cantor_fft_ptr temp1)
+int gf2x_cantor_fft_addcompose(gf2x_cantor_fft_info_srcptr p, gf2x_cantor_fft_ptr y, gf2x_cantor_fft_srcptr x1, gf2x_cantor_fft_srcptr x2, gf2x_cantor_fft_ptr temp2, gf2x_cantor_fft_ptr temp1)
 {
     gf2x_cantor_fft_addcompose_n(p, y, &x1, &x2, 1, temp2, temp1);
     return 0;
 }
 
-void gf2x_cantor_fft_add(const gf2x_cantor_fft_info_t p, gf2x_cantor_fft_ptr y, gf2x_cantor_fft_srcptr x1, gf2x_cantor_fft_srcptr x2)
+void gf2x_cantor_fft_add(gf2x_cantor_fft_info_srcptr p, gf2x_cantor_fft_ptr y, gf2x_cantor_fft_srcptr x1, gf2x_cantor_fft_srcptr x2)
 {
     for (size_t j = 0; j < significant_transform_size(p) ; j++) {
         Kadd(y[j], x1[j], x2[j]);
     }
 }
 
-void gf2x_cantor_fft_cpy(const gf2x_cantor_fft_info_t p, gf2x_cantor_fft_ptr y, gf2x_cantor_fft_srcptr x, size_t n)
+void gf2x_cantor_fft_cpy(gf2x_cantor_fft_info_srcptr p, gf2x_cantor_fft_ptr y, gf2x_cantor_fft_srcptr x, size_t n)
 {
     memcpy(y, x, n * significant_transform_size(p) * sizeof(Kelt));
 }
@@ -1705,7 +1705,7 @@ void gf2x_cantor_fft_cpy(const gf2x_cant
 /* nH is a number of coefficients */
 /* this destroys the input */
 int gf2x_cantor_fft_ift(
-        const gf2x_cantor_fft_info_t p,
+        gf2x_cantor_fft_info_srcptr p,
         unsigned long * H,
         size_t nH,
         gf2x_cantor_fft_ptr h, gf2x_cantor_fft_ptr temp1 GF2X_MAYBE_UNUSED)
@@ -1735,26 +1735,26 @@ int gf2x_cantor_fft_ift(
 }
 
 
-gf2x_cantor_fft_ptr gf2x_cantor_fft_alloc(const gf2x_cantor_fft_info_t p, size_t n)
+gf2x_cantor_fft_ptr gf2x_cantor_fft_alloc(gf2x_cantor_fft_info_srcptr p, size_t n)
 {
     return (Kelt *) malloc(n * gf2x_cantor_fft_transform_size(p) * sizeof(Kelt));
 }
 void gf2x_cantor_fft_free(
-        const gf2x_cantor_fft_info_t p GF2X_MAYBE_UNUSED,
+        gf2x_cantor_fft_info_srcptr p GF2X_MAYBE_UNUSED,
         gf2x_cantor_fft_ptr x,
         size_t n GF2X_MAYBE_UNUSED)
 {
     free(x);
 }
-gf2x_cantor_fft_srcptr gf2x_cantor_fft_get_const(const gf2x_cantor_fft_info_t p, gf2x_cantor_fft_srcptr x, size_t k)
+gf2x_cantor_fft_srcptr gf2x_cantor_fft_get_const(gf2x_cantor_fft_info_srcptr p, gf2x_cantor_fft_srcptr x, size_t k)
 {
     return x + k * gf2x_cantor_fft_transform_size(p);
 }
-gf2x_cantor_fft_ptr gf2x_cantor_fft_get(const gf2x_cantor_fft_info_t p, gf2x_cantor_fft_ptr x, size_t k)
+gf2x_cantor_fft_ptr gf2x_cantor_fft_get(gf2x_cantor_fft_info_srcptr p, gf2x_cantor_fft_ptr x, size_t k)
 {
     return x + k * gf2x_cantor_fft_transform_size(p);
 }
-void gf2x_cantor_fft_zero(const gf2x_cantor_fft_info_t p, gf2x_cantor_fft_ptr x, size_t n)
+void gf2x_cantor_fft_zero(gf2x_cantor_fft_info_srcptr p, gf2x_cantor_fft_ptr x, size_t n)
 {
     memset(x, 0, n * gf2x_cantor_fft_transform_size(p) * sizeof(Kelt));
 }
--- gf2x-gf2x-1.3.0/fft/gf2x-cantor-fft.h.orig	2019-12-10 06:35:45.000000000 -0700
+++ gf2x-gf2x-1.3.0/fft/gf2x-cantor-fft.h	2022-07-08 14:23:32.289410384 -0600
@@ -540,8 +540,8 @@ static inline int gf2x_cantor_fft_info_a
         long val GF2X_MAYBE_UNUSED)
 { return 0; }
 
-static inline void gf2x_cantor_fft_info_clear(gf2x_cantor_fft_info_t t GF2X_MAYBE_UNUSED) { }
-static inline void gf2x_cantor_fft_info_init_empty(gf2x_cantor_fft_info_t t) { 
+static inline void gf2x_cantor_fft_info_clear(gf2x_cantor_fft_info_ptr t GF2X_MAYBE_UNUSED) { }
+static inline void gf2x_cantor_fft_info_init_empty(gf2x_cantor_fft_info_ptr t) { 
     t->k = t->n = t->mp_shift = 0;
 }
 
--- gf2x-gf2x-1.3.0/fft/gf2x-ternary-fft.h.orig	2019-12-10 06:35:45.000000000 -0700
+++ gf2x-gf2x-1.3.0/fft/gf2x-ternary-fft.h	2022-07-08 13:57:39.701566437 -0600
@@ -498,7 +498,7 @@ extern "C" {
 #endif
 
 static inline int gf2x_ternary_fft_info_order(gf2x_ternary_fft_info_srcptr o) { return ((o)->K * ((o)->split ? -1 : 1)); }
-static inline void gf2x_ternary_fft_info_init_empty(gf2x_ternary_fft_info_t t)
+static inline void gf2x_ternary_fft_info_init_empty(gf2x_ternary_fft_info_ptr t)
 { 
     t->bits_a = 0;
     t->bits_b = 0;
