From 936f52ca0ef4729f26dec092ef8388d2d4c0bf07 Mon Sep 17 00:00:00 2001
From: Gregory Maxwell <greg@xiph.org>
Date: Sun, 13 May 2012 11:40:19 -0400
Subject: [PATCH] Add #errors when !OPUS_BUILD or
 !(VAR_ARRAYS||USE_ALLOCA||NONTHREADSAFE_PSEUDOSTACK).

This will help prevent people using non-standard build environments from
footgunning themselves and becoming a support burden.
---
 celt/stack_alloc.h | 4 ++++
 src/opus_decoder.c | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/celt/stack_alloc.h b/celt/stack_alloc.h
index 68569e2b1..a6f06d226 100644
--- a/celt/stack_alloc.h
+++ b/celt/stack_alloc.h
@@ -32,6 +32,10 @@
 #ifndef STACK_ALLOC_H
 #define STACK_ALLOC_H
 
+#if (!defined (VAR_ARRAYS) && !defined (USE_ALLOCA) && !defined (NONTHREADSAFE_PSEUDOSTACK))
+#error "Opus requires one of VAR_ARRAYS, USE_ALLOCA, or NONTHREADSAFE_PSEUDOSTACK be defined to select the temporary allocation mode."
+#endif
+
 #ifdef USE_ALLOCA
 # ifdef WIN32
 #  include <malloc.h>
diff --git a/src/opus_decoder.c b/src/opus_decoder.c
index 204ed037d..e7941f160 100644
--- a/src/opus_decoder.c
+++ b/src/opus_decoder.c
@@ -29,6 +29,10 @@
 #include "config.h"
 #endif
 
+#ifndef OPUS_BUILD
+#error "OPUS_BUILD _MUST_ be defined to build Opus and you probably want a decent config.h, see README for more details."
+#endif
+
 #include <stdarg.h>
 #include "celt.h"
 #include "opus.h"
-- 
GitLab