1 # Copyright 2008 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3, or (at your option)
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Boston, MA
18 AC_DEFUN([GR_CHECK_MEMALIGN],
20 # Check for allocing memory alignment functions
21 # If 'posix_memalign' is available, use it solely.
22 AC_CHECK_FUNCS([posix_memalign],,[
23 # Otherwise, check for valloc and the
24 # (a-priori known) alignment of 'malloc'
25 AC_CHECK_FUNCS([valloc])
27 # 'malloc' is 16-byte aligned on (at least) Darwin 8 and 9
29 darwin8*) aligned_malloc=16 ;;
30 darwin9*) aligned_malloc=16 ;;
33 if test $aligned_malloc = 0; then
34 AC_MSG_RESULT([malloc has unknown alignment.])
36 AC_MSG_RESULT([malloc is $aligned_malloc-byte aligned.])
38 AC_DEFINE_UNQUOTED([ALIGNED_MALLOC],[$aligned_malloc],[Define as the alignment of malloc if known; otherwise 0.])