Index: contrib/download_prerequisites
===================================================================
--- contrib/download_prerequisites	(revision 192154)
+++ contrib/download_prerequisites	(working copy)
@@ -2,11 +2,11 @@
 
 # Download some prerequisites needed by gcc.
 # Run this from the top level of the gcc source tree and the gcc
 # build will do the right thing.
 #
-# (C) 2010 Free Software Foundation
+# (C) 2010, 2012 Free Software Foundation
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
@@ -17,22 +17,29 @@
 # General Public License for more details.
 # 
 # You should have received a copy of the GNU General Public License
 # along with this program. If not, see http://www.gnu.org/licenses/.
 
-MPFR=mpfr-2.4.2
-GMP=gmp-4.3.2
-MPC=mpc-0.8.1
-
-wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$MPFR.tar.bz2 || exit 1
-tar xjf $MPFR.tar.bz2 || exit 1
-ln -sf $MPFR mpfr || exit 1
-
-wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$GMP.tar.bz2 || exit 1
-tar xjf $GMP.tar.bz2  || exit 1
-ln -sf $GMP gmp || exit 1
-
-wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$MPC.tar.gz || exit 1
-tar xzf $MPC.tar.gz || exit 1
-ln -sf $MPC mpc || exit 1
-
-rm $MPFR.tar.bz2 $GMP.tar.bz2 $MPC.tar.gz || exit 1
+download_prerequisite() {
+    WHAT=$1
+    VERSION=$2
+    PACK=$3
+    case $PACK in
+        tar.bz2) TARX="j";;
+        tar.gz)  TARX="z";;
+    esac
+    wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$WHAT-${VERSION}.${PACK} || exit 1
+    tar x${TARX}f $WHAT-${VERSION}.${PACK} || exit 1
+    ln -sf $WHAT-${VERSION} $WHAT || exit 1
+    rm $WHAT-${VERSION}.${PACK} || exit 1
+}
+
+if [ ! -e ./contrib/download_prerequisites ]; then
+    echo "error: ./contrib/download_prerequisites not found: run this from the top level of the gcc source tree!"
+    exit 1
+fi
+
+download_prerequisite mpfr 2.4.2 tar.bz2
+download_prerequisite gmp 4.3.2 tar.bz2
+download_prerequisite mpc 0.8.1 tar.gz
+download_prerequisite cloog 0.17.0 tar.gz
+download_prerequisite isl 0.10 tar.bz2
