Test for memalign in configure.ac. Disable a test that uses memalign if it is not found.

Signed-off-by: Aliaksey Kandratsenka <alk@tut.by>
This commit is contained in:
Thomas Klausner 2014-02-25 21:40:11 +01:00 committed by Aliaksey Kandratsenka
parent bd9665ebbe
commit a7223c2a14
2 changed files with 3 additions and 0 deletions

View File

@ -116,6 +116,7 @@ AC_CHECK_TYPES([Elf32_Versym],,, [#include <elf.h>]) # for vdso_support.h
AC_CHECK_FUNCS(sbrk) # for tcmalloc to get memory AC_CHECK_FUNCS(sbrk) # for tcmalloc to get memory
AC_CHECK_FUNCS(geteuid) # for turning off services when run as root AC_CHECK_FUNCS(geteuid) # for turning off services when run as root
AC_CHECK_FUNCS(fork) # for the pthread_atfork setup AC_CHECK_FUNCS(fork) # for the pthread_atfork setup
AC_CHECK_FUNCS(memalign) # for a test case
AC_CHECK_HEADERS(features.h) # for vdso_support.h AC_CHECK_HEADERS(features.h) # for vdso_support.h
AC_CHECK_HEADERS(malloc.h) # some systems define stuff there, others not AC_CHECK_HEADERS(malloc.h) # some systems define stuff there, others not
AC_CHECK_HEADERS(sys/malloc.h) # where some versions of OS X put malloc.h AC_CHECK_HEADERS(sys/malloc.h) # where some versions of OS X put malloc.h

View File

@ -298,6 +298,7 @@ TEST(DebugAllocationTest, HugeAlloc) {
#endif #endif
} }
#ifdef HAVE_MEMALIGN
// based on test program contributed by mikesart@gmail.com aka // based on test program contributed by mikesart@gmail.com aka
// mikesart@valvesoftware.com. See issue-464. // mikesart@valvesoftware.com. See issue-464.
TEST(DebugAllocationTest, ReallocAfterMemalloc) { TEST(DebugAllocationTest, ReallocAfterMemalloc) {
@ -313,6 +314,7 @@ TEST(DebugAllocationTest, ReallocAfterMemalloc) {
int rv = memcmp(stuff, p, sizeof(stuff)); int rv = memcmp(stuff, p, sizeof(stuff));
EXPECT_EQ(rv, 0); EXPECT_EQ(rv, 0);
} }
#endif
int main(int argc, char** argv) { int main(int argc, char** argv) {
// If you run without args, we run the non-death parts of the test. // If you run without args, we run the non-death parts of the test.