ruby-changes:22177
From: naruse <ko1@a...>
Date: Sun, 8 Jan 2012 00:13:48 +0900 (JST)
Subject: [ruby-changes:22177] naruse:r34226 (trunk): * configure.in: check posix_memalign(3) and menalign(3).
naruse 2012-01-08 00:13:37 +0900 (Sun, 08 Jan 2012) New Revision: 34226 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34226 Log: * configure.in: check posix_memalign(3) and menalign(3). * gc.c (aligned_malloc): use configure's result instead of _POSIX_C_SOURCE and _XOPEN_SOURCE because they can't be used to check availability at least on FreeBSD. Modified files: trunk/ChangeLog trunk/configure.in trunk/gc.c Index: configure.in =================================================================== --- configure.in (revision 34225) +++ configure.in (revision 34226) @@ -1393,7 +1393,7 @@ setuid setgid daemon select_large_fdset setenv unsetenv\ mktime timegm gmtime_r clock_gettime gettimeofday poll ppoll\ pread sendfile shutdown sigaltstack dl_iterate_phdr\ - dup3 pipe2) + dup3 pipe2 posix_memalign memalign) AC_CACHE_CHECK(for unsetenv returns a value, rb_cv_unsetenv_return_value, [AC_TRY_COMPILE([ Index: ChangeLog =================================================================== --- ChangeLog (revision 34225) +++ ChangeLog (revision 34226) @@ -1,3 +1,11 @@ +Sun Jan 8 00:10:10 2012 NARUSE, Yui <naruse@r...> + + * configure.in: check posix_memalign(3) and menalign(3). + + * gc.c (aligned_malloc): use configure's result instead of + _POSIX_C_SOURCE and _XOPEN_SOURCE because they can't be used + to check availability at least on FreeBSD. + Sat Jan 7 22:25:50 2012 Narihiro Nakamura <authornari@g...> * gc.c: use Bitmap Marking algorithm to avoid copy-on-write of Index: gc.c =================================================================== --- gc.c (revision 34225) +++ gc.c (revision 34226) @@ -24,7 +24,6 @@ #include <stdio.h> #include <setjmp.h> #include <sys/types.h> -#include <malloc.h> #include <assert.h> #ifdef HAVE_SYS_TIME_H @@ -39,6 +38,10 @@ #include <windows.h> #endif +#if !defined(__MINGW32__) && !defined(_WIN32) && !defined(__CYGWIN__) &&!defined(HAVE_POSIX_MEMALIGN) &&defined(HAVE_MEMALIGN) +#include <malloc.h> +#endif + #ifdef HAVE_VALGRIND_MEMCHECK_H # include <valgrind/memcheck.h> # ifndef VALGRIND_MAKE_MEM_DEFINED @@ -1061,16 +1064,16 @@ res = __mingw_aligned_malloc(aligned_size, aligned_size); #elif _WIN32 || defined __CYGWIN__ res = _aligned_malloc(aligned_size, aligned_size); -#else -# if _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 +#elif defined(HAVE_POSIX_MEMALIGN) if (posix_memalign(&res, aligned_size, aligned_size) == 0) { return res; } else { return NULL; } -# else +#elif defined(HAVE_MEMALIGN) res = memalign(aligned_size, aligned_size); -# endif +#else +#error no memalign function #endif return res; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/