This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add the files from dist/meta to perl's repo
[metaconfig.git] / dist / U / cpp_trad.U
1 ?RCS: $Id: cpp_trad.U 1 2006-08-24 12:32:52Z rmanfredi $
2 ?RCS:
3 ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
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 4.0.
10 ?RCS:
11 ?RCS: $Log: cpp_stuff.U,v $
12 ?MAKE:cpp_trad: cpp cat contains rm
13 ?MAKE:  -pick add $@ %<
14 ?S:cpp_trad:
15 ?S:     This variable contains the program to run to get traditional C
16 ?S:     preprocessor semantics and not ISO C semantics: we want something
17 ?S:     that knows as little about C as possible to use as a more general
18 ?S:     purpose preprocessor.
19 ?S:.
20 ?F:!foo.c !foo.cpp
21 : how do we get traditional cpp semantics?
22 echo " "
23 echo "Checking to see how to get traditional cpp semantics..." >&4
24 $cat >foo.c <<'EOF'
25 #define A(x) x
26 #define B(y) y
27 A(a)B(b)
28 EOF
29 if $cpp foo.c >foo.cpp; $contains ab foo.cpp >/dev/null 2>&1; then
30         echo "Plain '$cpp' works just fine."
31         cpp_trad="$cpp"
32 elif $cpp -traditional foo.c >foo.cpp; \
33         $contains ab foo.cpp >/dev/null 2>&1; then
34         echo "We'll use '$cpp -traditional' to get proper semantics."
35         cpp_trad="$cpp -traditional"
36 else
37         echo "I don't know how to get traditional semantics with '$cpp'." >&4
38         cpp_trad="$cpp"
39 fi
40 $rm -f foo.c foo.cpp
41