So gmp has this configure test that fails (fatal failure) with strict
malloc options.  It's supposed to catch buggy compilers, but it relies
on malloc returning zeroed memory.  Using calloc fixes the test.
automake and libtool don't seem to be needed after the .m4 patch.

ok?


Index: Makefile
===================================================================
RCS file: /d/cvs/ports/devel/gmp/Makefile,v
retrieving revision 1.35
diff -u -p -r1.35 Makefile
--- Makefile    26 Jul 2017 22:45:17 -0000      1.35
+++ Makefile    2 Nov 2017 22:59:47 -0000
@@ -21,7 +21,8 @@ WANTLIB=      m ${COMPILER_LIBCXX}
 MASTER_SITES=  https://gmplib.org/download/gmp/ \
                ${MASTER_SITE_GNU:=gmp/}
 
-CONFIGURE_STYLE=gnu
+CONFIGURE_STYLE=autoconf
+AUTOCONF_VERSION=2.69
 CONFIGURE_ARGS=        --enable-cxx
 # Don't try to optimize for the local CPU submodel
 CONFIGURE_ARGS+=--build=${MACHINE_ARCH}-unknown-openbsd${OSrev}
Index: patches/patch-acinclude_m4
===================================================================
RCS file: patches/patch-acinclude_m4
diff -N patches/patch-acinclude_m4
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-acinclude_m4  2 Nov 2017 23:38:37 -0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+Zero out the memory before testing for overwrite bug.
+
+Index: acinclude.m4
+--- acinclude.m4.orig
++++ acinclude.m4
+@@ -741,7 +741,7 @@ main ()
+   long i;
+   for (i = 0; i < 88 + 1; i++)
+     a[i] = ~0L;
+-  r = malloc (10000 * sizeof (unsigned long));
++  r = calloc (10000, sizeof (unsigned long));
+   r2 = r;
+   for (i = 0; i < 528; i += 23)
+     {


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to