This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Rely on C89 headers in U/perl/d_c99_variadic.U
[metaconfig.git] / U / perl / d_c99_variadic.U
CommitLineData
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:
563d45cb 9?MAKE:d_c99_variadic_macros: Compile Setvar cat rm_try run
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 22: see if the Compiler supports C99 variadic macros
563d45cb
AC
23echo "Checking for C99 variadic macros." >&4
24$cat >try.c <<EOCP
b38716fc
MB
25#include <stdio.h>
26#include <stdarg.h>
27
28#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
29
30int main() {
31 char buf[20];
32 foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
33 puts(buf);
34 return 0;
35}
36EOCP
563d45cb
AC
37set try
38if eval $compile && $run ./try 2>&1 >/dev/null; then
39 case "`$run ./try`" in
40 "123 456 789")
41 echo "You have C99 variadic macros." >&4
42 d_c99_variadic_macros="$define"
43 ;;
44 *)
45 echo "You don't have functional C99 variadic macros." >&4
b38716fc 46 d_c99_variadic_macros="$undef"
563d45cb
AC
47 ;;
48 esac
49else
50 echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
b38716fc 51 d_c99_variadic_macros="$undef"
563d45cb
AC
52fi
53$rm_try
b38716fc 54