File: ax_func_posix_memalign.m4

package info (click to toggle)
autoconf-archive 20060312-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 4,180 kB
  • ctags: 13
  • sloc: sh: 455; makefile: 44
file content (37 lines) | stat: -rw-r--r-- 1,075 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
dnl @synopsis AX_FUNC_POSIX_MEMALIGN
dnl
dnl Some versions of posix_memalign (notably glibc 2.2.5) incorrectly
dnl apply their power-of-two check to the size argument, not the
dnl alignment argument. AX_FUNC_POSIX_MEMALIGN defines
dnl HAVE_POSIX_MEMALIGN if the power-of-two check is correctly applied
dnl to the alignment argument.
dnl
dnl @category C
dnl @author Scott Pakin <pakin@uiuc.edu>
dnl @version 2005-01-22
dnl @license AllPermissive

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
])