AC_SUBST(DEP_CFLAGS)
AC_SUBST(DEP_LIBS)
+dnl =====================================
+dnl posix_memalign
+
+AC_CHECK_FUNC(posix_memalign, have_posix_memalign=yes, have_posix_memalign=no)
+if test x$have_posix_memalign = xyes; then
+ AC_DEFINE(HAVE_POSIX_MEMALIGN, 1, [Whether we have posix_memalign()])
+fi
+
AC_OUTPUT([pixman-1.pc
pixman-1-uninstalled.pc
Makefile
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
-#include <malloc.h>
+#include <config.h>
#include "pixman.h"
/* A primitive pseudorandom number generator, taken from POSIX.1-2001 example */
return lcg_rand () % max;
}
+static void *
+aligned_malloc (size_t align, size_t size)
+{
+ void *result;
+
+#ifdef HAVE_POSIX_MEMALIGN
+ posix_memalign (&result, align, size);
+#else
+ result = malloc (size);
+#endif
+
+ return result;
+}
+
/*----------------------------------------------------------------------------*\
* CRC-32 version 2.0.0 by Craig Bruce, 2006-04-29.
*
stride = (stride + 3) & ~3;
/* do the allocation */
- buf = (uint32_t *)memalign (64, stride * height);
+ buf = aligned_malloc (64, stride * height);
/* initialize image with random data */
for (i = 0; i < stride * height; i++)