fi
}
+check_sed() {
+tmp="`pwd`/check_sed"
+trap "rm $tmp{,-e} 2>/dev/null" EXIT
+echo "test file for GNU sed" > $tmp
+if ! sed -i -e 's/sed//' $tmp >/dev/null 2>&1
+then
+ echo "sed doesn't do in-place editing (-i option)"
+ NEEDED="$NEEDED .sed"
+fi
+}
+
check() {
-if ! $1 --version >/dev/null 2>&1
+if ! $1 --version >/dev/null 2>&1 && ! $1 -version >/dev/null 2>&1
then
echo "$1 not found"
NEEDED="$NEEDED .$1"
else
# found, need to check version ?
[ -z "$2" ] && return # no
- # we only check GNU tools, their version have the form MAJOR.MINOR
gotver=`$1 --version | head -1 | sed s/'.* '//`
gotmajor=`echo $gotver|cut -d. -f1`
gotminor=`echo $gotver|cut -d. -f2`
+ gotmicro=`echo $gotver|cut -d. -f3`
+ [ -z "$gotmicro" ] && gotmicro=0
needmajor=`echo $2|cut -d. -f1`
needminor=`echo $2|cut -d. -f2`
- if [ "$needmajor" -gt "$gotmajor" -o "$needmajor" -eq "$gotmajor" -a "$needminor" -gt "$gotminor" ]
+ needmicro=`echo $2|cut -d. -f3`
+ [ -z "$needmicro" ] && needmicro=0
+ if [ "$needmajor" -gt "$gotmajor" \
+ -o "$needmajor" -eq "$gotmajor" -a "$needminor" -gt "$gotminor" \
+ -o "$needmajor" -eq "$gotmajor" -a "$needminor" -eq "$gotminor" -a "$needmicro" -gt "$gotmicro" ]
then
echo "$1 too old"
NEEDED="$NEEDED .$1"
fi
}
-check autoconf 2.67
-check automake 1.11
+check autoconf 2.69
+check automake 1.14
check m4 1.4.16
check libtool 2.4
check pkg-config
-check cmake
+check cmake 3.1.0
check yasm
check_tar
check ragel
+check_sed
+check protoc 2.6.0
+check ant
+check xz
-[ -n "$NEEDED" ] && mkdir -p build/
+[ -n "$NEEDED" ] && mkdir -p build/ && echo "To-be-built packages: `echo $NEEDED | sed 's/\.//g'`"
CPUS=
CC=
gcc-4.2 --version >/dev/null 2>&1 && CC=CC=gcc-4.2
g++-4.2 --version >/dev/null 2>&1 && CXX=CXX=g++-4.2
;;
+ SunOS)
+ CPUS=`/usr/bin/kstat -p :::state | grep 'on-line$' | wc -l | sed 's/ //g'`
+ ;;
*)
CPUS=1 # default
;;