r17264: - remove unused includes from talloc
authorStefan Metzmacher <metze@samba.org>
Wed, 26 Jul 2006 17:34:50 +0000 (17:34 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:10:25 +0000 (14:10 -0500)
- check explicit check for varargs.h as fallback from stdarg.h
  and fail the build if both are not present

metze
(This used to be commit b091d182fe8f36dfb67b7ede933a963b74034d91)

source4/lib/talloc/config.m4
source4/lib/talloc/talloc.c

index d4c68ca52b73da791013f01563bf0616c40ef267..0286bde6c2805581cdceff94aa7f044e4c6cf952 100644 (file)
@@ -1,3 +1,6 @@
+AC_CHECK_HEADERS(stdarg.h vararg.h)
+
+dnl VA_COPY
 AC_CACHE_CHECK([for va_copy],samba_cv_HAVE_VA_COPY,[
 AC_TRY_LINK([#include <stdarg.h>
 va_list ap1,ap2;], [va_copy(ap1,ap2);],
@@ -6,8 +9,17 @@ if test x"$samba_cv_HAVE_VA_COPY" = x"yes"; then
     AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
 fi
 
+if test x"$samba_cv_HAVE_VA_COPY" != x"yes"; then
+AC_CACHE_CHECK([for __va_copy],samba_cv_HAVE___VA_COPY,[
+AC_TRY_LINK([#include <stdarg.h>
+va_list ap1,ap2;], [__va_copy(ap1,ap2);],
+samba_cv_HAVE___VA_COPY=yes,samba_cv_HAVE___VA_COPY=no)])
+if test x"$samba_cv_HAVE___VA_COPY" = x"yes"; then
+    AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
+fi
+fi
+
 AC_CHECK_TYPE(intptr_t, unsigned long long)
-AC_CHECK_HEADERS(stdint.h stdarg.h unistd.h sys/types.h)
 AC_CHECK_SIZEOF(size_t,cross)
 AC_CHECK_SIZEOF(void *,cross)
 
index ca76b0533291be3bc3799925bd52b8cd901b5ca7..5a14109190b559ffb94a676d7be141873f855f78 100644 (file)
 #include <string.h>
 #include <errno.h>
 
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef HAVE_STDARG_H
+#if defined(HAVE_STDARG_H)
 #include <stdarg.h>
-#else
+#elif defined (HAVE_VARARGS_H)
 #include <varargs.h>
-#endif
-
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
+#else
+#error "no var arg header"
 #endif
 
 #include "talloc.h"