Remove generated files
[framework/connectivity/libgphoto2.git] / libgphoto2_port / m4 / gp-va-copy.m4
1 dnl @synopsis GP_VA_COPY
2 dnl
3 dnl Checks whether one of these compiles and links:
4 dnl 1. va_copy()
5 dnl 2. __va_copy()
6 dnl 3. fallback
7 dnl
8 dnl In case of 1 or 2, AC_DEFINE(HAVE_VA_COPY).
9 dnl In case of 2, AC_DEFINE(va_copy,__va_copy)
10 dnl
11 dnl In code, use it like this
12 dnl #ifdef HAVE_VA_COPY
13 dnl    ... code with va_copy ...
14 dnl #else
15 dnl    ... code without va_copy or with error ...
16 dnl #endif
17 dnl
18 AC_DEFUN([GP_VA_COPY],[dnl
19 dnl
20 AC_CHECK_HEADER([stdarg.h],[],[
21         AC_MSG_ERROR([
22 Building $PACKAGE_NAME requires <stdarg.h>.
23 ])
24 ])
25 dnl
26 have_va_copy=no
27 AC_TRY_LINK([
28         #include <stdarg.h>
29 ],[
30         va_list a,b;
31         va_copy(a,b);
32 ],[
33         have_va_copy="va_copy"
34 ],[
35         AC_TRY_LINK([
36                 #include <stdarg.h>
37         ],[
38                 va_list a,b;
39                 __va_copy(a,b);
40         ],[
41                 have_va_copy="__va_copy"
42                 AC_DEFINE([va_copy],[__va_copy],[__va_copy() was the originally proposed name])
43         ])
44 ])
45 dnl
46 AC_MSG_CHECKING([for va_copy() or replacement])
47 AC_MSG_RESULT([$have_va_copy])
48 dnl
49 if test "x$have_va_copy" != "xno"; then
50         AC_DEFINE([HAVE_VA_COPY],1,[Whether we have the va_copy() function])
51 fi
52 ])dnl
53 dnl
54 dnl
55 dnl Local Variables:
56 dnl mode: autoconf
57 dnl End: