melunko@47: #!/bin/sh melunko@47: # Run this to generate all the initial makefiles, etc. melunko@47: melunko@47: # Not all echo versions allow -n, so we check what is possible. This test is melunko@47: # based on the one in autoconf. melunko@47: case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in melunko@47: *c*,-n*) ECHO_N= ;; melunko@47: *c*,* ) ECHO_N=-n ;; melunko@47: *) ECHO_N= ;; melunko@47: esac melunko@47: melunko@47: melunko@47: # some terminal codes ... melunko@47: boldface="`tput bold 2>/dev/null`" melunko@47: normal="`tput sgr0 2>/dev/null`" melunko@47: printbold() { melunko@47: echo $ECHO_N "$boldface" melunko@47: echo "$@" melunko@47: echo $ECHO_N "$normal" melunko@47: } melunko@47: printerr() { melunko@47: echo "$@" >&2 melunko@47: } melunko@47: melunko@47: # Usage: melunko@47: # compare_versions MIN_VERSION ACTUAL_VERSION melunko@47: # returns true if ACTUAL_VERSION >= MIN_VERSION melunko@47: compare_versions() { melunko@47: ch_min_version=$1 melunko@47: ch_actual_version=$2 melunko@47: ch_status=0 melunko@47: IFS="${IFS= }"; ch_save_IFS="$IFS"; IFS="." melunko@47: set $ch_actual_version melunko@47: for ch_min in $ch_min_version; do melunko@47: ch_cur=`echo $1 | sed 's/[^0-9].*$//'`; shift # remove letter suffixes melunko@47: if [ -z "$ch_min" ]; then break; fi melunko@47: if [ -z "$ch_cur" ]; then ch_status=1; break; fi melunko@47: if [ $ch_cur -gt $ch_min ]; then break; fi melunko@47: if [ $ch_cur -lt $ch_min ]; then ch_status=1; break; fi melunko@47: done melunko@47: IFS="$ch_save_IFS" melunko@47: return $ch_status melunko@47: } melunko@47: melunko@47: # Usage: melunko@47: # version_check PACKAGE VARIABLE CHECKPROGS MIN_VERSION SOURCE melunko@47: # checks to see if the package is available melunko@47: version_check() { melunko@47: vc_package=$1 melunko@47: vc_variable=$2 melunko@47: vc_checkprogs=$3 melunko@47: vc_min_version=$4 melunko@47: vc_source=$5 melunko@47: vc_status=1 melunko@47: melunko@47: vc_checkprog=`eval echo "\\$$vc_variable"` melunko@47: if [ -n "$vc_checkprog" ]; then melunko@47: printbold "using $vc_checkprog for $vc_package" melunko@47: return 0 melunko@47: fi melunko@47: melunko@47: printbold "checking for $vc_package >= $vc_min_version..." melunko@47: for vc_checkprog in $vc_checkprogs; do melunko@47: echo $ECHO_N " testing $vc_checkprog... " melunko@47: if $vc_checkprog --version < /dev/null > /dev/null 2>&1; then melunko@47: vc_actual_version=`$vc_checkprog --version | head -n 1 | \ melunko@47: sed 's/^.*[ ]\([0-9.]*[a-z]*\).*$/\1/'` melunko@47: if compare_versions $vc_min_version $vc_actual_version; then melunko@47: echo "found $vc_actual_version" melunko@47: # set variable melunko@47: eval "$vc_variable=$vc_checkprog" melunko@47: vc_status=0 melunko@47: break melunko@47: else melunko@47: echo "too old (found version $vc_actual_version)" melunko@47: fi melunko@47: else melunko@47: echo "not found." melunko@47: fi melunko@47: done melunko@47: if [ "$vc_status" != 0 ]; then melunko@47: printerr "***Error***: You must have $vc_package >= $vc_min_version installed" melunko@47: printerr " to build $PKG_NAME. Download the appropriate package for" melunko@47: printerr " from your distribution or get the source tarball at" melunko@47: printerr " $vc_source" melunko@47: printerr melunko@47: fi melunko@47: return $vc_status melunko@47: } melunko@47: melunko@47: #tell Mandrake autoconf wrapper we want autoconf 2.5x, not 2.13 melunko@47: WANT_AUTOCONF_2_5=1 melunko@47: export WANT_AUTOCONF_2_5 melunko@47: version_check autoreconf AUTORECONF 'autoreconf' 2.50 \ melunko@47: "http://ftp.gnu.org/pub/gnu/autoconf/autoconf-2.50.tar.gz" || DIE=1 melunko@47: melunko@47: automake_progs="automake automake-1.9 automake-1.8 automake-1.7 automake-1.6 automake-1.5" melunko@47: melunko@47: version_check automake AUTOMAKE "$automake_progs" 1.5 \ melunko@47: "http://ftp.gnu.org/pub/gnu/automake/automake-1.5.tar.gz" || DIE=1 melunko@47: ACLOCAL=`echo $AUTOMAKE | sed s/automake/aclocal/` melunko@47: melunko@47: export AUTOMAKE ACLOCAL melunko@47: # gtkdocize rosfran@57: autoreconf --install --force || exit 1 melunko@47: melunko@47: #conf_flags="--enable-maintainer-mode" melunko@47: melunko@47: if test x$NOCONFIGURE = x; then melunko@47: printbold Running $srcdir/configure $conf_flags "$@" ... melunko@47: ./configure $conf_flags "$@" \ melunko@47: && echo Now type \`make\' to compile $PKG_NAME || exit 1 melunko@47: else melunko@47: echo Skipping configure process. melunko@47: fi