2 # Return a full cpp specification, complete with system dependent flags.
4 # Syntax: cppmagic [ program-to-generate-flags [ guessed-cpp ]]
6 # If only one arg is present it is the name of a program to invoke
7 # which should generate -Dfoo defines.
9 # If two args are present the second arg is the name of the C
10 # preprocessor to use.
12 # Invoked with no args, provides a C preprocessor name and
13 # -traditional flag if that is appropriate.
15 # ../Makefile calls this file thusly: "cppmagic getcppsyms".
19 # /lib/cpp -Dunix -Dm68k
27 for cpp in /lib/cpp /usr/lib/cpp /usr/ccs/lib/cpp; do
32 if [ "$Cpp" = "" ]; then
40 # First flag might be `-traditional' if this is Gnu Cpp.
41 unknown_flag=`$Cpp -traditional /dev/null 2>&1 |
42 egrep 'known|recognized|valid|bad|legal'`
43 if [ "$unknown_flag" = "" ]; then
44 TRADITIONAL=-traditional
51 echo $Cpp $TRADITIONAL $FLAGS