+fi
+
+## Locate cmake executable
+if [ "x$cmake_exec" == "x" ]; then
+ cmake_locations=("/usr/bin" "/usr/local/bin" "${HOME}/local/bin")
+ cmake_ver=""
+ for loc in ${cmake_locations[@]}; do
+ cmake_file="$loc/cmake"
+ if [ -x $cmake_file ]; then
+ str=`$cmake_file --version | grep version`
+ version=${str:14}
+ if [ "$cmake_ver" \< "$version" ]; then
+ cmake_ver=$version
+ cmake_exec=$cmake_file
+ fi
+ fi
+ done
+fi
+if [ ! -x $cmake_exec ]; then
+ echo "ERROR: no valid cmake found."
+ exit 1
+fi
+cmake_exec=`abspath $cmake_exec`
+
+## Other configuration variables
+platform=`uname`
+number_of_cores=`grep -c ^processor /proc/cpuinfo`
+number_of_threads=`expr $number_of_cores / 2`
+if [ "x$source_file" != "x" ]; then
+ source_file=`abspath $source_file`
+fi
+source_dir=`abspath $source_dir`
+build_dir=`abspath $build_dir`
+
+echo "====================================================================="
+echo "==> Source file : $source_file"
+echo "==> Source dir : $source_dir"
+echo "==> Build dir : $build_dir"
+echo "==> Build type : $build_type"
+echo "==> Prefix : $prefix"
+echo "==> cmake : $cmake_exec"
+echo "==> Platform : $platform"
+echo "==> Number of cores : $number_of_cores"
+echo "==> Number of threads : $number_of_threads"
+echo "====================================================================="
+
+## Create paths
+if [ "x$source_file" != "x" ]; then
+ echo -n "==> Cleaning directories... "