1
by Clint Adams
Import upstream version 1.9 |
1 |
dnl @synopsis AX_FUNC_POSIX_MEMALIGN |
2 |
dnl |
|
3 |
dnl Some versions of posix_memalign (notably glibc 2.2.5) incorrectly |
|
4 |
dnl apply their power-of-two check to the size argument, not the alignment |
|
5 |
dnl argument. AX_FUNC_POSIX_MEMALIGN defines HAVE_POSIX_MEMALIGN if the |
|
6 |
dnl power-of-two check is correctly applied to the alignment argument. |
|
7 |
dnl |
|
8 |
dnl @version $Id: $ |
|
9 |
dnl @author Scott Pakin <pakin@uiuc.edu> |
|
10 |
dnl
|
|
11 |
AC_DEFUN([AX_FUNC_POSIX_MEMALIGN], |
|
12 |
[AC_CACHE_CHECK([for working posix_memalign], |
|
13 |
[ax_cv_func_posix_memalign_works], |
|
14 |
[AC_TRY_RUN([ |
|
15 |
#include <stdlib.h>
|
|
16 |
||
17 |
int
|
|
18 |
main ()
|
|
19 |
{
|
|
20 |
void *buffer;
|
|
21 |
||
22 |
/* Some versions of glibc incorrectly perform the alignment check on
|
|
23 |
* the size word. */
|
|
24 |
exit (posix_memalign (&buffer, sizeof(void *), 123) != 0);
|
|
25 |
}
|
|
26 |
], |
|
27 |
[ax_cv_func_posix_memalign_works=yes], |
|
28 |
[ax_cv_func_posix_memalign_works=no], |
|
29 |
[ax_cv_func_posix_memalign_works=no])]) |
|
30 |
if test "$ax_cv_func_posix_memalign_works" = "yes" ; then |
|
31 |
AC_DEFINE([HAVE_POSIX_MEMALIGN], [1], |
|
32 |
[Define to 1 if `posix_memalign' works.]) |
|
33 |
fi
|
|
34 |
]) |