diff options
author | Lukas Larsson <[email protected]> | 2013-10-28 18:26:40 +0100 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2013-11-01 10:39:29 +0100 |
commit | 70ebf76f1cef4a6de6be3ea96b36fb81fe245921 (patch) | |
tree | cd8ae5d1663cdd40acec0a05cf4ad1d08f05351c /erts | |
parent | 207a13a549052e014a82362032995e347ffb68ff (diff) | |
download | otp-70ebf76f1cef4a6de6be3ea96b36fb81fe245921.tar.gz otp-70ebf76f1cef4a6de6be3ea96b36fb81fe245921.tar.bz2 otp-70ebf76f1cef4a6de6be3ea96b36fb81fe245921.zip |
erts: Add max alignment posix_memalign configure check
On some OSs posix_memalign exists, but it does not allow for alignment
greater than the current page size. So we have to do a runtime check for
alignment size and also add cross compile options.
Diffstat (limited to 'erts')
-rw-r--r-- | erts/configure.in | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/erts/configure.in b/erts/configure.in index f17f4cb5c8..8288a1aab1 100644 --- a/erts/configure.in +++ b/erts/configure.in @@ -1974,11 +1974,39 @@ AC_CHECK_FUNCS([getipnodebyname getipnodebyaddr gethostbyname2]) AC_CHECK_FUNCS([ieee_handler fpsetmask finite isnan isinf res_gethostbyname dlopen \ pread pwrite memmove strerror strerror_r strncasecmp \ - gethrtime localtime_r gmtime_r inet_pton posix_memalign \ + gethrtime localtime_r gmtime_r inet_pton \ mmap mremap memcpy mallopt sbrk _sbrk __sbrk brk _brk __brk \ flockfile fstat strlcpy strlcat setsid posix2time time2posix \ setlocale nl_langinfo poll]) + +case X$erl_xcomp_posix_memalign in + Xno) ;; + Xyes) AC_DEFINE(HAVE_POSIX_MEMALIGN,[1], + [Define to 1 if you have the `posix_memalign' function.]) ;; + *) + AC_CHECK_FUNC( + [posix_memalign], + [if test "$cross_compiling" != yes; then +AC_TRY_RUN([ +#include <stdlib.h> +int main(void) { + void *ptr = NULL; + int error; + size_t alignment = 0x40000, size = 0x20028; + if ((error = posix_memalign(&ptr, alignment, size)) != 0 || ptr == NULL) + return error; + return 0; +} +],AC_DEFINE(HAVE_POSIX_MEMALIGN,[1], + [Define to 1 if you have the `posix_memalign' function.]) +) + else + AC_DEFINE(HAVE_POSIX_MEMALIGN,[1], + [Define to 1 if you have the `posix_memalign' function.]) + fi]);; +esac + dnl writev on OS X snow leopard is broken for files > 4GB case $host_os in darwin10.8.0) |