Commit 665cfa49812685e24631a89fe7a9cabd8653c7b5

Ozkan Sezer 2020-10-13T14:32:15

cmake: check for alloca() in stdlib.h and malloc.h, too (bug #5316)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e622189..9400258 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -848,7 +848,12 @@ if(LIBC)
 
     if(NOT APPLE)
       check_include_file(alloca.h HAVE_ALLOCA_H)
-      check_symbol_exists(alloca "alloca.h" HAVE_ALLOCA)
+      check_symbol_exists(alloca "alloca.h" HAVE_ALLOCA1)
+      check_symbol_exists(alloca "stdlib.h" HAVE_ALLOCA2)
+      check_symbol_exists(alloca "malloc.h" HAVE_ALLOCA3)
+      if(HAVE_ALLOCA1 OR HAVE_ALLOCA2 OR HAVE_ALLOCA3)
+        set(HAVE_ALLOCA 1)
+      endif()
     else()
       set(HAVE_ALLOCA_H 1)
       set(HAVE_ALLOCA 1)