File: find_flags

package info (click to toggle)
gccxml 0.7.0%2Bcvs20060311-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 45,240 kB
  • ctags: 59,007
  • sloc: ansic: 589,435; asm: 19,610; cpp: 12,681; sh: 4,326; yacc: 3,727; makefile: 3,074; perl: 318; lex: 307; awk: 117; pascal: 78; sed: 20
file content (137 lines) | stat: -rwxr-xr-x 3,673 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/bin/sh
#=============================================================================
#
#  Program:   GCC-XML
#  Module:    $RCSfile: find_flags,v $
#  Language:  C++
#  Date:      $Date: 2005/08/01 22:11:33 $
#  Version:   $Revision: 1.5 $
#
#  Copyright (c) 2002 Kitware, Inc., Insight Consortium.  All rights reserved.
#  See Copyright.txt for details.
#
#     This software is distributed WITHOUT ANY WARRANTY; without even 
#     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
#     PURPOSE.  See the above copyright notices for more information.
#
#=============================================================================

# Find the MIPSPro executable name.
if test "x$1" = "x" ; then
  if test "x${CXX}" = "x" ; then
    CXX=CC
  fi
else 
  CXX="$1"
  shift
  CXXFLAGS="$@"
fi

GCCXML_PID="$$"
TESTFILE="find_flags_temp$GCCXML_PID"

# Construct a test input file that checks for some builtin definitions
# in the compiler that are not displayed by the -v option.  This list
# was obtained by running "strings /usr/lib32/cmplrs/fecc" and testing
# for definitions with a giant version of the string below.
echo "
#ifdef _BOOL
D_BOOL _BOOL
#endif
#ifdef _EXPLICIT_IS_KEYWORD
D_EXPLICIT_IS_KEYWORD _EXPLICIT_IS_KEYWORD
#endif
#ifdef _LIBC_IN_NAMESPACE_STD_
D_LIBC_IN_NAMESPACE_STD_ _LIBC_IN_NAMESPACE_STD_
#endif
#ifdef _MEMBER_TEMPLATES
D_MEMBER_TEMPLATES _MEMBER_TEMPLATES
#endif
#ifdef _MUTABLE_IS_KEYWORD
D_MUTABLE_IS_KEYWORD _MUTABLE_IS_KEYWORD
#endif
#ifdef _NAMESPACES
D_NAMESPACES _NAMESPACES
#endif
#ifdef _PARTIAL_SPECIALIZATION_OF_CLASS_TEMPLATES
D_PARTIAL_SPECIALIZATION_OF_CLASS_TEMPLATES _PARTIAL_SPECIALIZATION_OF_CLASS_TEMPLATES
#endif
#ifdef _STANDARD_C_PLUS_PLUS
D_STANDARD_C_PLUS_PLUS _STANDARD_C_PLUS_PLUS
#endif
#ifdef _TYPENAME_IS_KEYWORD
D_TYPENAME_IS_KEYWORD _TYPENAME_IS_KEYWORD
#endif
#ifdef _WCHAR_T
D_WCHAR_T _WCHAR_T
#endif
#ifdef _WCHAR_T_IS_KEYWORD
D_WCHAR_T_IS_KEYWORD _WCHAR_T_IS_KEYWORD
#endif
#ifdef __ANSI_CPP__
D__ANSI_CPP__ __ANSI_CPP__
#endif
#ifdef __ARRAY_OPERATORS
D__ARRAY_OPERATORS __ARRAY_OPERATORS
#endif
#ifdef __EDG_ABI_COMPATIBILITY_VERSION
D__EDG_ABI_COMPATIBILITY_VERSION __EDG_ABI_COMPATIBILITY_VERSION
#endif
#ifdef __EDG_RUNTIME_USES_NAMESPACES
D__EDG_RUNTIME_USES_NAMESPACES __EDG_RUNTIME_USES_NAMESPACES
#endif
#ifdef __EDG_VERSION__
D__EDG_VERSION__ __EDG_VERSION__
#endif
#ifdef __EDG__
D__EDG__ __EDG__
#endif
#ifdef __EXCEPTIONS
D__EXCEPTIONS __EXCEPTIONS
#endif
#ifdef __LIBC_MATH_OVERLOAD__
D__LIBC_MATH_OVERLOAD__ __LIBC_MATH_OVERLOAD__
#endif
#ifdef __RTTI
D__RTTI __RTTI
#endif
#ifdef __STDC__
D__STDC__ __STDC__
#endif
" > /tmp/$TESTFILE.cxx

# Find the macro definition options.
MACROS=`
${CXX} ${CXXFLAGS} -E -v /tmp/$TESTFILE.cxx 2>&1 |
sed -n '/_COMPILER_VERSION/{s/ \/tmp\/'$TESTFILE'.cxx.*$//
s/ -/\\
-/g;p;}' |
sed -n '/^-D.*$/{s/-D\([^=]*\)=\([^ ]\{1,\} .*\)/-D\1='\''\2'\''/;p;}' |
sed -n 'H;${g;s/\n/ /g;p;}'`

# Find the internally defined macros.
LANGSTD=`
${CXX} ${CXXFLAGS} -E -v /tmp/$TESTFILE.cxx 2>&1 |
sed -n '/^D/ {s/^D/-D/;s/ /=/;p;}' |
sed -n 'H;${g;s/\n/ /g;p;}'`

# Find the include path options.
INCLUDES=`
${CXX} ${CXXFLAGS} -E -v /tmp/$TESTFILE.cxx 2>&1 |
sed -n '/_COMPILER_VERSION/{s/ \/tmp\/'$TESTFILE'.cxx.*$//
s/ -/\\
-/g;p;}' |
sed -n '/^-I.*$/{p;}' |
sed -n 'H;${g;s/\n/ /g;p;}'`

# The support headers are located where this script is.
SELFPATH=`echo $0 | sed -n '/\//{s/\/find_flags//;p;}'`
if test "x$SELFPATH" = "x" ; then SELFPATH="." ; fi
SELFPATH=`cd "$SELFPATH" ; pwd`
INCLUDES="-iwrapper\"$SELFPATH/7.3\" $INCLUDES"

rm -f /tmp/$TESTFILE.cxx

# Format and print out the options.
OPTIONS="$MACROS $LANGSTD $INCLUDES"
echo $OPTIONS