Commits

Anonymous committed 2041d8e

ENH: Improved selection of -D options again. This version splits the output into a separate line for each option, and then operates only on the -D options.

Comments (0)

Files changed (2)

GCC_XML/find_gcc_options

 # These options are always needed.
 STANDARD="-quiet -o /dev/null -nostdinc -fsyntax-only"
 
+# Find the macro definition options.
+MACROS=`
+echo "" | gcc -v -x c++ -E ${CXXFLAGS} -o /dev/null - 2>&1 |
+sed -n '/__GNUC__/{s/ -/\\
+-/g;p;}' |
+sed -n '/^-D.*$/{s/-D\([^=]*\)=\([^ ]\{1,\} .*\)/-D\1='\''\2'\''/;p;}' |
+sed -n 'H;${g;s/\n/ /g;p;}'`
+
 # Find the include path options.
 INCLUDES=`
-echo "" | gcc -v -x c++ -E -o /dev/null - 2>&1 |
- awk '/^\#include <.*$/   {f=1}
-      /^ \/.*$/           { if (f) { printf("-I%s ",$0) } }
-      /^End of search.*$/ {exit}' - | sed 's/^-I /-I/;s/ -I / -I/g'`
+echo "" | gcc -v -x c++ -E ${CXXFLAGS} -o /dev/null - 2>&1 |
+awk '/^\#include <.*$/   {f=1}
+     /^ \/.*$/           { if (f) { printf("-I%s ",$0) } }
+     /^End of search.*$/ {exit}' - | sed 's/^-I /-I/;s/ -I / -I/g'`
 
 # See if extra -fno-honor-std is needed.
 EXTRA=`
 gcc --version |
-  sed 's/[^0-9.]*//g' |
-  awk -F "\." '{ if ($1 < 3) {printf("-fno-honor-std ") } }'`
-
-# Find the macro definition options.
-MACROS=`
-echo "" |gcc -v -x c++ -E -o /dev/null - 2>&1 | sed -n '
-/__GNUC__/{
-  s/^.*-lang-c++ -v//
-  s/ -isystem.*$//
-  s/ - -o.*$//
-  s/ -undef//
-  s/ -A[^ ]*//g
-  s/ -D\([^=]*\)=\([^ -]\{1,\} [^ -]\{1,\}\)/ -D\1='\''\2'\''/g
- p
-}
-'`
+sed 's/[^0-9.]*//g' |
+awk -F "\." '{ if ($1 < 3) {printf("-fno-honor-std ") } }'`
 
 echo $STANDARD $MACROS $INCLUDES $EXTRA

GCC_XML/find_mpro_options

 # These options are always needed.
 STANDARD="-quiet -o /dev/null -nostdinc -fsyntax-only"
 
-# Find the macro definition options and include path settings.
-MACRO_AND_INCLUDE=`
-touch /tmp/find_mpro_options_temp.cxx &&
-CC -LANG:std -E -v /tmp/find_mpro_options_temp.cxx 2>&1 | sed -n '
-/_COMPILER_VERSION/{
-  s/^[^ ]*//
-  s/ -A[^ ]*//g
-  s/ -X[^ ]*//g
-  s/ -E//
-  s/ -LANG:std//
-  s/ \/tmp\/find_mpro_options_temp.cxx.*$//
-  p
-}
-'
+touch /tmp/find_mpro_options_temp.cxx 
+
+# Find the macro definition options.
+MACROS=`
+CC ${CXXFLAGS} -E -v /tmp/find_mpro_options_temp.cxx 2>&1 |
+sed -n '/_COMPILER_VERSION/{s/ \/tmp\/find_mpro_options_temp.cxx.*$//
+s/ -/\\
+-/g;p;}' |
+sed -n '/^-D.*$/{s/-D\([^=]*\)=\([^ ]\{1,\} .*\)/-D\1='\''\2'\''/;p;}' |
+sed -n 'H;${g;s/\n/ /g;p;}'`
+
+# Find the include path options.
+INCLUDES=`
+CC ${CXXFLAGS} -E -v /tmp/find_mpro_options_temp.cxx 2>&1 |
+sed -n '/_COMPILER_VERSION/{s/ \/tmp\/find_mpro_options_temp.cxx.*$//
+s/ -/\\
+-/g;p;}' |
+sed -n '/^-I.*$/{p;}' |
+sed -n 'H;${g;s/\n/ /g;p;}'`
+
 rm -f /tmp/find_mpro_options_temp.cxx
-`
 
-echo $STANDARD $MACRO_AND_INCLUDE
+echo $STANDARD $MACROS $INCLUDES