From c19bc346386544574bae65e7979ae94603688496 Mon Sep 17 00:00:00 2001
From: Ralph Giles <giles@thaumas.net>
Date: Fri, 28 Oct 2011 07:14:58 -0700
Subject: [PATCH] Check for __malloc_hook and define MALLOC_FAIL appropriately.

The glibc 2.14 NEWS file says __malloc_hook will be removed
in the next release, so future-proof our use by checking
for this symbol at configure time and only compiling the
malloc failure tests if it is present.
---
 configure.ac          | 1 +
 tests/test_opus_api.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 656ee3716..b689c6417 100644
--- a/configure.ac
+++ b/configure.ac
@@ -185,6 +185,7 @@ fi
 
 AC_CHECK_FUNCS([lrintf])
 AC_CHECK_FUNCS([lrint])
+AC_CHECK_FUNCS([__malloc_hook])
 
 AC_CHECK_SIZEOF(short)
 AC_CHECK_SIZEOF(int)
diff --git a/tests/test_opus_api.c b/tests/test_opus_api.c
index 2a451e453..4246d16fd 100644
--- a/tests/test_opus_api.c
+++ b/tests/test_opus_api.c
@@ -61,7 +61,7 @@
 #define VG_CHECK(x,y)
 #endif
 
-#ifdef __GLIBC__
+#if defined(__GLIBC__) && defined(HAVE___MALLOC_HOOK)
 #define MALLOC_FAIL
 #include "os_support.h"
 #include <malloc.h>
-- 
GitLab