melunko@47
|
1 |
#!/bin/sh
|
melunko@47
|
2 |
# Run this to generate all the initial makefiles, etc.
|
melunko@47
|
3 |
|
melunko@47
|
4 |
# Not all echo versions allow -n, so we check what is possible. This test is
|
melunko@47
|
5 |
# based on the one in autoconf.
|
melunko@47
|
6 |
case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
|
melunko@47
|
7 |
*c*,-n*) ECHO_N= ;;
|
melunko@47
|
8 |
*c*,* ) ECHO_N=-n ;;
|
melunko@47
|
9 |
*) ECHO_N= ;;
|
melunko@47
|
10 |
esac
|
melunko@47
|
11 |
|
melunko@47
|
12 |
|
melunko@47
|
13 |
# some terminal codes ...
|
melunko@47
|
14 |
boldface="`tput bold 2>/dev/null`"
|
melunko@47
|
15 |
normal="`tput sgr0 2>/dev/null`"
|
melunko@47
|
16 |
printbold() {
|
melunko@47
|
17 |
echo $ECHO_N "$boldface"
|
melunko@47
|
18 |
echo "$@"
|
melunko@47
|
19 |
echo $ECHO_N "$normal"
|
melunko@47
|
20 |
}
|
melunko@47
|
21 |
printerr() {
|
melunko@47
|
22 |
echo "$@" >&2
|
melunko@47
|
23 |
}
|
melunko@47
|
24 |
|
melunko@47
|
25 |
# Usage:
|
melunko@47
|
26 |
# compare_versions MIN_VERSION ACTUAL_VERSION
|
melunko@47
|
27 |
# returns true if ACTUAL_VERSION >= MIN_VERSION
|
melunko@47
|
28 |
compare_versions() {
|
melunko@47
|
29 |
ch_min_version=$1
|
melunko@47
|
30 |
ch_actual_version=$2
|
melunko@47
|
31 |
ch_status=0
|
melunko@47
|
32 |
IFS="${IFS= }"; ch_save_IFS="$IFS"; IFS="."
|
melunko@47
|
33 |
set $ch_actual_version
|
melunko@47
|
34 |
for ch_min in $ch_min_version; do
|
melunko@47
|
35 |
ch_cur=`echo $1 | sed 's/[^0-9].*$//'`; shift # remove letter suffixes
|
melunko@47
|
36 |
if [ -z "$ch_min" ]; then break; fi
|
melunko@47
|
37 |
if [ -z "$ch_cur" ]; then ch_status=1; break; fi
|
melunko@47
|
38 |
if [ $ch_cur -gt $ch_min ]; then break; fi
|
melunko@47
|
39 |
if [ $ch_cur -lt $ch_min ]; then ch_status=1; break; fi
|
melunko@47
|
40 |
done
|
melunko@47
|
41 |
IFS="$ch_save_IFS"
|
melunko@47
|
42 |
return $ch_status
|
melunko@47
|
43 |
}
|
melunko@47
|
44 |
|
melunko@47
|
45 |
# Usage:
|
melunko@47
|
46 |
# version_check PACKAGE VARIABLE CHECKPROGS MIN_VERSION SOURCE
|
melunko@47
|
47 |
# checks to see if the package is available
|
melunko@47
|
48 |
version_check() {
|
melunko@47
|
49 |
vc_package=$1
|
melunko@47
|
50 |
vc_variable=$2
|
melunko@47
|
51 |
vc_checkprogs=$3
|
melunko@47
|
52 |
vc_min_version=$4
|
melunko@47
|
53 |
vc_source=$5
|
melunko@47
|
54 |
vc_status=1
|
melunko@47
|
55 |
|
melunko@47
|
56 |
vc_checkprog=`eval echo "\\$$vc_variable"`
|
melunko@47
|
57 |
if [ -n "$vc_checkprog" ]; then
|
melunko@47
|
58 |
printbold "using $vc_checkprog for $vc_package"
|
melunko@47
|
59 |
return 0
|
melunko@47
|
60 |
fi
|
melunko@47
|
61 |
|
melunko@47
|
62 |
printbold "checking for $vc_package >= $vc_min_version..."
|
melunko@47
|
63 |
for vc_checkprog in $vc_checkprogs; do
|
melunko@47
|
64 |
echo $ECHO_N " testing $vc_checkprog... "
|
melunko@47
|
65 |
if $vc_checkprog --version < /dev/null > /dev/null 2>&1; then
|
melunko@47
|
66 |
vc_actual_version=`$vc_checkprog --version | head -n 1 | \
|
melunko@47
|
67 |
sed 's/^.*[ ]\([0-9.]*[a-z]*\).*$/\1/'`
|
melunko@47
|
68 |
if compare_versions $vc_min_version $vc_actual_version; then
|
melunko@47
|
69 |
echo "found $vc_actual_version"
|
melunko@47
|
70 |
# set variable
|
melunko@47
|
71 |
eval "$vc_variable=$vc_checkprog"
|
melunko@47
|
72 |
vc_status=0
|
melunko@47
|
73 |
break
|
melunko@47
|
74 |
else
|
melunko@47
|
75 |
echo "too old (found version $vc_actual_version)"
|
melunko@47
|
76 |
fi
|
melunko@47
|
77 |
else
|
melunko@47
|
78 |
echo "not found."
|
melunko@47
|
79 |
fi
|
melunko@47
|
80 |
done
|
melunko@47
|
81 |
if [ "$vc_status" != 0 ]; then
|
melunko@47
|
82 |
printerr "***Error***: You must have $vc_package >= $vc_min_version installed"
|
melunko@47
|
83 |
printerr " to build $PKG_NAME. Download the appropriate package for"
|
melunko@47
|
84 |
printerr " from your distribution or get the source tarball at"
|
melunko@47
|
85 |
printerr " $vc_source"
|
melunko@47
|
86 |
printerr
|
melunko@47
|
87 |
fi
|
melunko@47
|
88 |
return $vc_status
|
melunko@47
|
89 |
}
|
melunko@47
|
90 |
|
melunko@47
|
91 |
#tell Mandrake autoconf wrapper we want autoconf 2.5x, not 2.13
|
melunko@47
|
92 |
WANT_AUTOCONF_2_5=1
|
melunko@47
|
93 |
export WANT_AUTOCONF_2_5
|
melunko@47
|
94 |
version_check autoreconf AUTORECONF 'autoreconf' 2.50 \
|
melunko@47
|
95 |
"http://ftp.gnu.org/pub/gnu/autoconf/autoconf-2.50.tar.gz" || DIE=1
|
melunko@47
|
96 |
|
melunko@47
|
97 |
automake_progs="automake automake-1.9 automake-1.8 automake-1.7 automake-1.6 automake-1.5"
|
melunko@47
|
98 |
|
melunko@47
|
99 |
version_check automake AUTOMAKE "$automake_progs" 1.5 \
|
melunko@47
|
100 |
"http://ftp.gnu.org/pub/gnu/automake/automake-1.5.tar.gz" || DIE=1
|
melunko@47
|
101 |
ACLOCAL=`echo $AUTOMAKE | sed s/automake/aclocal/`
|
melunko@47
|
102 |
|
melunko@47
|
103 |
export AUTOMAKE ACLOCAL
|
melunko@47
|
104 |
# gtkdocize
|
melunko@47
|
105 |
autoreconf --install || exit 1
|
melunko@47
|
106 |
|
melunko@47
|
107 |
#conf_flags="--enable-maintainer-mode"
|
melunko@47
|
108 |
|
melunko@47
|
109 |
if test x$NOCONFIGURE = x; then
|
melunko@47
|
110 |
printbold Running $srcdir/configure $conf_flags "$@" ...
|
melunko@47
|
111 |
./configure $conf_flags "$@" \
|
melunko@47
|
112 |
&& echo Now type \`make\' to compile $PKG_NAME || exit 1
|
melunko@47
|
113 |
else
|
melunko@47
|
114 |
echo Skipping configure process.
|
melunko@47
|
115 |
fi
|