summaryrefslogtreecommitdiff
path: root/build_posix/aclocal
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2015-05-28 15:02:19 +1000
committerMichael Cahill <michael.cahill@mongodb.com>2015-05-28 15:02:19 +1000
commitecc674b8f5fc58c1df9a1c6b957491d73a27603d (patch)
tree92b405e1a6e9b21f5fa26511f4193ee881f27bc6 /build_posix/aclocal
parentf975e1f8f858321f190b6179097e0bf7729fe0ad (diff)
downloadmongo-ecc674b8f5fc58c1df9a1c6b957491d73a27603d.tar.gz
Add code from the autoconf archive to detect posix_memalign instead of relying on AC_CHECK_FUNCS.
refs WT-1951
Diffstat (limited to 'build_posix/aclocal')
-rw-r--r--build_posix/aclocal/ax_func_posix_memalign.m450
1 files changed, 50 insertions, 0 deletions
diff --git a/build_posix/aclocal/ax_func_posix_memalign.m4 b/build_posix/aclocal/ax_func_posix_memalign.m4
new file mode 100644
index 00000000000..bd60adcbc81
--- /dev/null
+++ b/build_posix/aclocal/ax_func_posix_memalign.m4
@@ -0,0 +1,50 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/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.
+#
+# LICENSE
+#
+# Copyright (c) 2008 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. This file is offered as-is, without any
+# warranty.
+
+#serial 7
+
+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
+])