Index: /trunk/tools/bin/prerequisites-deb.sh
===================================================================
--- /trunk/tools/bin/prerequisites-deb.sh	(revision 73121)
+++ /trunk/tools/bin/prerequisites-deb.sh	(revision 73122)
@@ -17,14 +17,63 @@
 #
 
-apt-get install chrpath g++ make iasl libidl-dev libsdl1.2-dev \
-    libsdl-ttf2.0-dev libpam0g-dev libssl-dev libpulse-dev doxygen \
+# What this script does:
+usage_msg="\
+Usage: `basename ${0}` [--with-docs]
+
+Install the dependencies needed for building VirtualBox on an deb-based Linux
+system.  Additional distributions will be added as needed.  There are no plans
+to add support for or to accept patches for distributions we do not package.
+The \`--with-docs\' parameter is to install the packages needed for building
+documentation.  It will also be implemented per distribution as needed."
+
+# To repeat: there are no plans to add support for or to accept patches
+# for distributions we do not package.
+
+usage()
+{
+    echo "${usage_msg}"
+    exit "${1}"
+}
+
+unset WITHDOCS
+
+while test -n "${1}"; do
+    case "${1}" in
+    --with-docs)
+        WITHDOCS=1
+        shift ;;
+    -h|--help)
+        usage 0 ;;
+    *)
+        echo "Unknown parameter ${1}" >&2
+        usage 1 ;;
+    esac
+done
+
+export LC_ALL=C
+PATH=/sbin:/usr/sbin:$PATH
+read DEBVER < /etc/debian_version
+
+apt-get update
+# We deal with different distributions having different lists of prerequisites
+# by splitting them into several apt commands.  Some will fail on some
+# distributions, but at the end everything needed should be there.
+apt-get install -y chrpath g++ make iasl libidl-dev libsdl1.2-dev \
+    libsdl-ttf2.0-dev libpam0g-dev libssl-dev libpulse-dev \
     libasound2-dev xsltproc libxml2-dev libxml2-utils unzip \
     libxrandr-dev libxinerama-dev libcap-dev python-dev \
     libxmu-dev libxcursor-dev libcurl4-openssl-dev libdevmapper-dev \
-    libvpx-dev qttools5-dev-tools libqt5opengl5-dev libqt5x11extras5-dev \
-    texlive texlive-latex-extra texlive-fonts-extra g++-multilib
+    libvpx-dev g++-multilib libopus-dev || true
+# Only install Qt5 on recent distributions
+case "${DEBVER}" in
+7*|8*|jessie*|stretch*) ;;
+*)
+    apt-get install -y qttools5-dev-tools libqt5opengl5-dev \
+        libqt5x11extras5-dev || true ;;
+esac
+test -n "${WITHDOCS}" &&
+    apt-get install -y doxygen texlive texlive-latex-extra texlive-fonts-extra
 # Ubuntu only
 grep Ubuntu /etc/lsb-release 2>/dev/null >&2 &&
-    apt-get install linux-headers-generic
+    apt-get install -y linux-headers-generic
 # apt-get install wine linux-headers-`uname -r`  # Not for chroot installs.
-
