'') ccname="$cc" ;;
esac
-# gcc 3.1 complains about adding -Idirectories that it already knows about,
+# gcc 3.* complain about adding -Idirectories that they already know about,
# so we will take those off from locincpth.
case "$gccversion" in
3*)
echo "main(){}">try.c
- for incdir in `$cc -v -c try.c 2>&1 | \
- sed '1,/^#include <\.\.\.>/d;/^End of search list/,$d;s/^ //'` ; do
- locincpth=`echo $locincpth | sed s!$incdir!!`
+ for incdir in $locincpth; do
+ warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
+ grep '^cc1: warning: changing search order '`
+ if test "X$warn" != X; then
+ locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
+ fi
done
$rm -f try try.*
esac