diff --git a/etc/relocateQt b/etc/relocateQt
index 915ab0b256661d504fb8ae054ae5ace23a2f3d41..74e7f931f238a7ab148a869842f151ba4381d6cf 100755
--- a/etc/relocateQt
+++ b/etc/relocateQt
@@ -4,7 +4,7 @@
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
 #   \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
-#    \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
+#    \\/     M anipulation  | Copyright (C) 2016-2017 OpenCFD Ltd.
 #------------------------------------------------------------------------------
 # License
 #     This file is part of OpenFOAM.
@@ -29,7 +29,7 @@
 #     Change prefix when relocating QT installation
 #
 #------------------------------------------------------------------------------
-qtVERSION=4.8.7
+unset qtVERSION # No default version
 
 #------------------------------------------------------------------------------
 # Run from third-party directory only
@@ -42,13 +42,12 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
 . etc/tools/ThirdPartyFunctions
 . etc/tools/QtFunctions
 #------------------------------------------------------------------------------
-
 usage() {
     exec 1>&2
     while [ "$#" -ge 1 ]; do echo "$1"; shift; done
     cat<<USAGE
 
-usage: ${0##*/} [OPTION] [VERSION]
+usage: ${0##*/} [OPTION] [qt-VERSION]
 options:
   -force            Create qt.conf and edit pkgconfig to use \${prefix}
   -help
@@ -62,9 +61,9 @@ USAGE
     exit 1
 }
 #------------------------------------------------------------------------------
-
 unset forceOpt
-# parse options
+
+# Parse options
 while [ "$#" -gt 0 ]
 do
     case "$1" in
@@ -89,11 +88,14 @@ done
 #------------------------------------------------------------------------------
 QT_ARCH_PATH=$installBASE/qt-$qtVERSION
 
+[ -n "$qtVERSION" ]    || die "No QT version specified"
+[ -d "$QT_ARCH_PATH" ] || die "No QT installation"
+
 if [ "${forceOpt:-false}" = true ]
 then
+    # Create qt.conf and adjust locations to use '${prefix}' internally
     finalizeQt
 fi
-changePrefix
-
+pkgconfigSetPrefix $QT_ARCH_PATH
 
-# ----------------------------------------------------------------- end-of-file
+# -----------------------------------------------------------------------------
diff --git a/etc/tools/QtFunctions b/etc/tools/QtFunctions
index 363de9e89f8d1cc913fb145f80fddc563778e2f9..c8a6a9546b03c2925d2d1c60627dce045d5a6633 100644
--- a/etc/tools/QtFunctions
+++ b/etc/tools/QtFunctions
@@ -3,7 +3,7 @@
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
 #   \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
-#    \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
+#    \\/     M anipulation  | Copyright (C) 2016-2017 OpenCFD Ltd.
 #------------------------------------------------------------------------------
 # License
 #     This file is part of OpenFOAM.
@@ -26,6 +26,7 @@
 #
 # Description
 #     Functions for helping relocate a QT installation
+#     To be loaded *after* etc/tools/ThirdPartyFunctions
 #
 #------------------------------------------------------------------------------
 
@@ -35,114 +36,33 @@
 #
 createQtConf()
 {
-    echo "create:"
-    echo "    $QT_ARCH_PATH/bin/qt.conf"
+    local confFile="$QT_ARCH_PATH/bin/qt.conf"
 
-    [ -n "$QT_ARCH_PATH" -a -d "$QT_ARCH_PATH/bin" ] || {
-        echo "Error: QT_ARCH_PATH not correctly set"
-        return
-    }
-
-    echo "[Paths]"            > $QT_ARCH_PATH/bin/qt.conf
-    echo "Prefix=$QT_ARCH_PATH" >> $QT_ARCH_PATH/bin/qt.conf
-}
+    if [ -n "$QT_ARCH_PATH" -a -d "$QT_ARCH_PATH/bin" ]
+    then
+        /bin/cat << QT_CONF > $confFile
+[Paths]
+Prefix=$QT_ARCH_PATH
+QT_CONF
+        echo "    created qt.conf"
 
-
-#
-# Adjust pkgconfig information
-# to generalize *location=, -L/... and -I/...
-# to use ${prefix}
-#
-adjustPkgConfig()
-{
-    echo "edit pkgconfig:"
-    echo "    $QT_ARCH_PATH/lib/pkgconfig/*.pc"
-
-    [ -n "$QT_ARCH_PATH" -a -d "$QT_ARCH_PATH/lib/pkgconfig" ] || {
+    else
         echo "Error: QT_ARCH_PATH not correctly set"
-        return
-    }
-
-    (
-        cd $QT_ARCH_PATH/lib/pkgconfig || exit
-
-        unset nfiles
-        for i in *.pc
-        do
-            if [ -f "$i" ]
-            then
-                nfiles="x$nfiles"
-                sed -i \
-                    -e 's@\(location=\)'"$QT_ARCH_PATH/"'@\1${prefix}/@' \
-                    -e 's@\(-[IL]\)'"$QT_ARCH_PATH/"'@\1${prefix}/@g'    \
-                    $i
-            fi
-        done
-        echo "    edited ${#nfiles} files"
-    )
+    fi
 }
 
 
-#
-# Change prefix=... and Prefix=... to use ${prefix}
-#
-changePrefix()
-{
-    echo "relocate QT installation to new prefix directory:"
-    echo "    $QT_ARCH_PATH"
-    echo "edit:"
-    echo "    $QT_ARCH_PATH/bin/qt.conf"
-    echo "    $QT_ARCH_PATH/lib/pkgconfig/*.pc"
-
-    [ -n "$QT_ARCH_PATH" -a -d "$QT_ARCH_PATH/bin" -a -d "$QT_ARCH_PATH/lib/pkgconfig" ] || {
-        echo "Error: QT_ARCH_PATH not correctly set"
-        return
-    }
-
-    # adjust qt.conf
-    for i in $QT_ARCH_PATH/bin/qt.conf
-    do
-        if [ -f "$i" ]
-        then
-            nfiles="x$nfiles"
-            sed -i \
-                -e 's@^\([Pp]refix=\).*$@\1'"$QT_ARCH_PATH@" \
-                $i
-            echo "    edited 1 file"
-        fi
-    done
-
-    # adjust pkgconfig files
-    (
-        cd $QT_ARCH_PATH/lib/pkgconfig || exit
-
-        unset nfiles
-        for i in *.pc
-        do
-            if [ -f "$i" ]
-            then
-                nfiles="x$nfiles"
-                sed -i \
-                    -e 's@^\([Pp]refix=\).*$@\1'"$QT_ARCH_PATH@" \
-                    $i
-            fi
-        done
-        echo "    edited ${#nfiles} files"
-    )
-
-}
-
 # ------------------------------------------------------------------------------
 
 #
-# create qt.conf and adjustPkgConfig to use ${prefix} internally
+# create qt.conf and adjust locations to use ${prefix} internally
 #
 finalizeQt()
 {
     echo "Create/Edit files to ease later relocation of a QT installation"
     createQtConf
-    adjustPkgConfig
+    pkgconfigAdjust $QT_ARCH_PATH
 }
 
 
-# ----------------------------------------------------------------- end-of-file
+# -----------------------------------------------------------------------------
diff --git a/etc/tools/ThirdPartyFunctions b/etc/tools/ThirdPartyFunctions
index 9efa322c6fc902c3c6d283a51d1f5d8007f0ba5f..911ca7504a5372a29246c5187b37379d368b61ff 100644
--- a/etc/tools/ThirdPartyFunctions
+++ b/etc/tools/ThirdPartyFunctions
@@ -3,7 +3,7 @@
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
 #   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-#    \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
+#    \\/     M anipulation  | Copyright (C) 2016-2017 OpenCFD Ltd.
 #------------------------------------------------------------------------------
 # License
 #     This file is part of OpenFOAM.
@@ -229,6 +229,79 @@ NOT_FOUND
 }
 
 
+#
+# Change prefix=... and Prefix=... in pkgconfig
+#
+pkgconfigSetPrefix()
+{
+    local dir="$1"
+    local nfiles
+
+    if [ -n "$dir" -a -d "$dir/lib/pkgconfig" ]
+    then
+    (
+        cd $dir/lib/pkgconfig || exit
+
+        echo "Set pkgconfig prefix : $dir"
+        echo "    files ... lib/pkgconfig/*.pc"
+
+        for i in *.pc
+        do
+            if [ -f "$i" ]
+            then
+                nfiles="x$nfiles"
+                sed -i \
+                    -e 's@^\([Pp]refix=\).*$@\1'"$dir@" \
+                    $i
+            fi
+        done
+        echo "    edited ${#nfiles} files"
+    )
+    else
+        echo "Error: incorrect prefix value: $dir" 1>&2
+        return 1
+    fi
+}
+
+
+#
+# Adjust pkgconfig information
+#   to generalize *location=, -I/... and -L/...
+#   to use ${prefix}
+#
+pkgconfigAdjust()
+{
+    local dir="$1"
+    local nfiles
+
+    if [ -n "$dir" -a -d "$dir/lib/pkgconfig" ]
+    then
+    (
+        cd $dir/lib/pkgconfig || exit
+
+        echo "Adjust pkgconfig locations : $dir"
+        echo "    files ... lib/pkgconfig/*.pc"
+
+        for i in *.pc
+        do
+            if [ -f "$i" ]
+            then
+                nfiles="x$nfiles"
+                sed -i \
+                    -e 's@\(location=\)'"$dir/"'@\1${prefix}/@' \
+                    -e 's@\(-[IL]\)'"$dir/"'@\1${prefix}/@g'    \
+                    $i
+            fi
+        done
+        echo "    edited ${#nfiles} files"
+    )
+    else
+        echo "Error: incorrect prefix value: $dir" 1>&2
+        return 1
+    fi
+}
+
+
 #
 # Download file $1 from url $2 into download/ directory
 #
diff --git a/makeParaView b/makeParaView
index 91a64a660f54ed203a56a9195418de6dd81d99a0..3edb55b2d111e100f1cbba5a9178c54c5852488b 100755
--- a/makeParaView
+++ b/makeParaView
@@ -132,7 +132,7 @@ For finer control, the build stages can be selected or deselected individually:
 To make a different paraview version, simply specify on the command-line.
 For example,
 
-    ./makeParaview 4.4.0
+    ./makeParaview 5.0.1
 
 Or change the \$WM_PROJECT_DIR/etc/config.sh/paraview settings.
 
diff --git a/makeQt b/makeQt
index 5c27532d8adf7ecc616697d11149dc25b3f038fb..41ff3481be871db146414147f0beb38b500b2045 100755
--- a/makeQt
+++ b/makeQt
@@ -4,7 +4,7 @@
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
 #   \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
-#    \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
+#    \\/     M anipulation  | Copyright (C) 2016-2017 OpenCFD Ltd.
 #------------------------------------------------------------------------------
 # License
 #     This file is part of OpenFOAM.
@@ -29,7 +29,7 @@
 #     Build script for QT (the qt-everywhere-opensource-src package)
 #
 #------------------------------------------------------------------------------
-qtVERSION=4.8.7
+unset qtVERSION # No default version
 qtTYPE=qt-everywhere-opensource-src
 
 #------------------------------------------------------------------------------
@@ -48,7 +48,7 @@ usage() {
     while [ "$#" -ge 1 ]; do echo "$1"; shift; done
     cat<<USAGE
 
-usage: ${0##*/} [OPTION] [VERSION]
+usage: ${0##*/} [OPTION] [qt-VERSION]
 options:
   -gcc              Force gcc/g++ instead of the values from \$WM_CC, \$WM_CXX
   -help
@@ -174,4 +174,4 @@ else
     }
 fi
 
-# ----------------------------------------------------------------- end-of-file
+# -----------------------------------------------------------------------------