]> git.sesse.net Git - vlc/blobdiff - extras/tools/bootstrap
l10n: Bengali update
[vlc] / extras / tools / bootstrap
index 6ad99f962279400418246792680f93e021bb2108..28bad24534c2b4f1944bc87b082c9178332101b4 100755 (executable)
@@ -24,32 +24,79 @@ then
        exit 1
 fi
 
+check_tar() {
+if ! tar PcJ /dev/null >/dev/null 2>&1
+then
+    echo "tar doesn't support xz (J option)"
+    NEEDED="$NEEDED .tar .xz"
+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() {
-# FIXME : add version check
 if ! $1 --version >/dev/null 2>&1
 then
     echo "$1 not found"
     NEEDED="$NEEDED .$1"
+else
+    # found, need to check version ?
+    [ -z "$2" ] && return # no
+    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`
+    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
 fi
 }
 
-check autoconf
-check automake
-check libtool
+check autoconf 2.67
+check automake 1.11
+check m4 1.4.16
+check libtool 2.4
 check pkg-config
-check xz
-check cmake
+check cmake 2.8.8
 check yasm
+check_tar
+check ragel
+check_sed
 
 [ -n "$NEEDED" ] && mkdir -p build/
 
 CPUS=
+CC=
+CXX=
 case `uname` in
     Linux)
         CPUS=`grep -c ^processor /proc/cpuinfo`
      ;;
     Darwin)
         CPUS=`sysctl hw.ncpu|cut -d: -f2`
+        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
@@ -59,12 +106,12 @@ esac
 
 cat > Makefile << EOF
 MAKEFLAGS += -j$CPUS
+$CC
+$CXX
 PREFIX=\$(abspath ./build)
 
 all: $NEEDED
        @echo "You are ready to build VLC and its contribs"
 
-automake: .autoconf
-
 include tools.mak
 EOF