#!/bin/bash # We change dir since the later utilities assume to work in the project dir cd $(0%*/*) # make sure autoconf is up-to-date setglobal ac_ver = $[autoconf --version | head -n 1 | awk '{print $NF}] setglobal ac_maj = $[echo $ac_ver|sed 's/\..*//] setglobal ac_min = $[echo $ac_ver|sed 's/.*\.//] if [[ $ac_maj -lt 2 ]] { echo Min autoconf version is 2.57 exit 1 } elif [[ $ac_maj -eq 2 && $ac_min -lt 57 ]] { echo Min autoconf version is 2.57 exit 1 } # make sure automake is up-to-date setglobal am_ver = $[automake --version | head -n 1 | awk '{print $NF}] setglobal am_maj = $[echo $am_ver|sed 's/\..*//] setglobal am_min = $[echo $am_ver|sed 's/[^\.]*\.\([^\.]*\)\.*.*/\1/] setglobal am_sub = $[echo $am_ver|sed 's/[^\.]*\.[^\.]*\.*//] if [[ $am_maj -lt 1 ]] { echo Min automake version is 1.6.3 exit 1 } elif [[ $am_maj -eq 1 && $am_min -lt 6 ]] { echo "automake version is too old:$am_maj.$am_min.$am_sub < required 1.6.3" exit 1 } elif [[ $am_maj -eq 1 && $am_min -eq 6 && $am_sub -lt 3 ]] { echo "automake version is too old:$am_maj.$am_min.$am_sub < required 1.6.3" exit 1 } # make sure libtool is up-to-date setglobal lt_ver = $[libtool --version | head -n 1 | awk '{print $4}] setglobal lt_maj = $[echo $lt_ver|sed 's/\..*//] setglobal lt_min = $[echo $lt_ver|sed 's/[^\.]*\.\([^\.]*\)\.*.*/\1/] setglobal lt_sub = $[echo $lt_ver|sed 's/[^\.]*\.[^\.]*\.*//] if [[ $lt_maj -lt 1 ]] { echo Min libtool version is 1.4.2 exit 1 } elif [[ $lt_maj -eq 1 && $lt_min -lt 4 ]] { echo "libtool version is too old:$lt_maj.$lt_min.$lt_sub < required 1.4.2" exit 1 } elif [[ $lt_maj -eq 1 && $lt_min -eq 4 && $lt_sub -lt 2 ]] { echo "libtool version is too old:$lt_maj.$lt_min.$lt_sub < required 1.4.2" exit 1 } # cleanup find . '(' -name Makefile.in -o -name aclocal.m4 -o -name autom4te.cache -o -name configure -o -name aclocal.m4 ')' -exec 'r'm -rf {} ';' -prune aclocal -I config && \ libtoolize --force --copy && \ autoheader && \ automake --foreign --add-missing --copy && \ autoconf