This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add probe for isblank() (requested by khw)
[metaconfig.git] / U / perl / need_va_copy.U
1 ?RCS: $Id$
2 ?RCS:
3 ?RCS: Copyright (c) 2000, Jarkko Hietaniemi
4 ?RCS:
5 ?RCS: You may redistribute only under the terms of the Artistic Licence,
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
8 ?RCS: that same Artistic Licence; a copy of which may be found at the root
9 ?RCS: of the source tree for dist 3.0.
10 ?RCS:
11 ?MAKE:need_va_copy: rm_try cat Compile i_stdarg i_stdlib run
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
34 ?F:!try
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>
42 #$i_stdlib I_STDLIB
43 #ifdef I_STDLIB
44 #include <stdlib.h>
45 #endif
46 #include <signal.h>
47
48 int
49 ivfprintf(FILE *f, const char *fmt, va_list *valp)
50 {
51   return vfprintf(f, fmt, *valp);
52 }
53
54 int
55 myvfprintf(FILE *f, const  char *fmt, va_list val)
56 {
57   return ivfprintf(f, fmt, &val);
58 }
59
60 int
61 myprintf(char *fmt, ...)
62 {
63   va_list val;
64   va_start(val, fmt);
65   return myvfprintf(stdout, fmt, val);
66 }
67
68 int
69 main(int ac, char **av)
70 {
71   signal(SIGSEGV, exit);
72
73   myprintf("%s%cs all right, then\n", "that", '\'');
74   exit(0);
75 }
76 EOCP
77         set try
78         if eval $compile && $run ./try 2>&1 >/dev/null; then
79                 case "`$run ./try`" in
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
93         $rm_try
94         ;;
95 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
96         ;;
97 esac
98