diff --git a/.gitattributes b/.gitattributes
index 8a79a980a31c44f3ae3168d81edc3a6f5f06d1bc..e66cd7bfbebb935bf5f7d316820c0126897cf6e4 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -220,6 +220,7 @@ testfont binary
 /src/modules/Gmp/my_mpz_xor.c foreign_ident
 /src/modules/Gmp/next_prime.c foreign_ident
 /src/modules/Gmp/prime_table.c foreign_ident
+/src/modules/Gmp/prime_table.pike foreign_ident
 /src/modules/Gmp/testsuite.in foreign_ident
 /src/modules/Gz/Makefile.in foreign_ident
 /src/modules/Gz/acconfig.h foreign_ident
diff --git a/src/modules/Gmp/Makefile.in b/src/modules/Gmp/Makefile.in
index 5336b6518582751959b5c40386807ed39dfef07f..761fee43d84924f8fca1fbf796d550cf1b6c7a23 100644
--- a/src/modules/Gmp/Makefile.in
+++ b/src/modules/Gmp/Makefile.in
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.11 1999/11/18 07:58:54 hubbe Exp $
+# $Id: Makefile.in,v 1.12 2000/08/01 21:53:22 grubba Exp $
 @make_variables@
 VPATH=@srcdir@:@srcdir@/../..:../..
 MODULE_LDFLAGS=@LDFLAGS@ @LIBS@
@@ -12,12 +12,15 @@ CONFIG_HEADERS=@CONFIG_HEADERS@
 
 next_prime.o: prime_table.out
 
-prime_table.out: prime_table
-	./prime_table $(PRIME_LIMIT) >prime_table.out
+prime_table.out: prime_table@CROSS@
+	./prime_table@CROSS@ $(PRIME_LIMIT) >prime_table.out
 
 prime_table: $(SRCDIR)/prime_table.c
 	$(CC) $(CFLAGS) $(SRCDIR)/prime_table.c -o prime_table
 
+prime_table.pike: $(SRCDIR)/prime_table.pike
+	test -f prime_table.pike || ln -s $(SRCDIR)/prime_table.pike
+
 depend: prime_table.out
 
 @dependencies@
diff --git a/src/modules/Gmp/prime_table.pike b/src/modules/Gmp/prime_table.pike
new file mode 100755
index 0000000000000000000000000000000000000000..c745a7072af3091baa52b221a3b1022bd21324af
--- /dev/null
+++ b/src/modules/Gmp/prime_table.pike
@@ -0,0 +1,39 @@
+#!/usr/local/bin/pike
+#pragma strict_types
+/* $Id: prime_table.pike,v 1.1 2000/08/01 21:53:22 grubba Exp $
+ *
+ * Generates a table of primes.
+ * Used when cross-compiling.
+ *
+ * Henrik Grubbstr�m 2000-08-01
+ */
+int main(int argc, array(string) argv)
+{
+  if (argc != 2) {
+    werror("Bad number of arguments!\n");
+    exit(1);
+  }
+  int count = (int)argv[1];
+  write(sprintf("/* Automatically generated by\n"
+		" * $Id: prime_table.pike,v 1.1 2000/08/01 21:53:22 grubba Exp $\n"
+		" *%{ %s%}\n"
+		" * Do not edit.\n"
+		" */\n"
+		"\n"
+		"#define NUMBER_OF_PRIMES %d\n"
+		"\n"
+		"const unsigned long primes[NUMBER_OF_PRIMES] = {",
+		argv, count));
+  int prime = 1;
+  for (int i=0; i < count; i++) {
+    prime = (prime+1)->next_prime();
+    if (!(i%10)) {
+      write(sprintf("\n   %d,", prime));
+    } else {
+      write(sprintf(" %d,", prime));
+    }
+  }
+  write("\n};\n"
+	"\n");
+  return 0;
+}