Add va-copy check to configure.ac
authorGeoff Levand <geoff@infradead.org>
Sat, 12 Nov 2011 21:42:31 +0000 (13:42 -0800)
committerGeoff Levand <geoff@infradead.org>
Sat, 12 Nov 2011 22:05:19 +0000 (14:05 -0800)
Signed-off-by: Geoff Levand <geoff@infradead.org>
configure.ac
lib/talloc/talloc.c

index d9fe8ad9cdb87688f86b2ca24d1866e7c63689f0..d12355667c303d52832b0208524853ff6b281e59 100644 (file)
@@ -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])],
index c660870543a83ff4d6dcee74ac516f599bd0709b..95a0a6a0b395a82990170e1efae5227f8fdce544 100644 (file)
   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>