Commit | Line | Data |
---|---|---|
2cb64bf6 | 1 | ?RCS: Copyright (c) 2006-2007, H.Merijn Brand |
b38716fc | 2 | ?RCS: |
65a32477 | 3 | ?RCS: You may redistribute only under the terms of the Artistic License, |
b38716fc MB |
4 | ?RCS: as specified in the README file that comes with the distribution. |
5 | ?RCS: You may reuse parts of this distribution only within the terms of | |
65a32477 | 6 | ?RCS: that same Artistic License; a copy of which may be found at the root |
b38716fc MB |
7 | ?RCS: of the source tree for dist 3.0. |
8 | ?RCS: | |
2cb64bf6 | 9 | ?MAKE:d_c99_variadic_macros: Compile Setvar cat rm_try run i_stdarg i_stdlib |
b38716fc MB |
10 | ?MAKE: -pick add $@ %< |
11 | ?S:d_c99_variadic_macros: | |
12 | ?S: This variable conditionally defines the HAS_C99_VARIADIC_MACROS | |
13 | ?S: symbol, which indicates to the C program that C99 variadic macros | |
14 | ?S: are available. | |
15 | ?S:. | |
16 | ?C:HAS_C99_VARIADIC_MACROS: | |
17 | ?C: If defined, the compiler supports C99 variadic macros. | |
18 | ?C:. | |
19 | ?H:#$d_c99_variadic_macros HAS_C99_VARIADIC_MACROS /**/ | |
20 | ?H:. | |
0065f4af | 21 | ?F:!try |
b38716fc MB |
22 | : see if the Compiler supports C99 variadic macros |
23 | case "$i_stdarg$i_stdlib" in | |
24 | "$define$define") | |
25 | echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4 | |
26 | $cat >try.c <<EOCP | |
27 | #include <stdio.h> | |
28 | #include <stdarg.h> | |
29 | ||
30 | #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__) | |
31 | ||
32 | int main() { | |
33 | char buf[20]; | |
34 | foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail"); | |
35 | puts(buf); | |
36 | return 0; | |
37 | } | |
38 | EOCP | |
39 | set try | |
40 | if eval $compile && $run ./try 2>&1 >/dev/null; then | |
41 | case "`$run ./try`" in | |
42 | "123 456 789") | |
43 | echo "You have C99 variadic macros." >&4 | |
44 | d_c99_variadic_macros="$define" | |
45 | ;; | |
46 | *) | |
47 | echo "You don't have functional C99 variadic macros." >&4 | |
48 | d_c99_variadic_macros="$undef" | |
49 | ;; | |
50 | esac | |
51 | else | |
52 | echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4 | |
53 | d_c99_variadic_macros="$undef" | |
54 | fi | |
2cb64bf6 | 55 | $rm_try |
b38716fc MB |
56 | ;; |
57 | *) | |
58 | echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4 | |
59 | d_c99_variadic_macros="$undef" | |
60 | ;; | |
61 | esac | |
62 |