summaryrefslogtreecommitdiff
path: root/m4/ax_func_posix_memalign.m4
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2007-02-18 23:43:16 +0100
committerPeter Simons <simons@cryp.to>2007-02-18 23:43:16 +0100
commit16aee45643e593e2833e4dff19df7b5f14267a79 (patch)
treeba40c1ee401bbbcec7dbee5e3bb51d21c70db130 /m4/ax_func_posix_memalign.m4
downloadautoconf-archive-16aee45643e593e2833e4dff19df7b5f14267a79.tar.gz
Imported http://autoconf-archive.cryp.to/ release 2007-02-14.
Diffstat (limited to 'm4/ax_func_posix_memalign.m4')
-rw-r--r--m4/ax_func_posix_memalign.m450
1 files changed, 50 insertions, 0 deletions
diff --git a/m4/ax_func_posix_memalign.m4 b/m4/ax_func_posix_memalign.m4
new file mode 100644
index 0000000..d4bc1ed
--- /dev/null
+++ b/m4/ax_func_posix_memalign.m4
@@ -0,0 +1,50 @@
+##### http://autoconf-archive.cryp.to/ax_func_posix_memalign.html
+#
+# SYNOPSIS
+#
+# AX_FUNC_POSIX_MEMALIGN
+#
+# DESCRIPTION
+#
+# Some versions of posix_memalign (notably glibc 2.2.5) incorrectly
+# apply their power-of-two check to the size argument, not the
+# alignment argument. AX_FUNC_POSIX_MEMALIGN defines
+# HAVE_POSIX_MEMALIGN if the power-of-two check is correctly applied
+# to the alignment argument.
+#
+# LAST MODIFICATION
+#
+# 2005-01-22
+#
+# COPYLEFT
+#
+# Copyright (c) 2005 Scott Pakin <pakin@uiuc.edu>
+#
+# Copying and distribution of this file, with or without
+# modification, are permitted in any medium without royalty provided
+# the copyright notice and this notice are preserved.
+
+AC_DEFUN([AX_FUNC_POSIX_MEMALIGN],
+[AC_CACHE_CHECK([for working posix_memalign],
+ [ax_cv_func_posix_memalign_works],
+ [AC_TRY_RUN([
+#include <stdlib.h>
+
+int
+main ()
+{
+ void *buffer;
+
+ /* Some versions of glibc incorrectly perform the alignment check on
+ * the size word. */
+ exit (posix_memalign (&buffer, sizeof(void *), 123) != 0);
+}
+ ],
+ [ax_cv_func_posix_memalign_works=yes],
+ [ax_cv_func_posix_memalign_works=no],
+ [ax_cv_func_posix_memalign_works=no])])
+if test "$ax_cv_func_posix_memalign_works" = "yes" ; then
+ AC_DEFINE([HAVE_POSIX_MEMALIGN], [1],
+ [Define to 1 if `posix_memalign' works.])
+fi
+])