summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeoff Levand <geoff@infradead.org>2011-11-12 13:42:31 -0800
committerGeoff Levand <geoff@infradead.org>2011-11-12 14:05:19 -0800
commitf5d6bf0af6aa5e6f1d51e00a617910ddfb76e32c (patch)
treef9988d56b6470e79a0f7aa2b7e34c158fae2c110
parentb8e57298d53e38d660128a795a4c12ecccfde964 (diff)
downloadtalos-petitboot-f5d6bf0af6aa5e6f1d51e00a617910ddfb76e32c.tar.gz
talos-petitboot-f5d6bf0af6aa5e6f1d51e00a617910ddfb76e32c.zip
Add va-copy check to configure.ac
Signed-off-by: Geoff Levand <geoff@infradead.org>
-rw-r--r--configure.ac25
-rw-r--r--lib/talloc/talloc.c13
2 files changed, 32 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index d9fe8ad..d123556 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,6 +29,31 @@ fi
AC_PROG_CC
AC_PROG_INSTALL
+AC_CHECK_HEADERS([stdarg.h])
+AC_CHECK_HEADERS([varargs.h])
+#AC_CHECK_FUNCS([va_copy])
+
+dnl Checking for va_copy availability
+AC_MSG_CHECKING([for va_copy])
+AC_TRY_LINK([#include <stdarg.h>
+va_list ap1,ap2;], [va_copy(ap1,ap2);],
+have_va_copy=yes,
+have_va_copy=no)
+AC_MSG_RESULT($have_va_copy)
+if test x"$have_va_copy" = x"yes"; then
+ AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
+else
+ AC_MSG_CHECKING([for __va_copy])
+ AC_TRY_LINK([#include <stdarg.h>
+ va_list ap1,ap2;], [__va_copy(ap1,ap2);],
+ have___va_copy=yes,
+ have___va_copy=no)
+ AC_MSG_RESULT($have___va_copy)
+ if test x"$have___va_copy" = x"yes"; then
+ AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
+ fi
+fi
+
AC_ARG_ENABLE([ps3],
[AS_HELP_STRING([--enable-ps3],
[build support for the PS3 game console])],
diff --git a/lib/talloc/talloc.c b/lib/talloc/talloc.c
index c660870..95a0a6a 100644
--- a/lib/talloc/talloc.c
+++ b/lib/talloc/talloc.c
@@ -26,19 +26,20 @@
inspired by http://swapped.cc/halloc/
*/
-
+#if defined(HAVE_CONFIG_H)
#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
+#else
/* nfsim additions */
#define HAVE_SYS_TYPES_H
#define HAVE_UNISTD_H
#define HAVE_STDARG_H
#define HAVE_STDINT_H
#define HAVE_VA_COPY
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
OpenPOWER on IntegriCloud