1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
diff --git a/config/matio_va_copy.m4 b/config/matio_va_copy.m4
index 9233d87..dc0ab5e 100644
--- a/config/matio_va_copy.m4
+++ b/config/matio_va_copy.m4
@@ -14,82 +14,15 @@ dnl ## try various possible implementations in sequence and second, we
dnl ## cannot define a macro in config.h with parameters directly.
dnl ##
-dnl # test program for va_copy() implementation
-changequote(<<,>>)
-m4_define(__va_copy_test, <<[
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#define DO_VA_COPY(d, s) $1
-void test(char *str, ...)
-{
- va_list ap, ap2;
- int i;
- va_start(ap, str);
- DO_VA_COPY(ap2, ap);
- for (i = 1; i <= 9; i++) {
- int k = (int)va_arg(ap, int);
- if (k != i)
- abort();
- }
- DO_VA_COPY(ap, ap2);
- for (i = 1; i <= 9; i++) {
- int k = (int)va_arg(ap, int);
- if (k != i)
- abort();
- }
- va_end(ap);
-}
-int main(int argc, char *argv[])
-{
- test("test", 1, 2, 3, 4, 5, 6, 7, 8, 9);
- exit(0);
-}
-]>>)
-changequote([,])
-
-dnl # test driver for va_copy() implementation
-m4_define(__va_copy_check, [
- AH_VERBATIM($1,
-[/* Predefined possible va_copy() implementation (id: $1) */
-#define __VA_COPY_USE_$1(d, s) $2])
- if test ".$ac_cv_va_copy" = .; then
- AC_RUN_IFELSE([AC_LANG_SOURCE([__va_copy_test($2)])],[ac_cv_va_copy="$1"],[],[])
- fi
-])
-
-dnl # Autoconf check for va_copy() implementation checking
+dnl # Autoconf check for va_copy() implementation fake checking
AC_DEFUN([AC_CHECK_VA_COPY],[
dnl # provide Autoconf display check message
- AC_MSG_CHECKING(for va_copy() function)
- dnl # check for various implementations in priorized sequence
+ AC_MSG_CHECKING(for va_copy() function (fake, always yes))
+ dnl # assume C99
AC_CACHE_VAL(ac_cv_va_copy, [
- ac_cv_va_copy=""
- dnl # 1. check for standardized C99 macro
- __va_copy_check(C99, [va_copy((d), (s))])
- dnl # 2. check for alternative/deprecated GCC macro
- __va_copy_check(GCM, [VA_COPY((d), (s))])
- dnl # 3. check for internal GCC macro (high-level define)
- __va_copy_check(GCH, [__va_copy((d), (s))])
- dnl # 4. check for internal GCC macro (built-in function)
- __va_copy_check(GCB, [__builtin_va_copy((d), (s))])
- dnl # 5. check for assignment approach (assuming va_list is a struct)
- __va_copy_check(ASS, [do { (d) = (s); } while (0)])
- dnl # 6. check for assignment approach (assuming va_list is a pointer)
- __va_copy_check(ASP, [do { *(d) = *(s); } while (0)])
- dnl # 7. check for memory copying approach (assuming va_list is a struct)
- __va_copy_check(CPS, [memcpy((void *)&(d), (void *)&(s)), sizeof((s))])
- dnl # 8. check for memory copying approach (assuming va_list is a pointer)
- __va_copy_check(CPP, [memcpy((void *)(d), (void *)(s)), sizeof(*(s))])
- if test ".$ac_cv_va_copy" = .; then
- AC_MSG_ERROR(no working implementation found)
- fi
+ ac_cv_va_copy="C99"
])
- dnl # optionally activate the fallback implementation
- if test ".$ac_cv_va_copy" = ".C99"; then
- AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy() macro exists (and no fallback implementation is required)])
- fi
- dnl # declare which fallback implementation to actually use
+ AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy() macro exists (and no fallback implementation is required)])
AC_DEFINE_UNQUOTED([__VA_COPY_USE], [__VA_COPY_USE_$ac_cv_va_copy],
[Define to id of used va_copy() implementation])
dnl # provide activation hook for fallback implementation
@@ -100,10 +33,6 @@ AC_DEFUN([AC_CHECK_VA_COPY],[
#endif
])
dnl # provide Autoconf display result message
- if test ".$ac_cv_va_copy" = ".C99"; then
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no (using fallback implementation)])
- fi
+ AC_MSG_RESULT([yes])
])
|