--- perl-5.004_05-orig/Configure	1999-04-13 06:39:07.000000000 +0200
+++ perl-5.004_05/Configure	2005-10-02 23:30:10.029541162 +0200
@@ -3259,6 +3259,18 @@
 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
 esac
 
+# gcc 3.1 complains about adding -Idirectories that it already knows 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!!`
+    done
+    $rm -f try try.*
+esac
+
 : What should the include directory be ?
 echo " "
 $echo $n "Hmm...  $c"
--- perl-5.004_05-orig/makedepend.SH	1998-09-25 21:17:29.000000000 +0200
+++ perl-5.004_05/makedepend.SH	2005-10-02 23:30:10.031540848 +0200
@@ -50,6 +50,11 @@
 	;;
 esac
 
+# Avoid localized gcc messages
+case "$ccname" in
+    gcc) LC_ALL=C ; export LC_ALL ;;
+esac
+
 # We need .. when we are in the x2p directory if we are using the
 # cppstdin wrapper script.
 # Put .. and . first so that we pick up the present cppstdin, not
@@ -119,6 +124,9 @@
     $cppstdin $finc -I/usr/local/include -I. $cppflags $cppminus <UU/$file.c |
     $sed \
 	-e '/^#.*<stdin>/d' \
+    -e '/^#.*<builtin>/d' \
+	-e '/^#.*<built-in>/d' \
+	-e '/^#.*<command line>/d' \
 	-e '/^#.*"-"/d' \
 	-e 's#\.[0-9][0-9]*\.c#'"$file.c#" \
 	-e 's/^[	 ]*#[	 ]*line/#/' \