5 # C Cross Referencing & Documentation tool. Version 1.5g.
7 # A script to generate the runtime configuration information for
8 # cxref-cpp so that it can imitate gcc.
10 # Written by Andrew M. Bishop
12 # This file Copyright 2004 Andrew M. Bishop
13 # It may be distributed under the GNU Public License, version 2, or
14 # any higher version. See section COPYING of the GNU Public license
15 # for conditions under which this file may be redistributed.
19 # (Default to the ones from the configure script).
24 cxref_cpp_defines
="@datadir@/cxref/cxref-cpp.defines"
26 # Chose the C compiler and output file to use if not specified.
27 # (Defaults to compiler found by configure script).
29 while [ ! $# = 0 ]; do
44 if [ "$CC" = "" ]; then
48 # Check if this is gcc or not.
49 # (Defaults to check made by configure script)
53 if [ "$GCC" = "" ]; then
55 # Some default paths if not gcc
59 INCLUDE_DIR1
=/usr
/local
/include
60 INCLUDE_DIR2
=/usr
/include
61 INCLUDE_DIR3
=/usr
/local
/include
63 # Write the predefines and include path to the file.
65 echo $PREDEFINES > $cxref_cpp_defines
66 echo $INCLUDE_DIR1 >> $cxref_cpp_defines
67 echo $INCLUDE_DIR2 >> $cxref_cpp_defines
68 echo $INCLUDE_DIR3 >> $cxref_cpp_defines
70 # Write the built-in #defines to the file.
72 echo "" >> $cxref_cpp_defines
76 # Run the compiler to work out the paths if gcc
78 $CC -E -v - < /dev
/null
> $cxref_cpp_defines 2>&1
80 PREDEFINES
=`$EGREP -e -D__GNUC $cxref_cpp_defines | tr ' ' '\012' | $EGREP -e '^-[AD]' | tr '\012' ' '`
82 INCLUDE_DIR1
=`awk '/include <.+> search/,/End of search/ {if(i==1)print $1;i++}' $cxref_cpp_defines`
83 INCLUDE_DIR2
=`awk '/include <.+> search/,/End of search/ {if(i==2)print $1;i++}' $cxref_cpp_defines`
84 INCLUDE_DIR3
=`awk '/include <.+> search/,/End of search/ {if(i==3)print $1;i++}' $cxref_cpp_defines`
86 # Write the predefines and include path to the file.
88 echo $PREDEFINES > $cxref_cpp_defines
89 echo $INCLUDE_DIR1 >> $cxref_cpp_defines
90 echo $INCLUDE_DIR2 >> $cxref_cpp_defines
91 echo $INCLUDE_DIR3 >> $cxref_cpp_defines
93 # Write the built-in #defines to the file.
95 $CC -E -dM - < /dev
/null
>> $cxref_cpp_defines 2>/dev
/null