1 # ===========================================================================
2 # http://www.gnu.org/software/autoconf-archive/ax_func_posix_memalign.html
3 # ===========================================================================
7 # AX_FUNC_POSIX_MEMALIGN
11 # Some versions of posix_memalign (notably glibc 2.2.5) incorrectly apply
12 # their power-of-two check to the size argument, not the alignment
13 # argument. AX_FUNC_POSIX_MEMALIGN defines HAVE_POSIX_MEMALIGN if the
14 # power-of-two check is correctly applied to the alignment argument.
18 # Copyright (c) 2008 Scott Pakin <pakin@uiuc.edu>
20 # Copying and distribution of this file, with or without modification, are
21 # permitted in any medium without royalty provided the copyright notice
22 # and this notice are preserved. This file is offered as-is, without any
27 AC_DEFUN([AX_FUNC_POSIX_MEMALIGN],
28 [AC_CACHE_CHECK([for working posix_memalign],
29 [ax_cv_func_posix_memalign_works],
38 /* Some versions of glibc incorrectly perform the alignment check on
40 exit (posix_memalign (&buffer, sizeof(void *), 123) != 0);
43 [ax_cv_func_posix_memalign_works=yes],
44 [ax_cv_func_posix_memalign_works=no],
45 [ax_cv_func_posix_memalign_works=no])])
46 if test "$ax_cv_func_posix_memalign_works" = "yes" ; then
47 AC_DEFINE([HAVE_POSIX_MEMALIGN], [1],
48 [Define to 1 if `posix_memalign' works.])