This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Major *try* cleanup: introduce $rm_try
[metaconfig.git] / U / perl / d_cplusplus.U
1 ?RCS: Copyright (c) 2005-2007 H.Merijn Brand
2 ?RCS:
3 ?RCS: You may distribute under the terms of either the GNU General Public
4 ?RCS: License or the Artistic License, as specified in the README file.
5 ?RCS:
6 ?MAKE:d_cplusplus: Compile Setvar run cat rm_try
7 ?MAKE:  -pick add $@ %<
8 ?S:d_cplusplus (d_cplusplus.U):
9 ?S:     This variable conditionally defines the USE_CPLUSPLUS symbol, which
10 ?S:     indicates that a C++ compiler was used to compiled Perl and will be
11 ?S:     used to compile extensions.
12 ?S:.
13 ?C:USE_CPLUSPLUS:
14 ?C:     This symbol, if defined, indicates that a C++ compiler was
15 ?C:     used to compiled Perl and will be used to compile extensions.
16 ?C:.
17 ?H:#$d_cplusplus USE_CPLUSPLUS          /**/
18 ?H:.
19 ?LINT:set d_cplusplus
20
21 echo " "
22 echo "Checking for C++..." >&4
23 cat >try.c <<'EOCP'
24 #include <stdio.h>
25 int main(void)
26 {
27 #ifdef __cplusplus
28     printf("define\n");
29 #else
30     printf("undef\n");
31 #endif
32     return 0;
33 }
34 EOCP
35 set try
36 if eval $compile_ok && $run ./try >cplusplus$$; then
37         val=`$cat cplusplus$$`
38         echo "You are using a C++ compiler."
39 else
40         val="$undef"
41         echo "You are not using a C++ compiler."
42 fi
43 $rm_try cplusplus$$
44 set d_cplusplus
45 eval $setvar
46