[Cbe-oss-dev] [PATCH 13/13]MARS/core: Add alloca header check

Yuji Mano yuji.mano at am.sony.com
Fri Dec 12 15:34:11 EST 2008


From: Kazunori Asayama <asayama at sm.sony.co.jp>

Add check for alloca header before including it

This patch adds check for alloca header before including it to avoid
build error.

Signed-off-by: Kazunori Asayama <asayama at sm.sony.co.jp>
---
 core/include/host/mars/core.h             |    7 +++++++
 core/include/host/mars/core_features.h.in |    4 ++++
 scripts/acinclude.m4                      |   10 ++++++++++
 3 files changed, 21 insertions(+)

Index: b/core/include/host/mars/core.h
===================================================================
--- a/core/include/host/mars/core.h	2008-12-11 12:10:12.000000000 +0900
+++ b/core/include/host/mars/core.h	2008-12-11 13:16:25.000000000 +0900
@@ -46,7 +46,14 @@
 
 #include <stddef.h>
 #include <stdint.h>
+
+#ifdef MARS_HAVE_ALLOCA_H
 #include <alloca.h>
+#else
+#ifdef MARS_HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#endif
 
 #if defined(__cplusplus)
 extern "C" {
Index: b/core/include/host/mars/core_features.h.in
===================================================================
--- a/core/include/host/mars/core_features.h.in	2008-12-11 12:44:57.000000000 +0900
+++ b/core/include/host/mars/core_features.h.in	2008-12-11 13:16:25.000000000 +0900
@@ -40,4 +40,8 @@
 
 #undef MARS_ENABLE_DISCRETE_SHARED_MEMORY
 
+#undef MARS_HAVE_ALLOCA_H
+
+#undef MARS_HAVE_MALLOC_H
+
 #endif
Index: b/scripts/acinclude.m4
===================================================================
--- a/scripts/acinclude.m4	2008-12-11 12:10:12.000000000 +0900
+++ b/scripts/acinclude.m4	2008-12-11 13:16:25.000000000 +0900
@@ -125,9 +125,19 @@ fi
 AM_CONDITIONAL([NUMA], [test "x${enable_numa}" = "xyes"])
 ]) # AC_CONFIG_MARS_NUMA
 
+AC_DEFUN([AC_CHECK_MARS_ALLOCA],[
+AC_CHECK_HEADER([alloca.h],
+	[AC_DEFINE([MARS_HAVE_ALLOCA_H],[1],
+		[Define to 1 if you have the <alloca.h> header file.])])
+AC_CHECK_HEADER([malloc.h],
+	[AC_DEFINE([MARS_HAVE_MALLOC_H],[1],
+		[Define to 1 if you have the <malloc.h> header file.])])
+]) # AC_CHECK_MARS_ALLOCA
+
 AC_DEFUN([AC_CONFIG_MARS_HOST],[
 AC_CONFIG_MARS
 AC_CONFIG_MARS_NUMA
+AC_CHECK_MARS_ALLOCA
 ]) # AC_CONFIG_MARS_HOST
 
 





More information about the cbe-oss-dev mailing list