Commit | Line | Data |
---|---|---|
546a4462 DD |
1 | ?RCS: $Id$ |
2 | ?RCS: | |
3 | ?RCS: Copyright (c) 2000, Jarkko Hietaniemi | |
0065f4af | 4 | ?RCS: |
65a32477 | 5 | ?RCS: You may redistribute only under the terms of the Artistic License, |
546a4462 DD |
6 | ?RCS: as specified in the README file that comes with the distribution. |
7 | ?RCS: You may reuse parts of this distribution only within the terms of | |
65a32477 | 8 | ?RCS: that same Artistic License; a copy of which may be found at the root |
546a4462 DD |
9 | ?RCS: of the source tree for dist 3.0. |
10 | ?RCS: | |
4c42341b | 11 | ?MAKE:need_va_copy: rm_try cat Compile i_stdarg i_stdlib run |
546a4462 DD |
12 | ?MAKE: -pick add $@ %< |
13 | ?S:need_va_copy: | |
14 | ?S: This symbol, if defined, indicates that the system stores | |
15 | ?S: the variable argument list datatype, va_list, in a format | |
16 | ?S: that cannot be copied by simple assignment, so that some | |
17 | ?S: other means must be used when copying is required. | |
18 | ?S: As such systems vary in their provision (or non-provision) | |
19 | ?S: of copying mechanisms, handy.h defines a platform- | |
20 | ?S: independent macro, Perl_va_copy(src, dst), to do the job. | |
21 | ?S:. | |
22 | ?C:NEED_VA_COPY: | |
23 | ?C: This symbol, if defined, indicates that the system stores | |
24 | ?C: the variable argument list datatype, va_list, in a format | |
25 | ?C: that cannot be copied by simple assignment, so that some | |
26 | ?C: other means must be used when copying is required. | |
27 | ?C: As such systems vary in their provision (or non-provision) | |
28 | ?C: of copying mechanisms, handy.h defines a platform- | |
29 | ?C: independent macro, Perl_va_copy(src, dst), to do the job. | |
30 | ?C:. | |
31 | ?H:#$need_va_copy NEED_VA_COPY /**/ | |
32 | ?H:. | |
33 | ?T:okay | |
0065f4af | 34 | ?F:!try |
546a4462 DD |
35 | : see if we need va_copy |
36 | echo " " | |
37 | case "$i_stdarg" in | |
38 | "$define") | |
39 | $cat >try.c <<EOCP | |
40 | #include <stdarg.h> | |
41 | #include <stdio.h> | |
7ac90f39 JH |
42 | #$i_stdlib I_STDLIB |
43 | #ifdef I_STDLIB | |
44 | #include <stdlib.h> | |
45 | #endif | |
46 | #include <signal.h> | |
546a4462 DD |
47 | |
48 | int | |
49 | ivfprintf(FILE *f, const char *fmt, va_list *valp) | |
50 | { | |
51 | return vfprintf(f, fmt, *valp); | |
52 | } | |
2cb64bf6 MB |
53 | |
54 | int | |
546a4462 DD |
55 | myvfprintf(FILE *f, const char *fmt, va_list val) |
56 | { | |
57 | return ivfprintf(f, fmt, &val); | |
58 | } | |
2cb64bf6 | 59 | |
546a4462 | 60 | int |
2cb64bf6 | 61 | myprintf(char *fmt, ...) |
546a4462 DD |
62 | { |
63 | va_list val; | |
64 | va_start(val, fmt); | |
2cb64bf6 MB |
65 | return myvfprintf(stdout, fmt, val); |
66 | } | |
546a4462 DD |
67 | |
68 | int | |
69 | main(int ac, char **av) | |
70 | { | |
7ac90f39 JH |
71 | signal(SIGSEGV, exit); |
72 | ||
2cb64bf6 MB |
73 | myprintf("%s%cs all right, then\n", "that", '\''); |
74 | exit(0); | |
546a4462 DD |
75 | } |
76 | EOCP | |
77 | set try | |
0f00356b JH |
78 | if eval $compile && $run ./try 2>&1 >/dev/null; then |
79 | case "`$run ./try`" in | |
546a4462 DD |
80 | "that's all right, then") |
81 | okay=yes | |
82 | ;; | |
83 | esac | |
84 | fi | |
85 | case "$okay" in | |
86 | yes) echo "It seems that you don't need va_copy()." >&4 | |
87 | need_va_copy="$undef" | |
88 | ;; | |
89 | *) echo "It seems that va_copy() or similar will be needed." >&4 | |
90 | need_va_copy="$define" | |
91 | ;; | |
92 | esac | |
2cb64bf6 | 93 | $rm_try |
546a4462 DD |
94 | ;; |
95 | *) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4 | |
7fd9ec4d | 96 | need_va_copy="$undef" |
546a4462 DD |
97 | ;; |
98 | esac | |
99 |