From 8fbf959bee9e1f5732df07678bf259e8cd08ee62 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 29 Mar 2013 17:49:02 -0700 Subject: Update the code detecting the default include and library paths Make it be one big AWK script instead of a ton of smaller processes. Also handle the defaults inside the AWK script for simplicity. Since the output is a qmake variable, we do not need to surround with quotes strings that don't contain spaces. Also, use a tee trick to print the verbose output: we get the actual output from awk. Change-Id: I4a48a917c988a6b03d2c3b6990765301287713ef Reviewed-by: Oswald Buddenhagen --- configure | 55 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 16 deletions(-) (limited to 'configure') diff --git a/configure b/configure index 729030af09..a3542bbd2e 100755 --- a/configure +++ b/configure @@ -2980,21 +2980,44 @@ else fi # auto-detect default include and library search paths -gccout=`LC_ALL=C $TEST_COMPILER $SYSROOT_FLAG $TEST_COMPILER_CXXFLAGS -xc++ -E -v - < /dev/null 2>&1 > /dev/null` -# extract from one line like 'LIBRARY_PATH=/one/path:/another/path:...' -libdirs=`echo "$gccout" | sed -n -e 's/^LIBRARY_PATH=\(.*\)/\1/p'` -DEFAULT_LIBDIRS=`IFS=${HOST_DIRLIST_SEP}; for i in $libdirs; do test -d "$i" && cd "$i" && pwd; done` -# extract from indented lines between '#include <...> search starts here:' and 'End of search list.' -DEFAULT_INCDIRS=`echo "$gccout" | awk ' -/^End of search/ { yup=0 } +unset tty +[ "$OPT_VERBOSE" = "yes" ] && tty=/dev/stderr + +eval `LC_ALL=C $TEST_COMPILER $SYSROOT_FLAG $TEST_COMPILER_CXXFLAGS -xc++ -E -v - < /dev/null 2>&1 > /dev/null | $AWK ' +BEGIN { ORS = ""; FS = "="; incs = 0; libs = 0; } +function quote(s) +{ + # We only handle spaces + if (match(s, " ") != 0) + return "\\\\\"" s "\\\\\""; + return s; +} + +# extract include paths from indented lines between +# #include <...> search starts here: +# and +# End of search list. +/^\#include