| 1 |
#!/bin/sh |
| 2 |
# |
| 3 |
# License: GNU General Public License (GPL) |
| 4 |
# Copyright 2001 horms <[email protected]> |
| 5 |
# (heavily mangled by alanr) |
| 6 |
# |
| 7 |
# bootstrap: set up the project and get it ready to make |
| 8 |
# |
| 9 |
# Basically, we run autoconf, automake and libtool in the |
| 10 |
# right way to get things set up for this environment. |
| 11 |
# |
| 12 |
# We also look and see if those tools are installed, and |
| 13 |
# tell you where to get them if they're not. |
| 14 |
# |
| 15 |
# Our goal is to not require dragging along anything |
| 16 |
# more than we need. If this doesn't work on your system, |
| 17 |
# (i.e., your /bin/sh is broken) send us a patch. |
| 18 |
# |
| 19 |
# This code loosely based on the corresponding named script in |
| 20 |
# enlightenment, and also on the sort-of-standard autoconf |
| 21 |
# bootstrap script. |
| 22 |
|
| 23 |
# Run this to generate all the initial makefiles, etc. |
| 24 |
|
| 25 |
testProgram() |
| 26 |
{ |
| 27 |
cmd=$1 |
| 28 |
|
| 29 |
if [ -z "$cmd" ]; then |
| 30 |
return 1; |
| 31 |
fi |
| 32 |
|
| 33 |
arch=`uname -s` |
| 34 |
|
| 35 |
# Make sure the which is in an if-block... on some platforms it throws exceptions |
| 36 |
# |
| 37 |
# The ERR trap is not executed if the failed command is part |
| 38 |
# of an until or while loop, part of an if statement, part of a && |
| 39 |
# or || list. |
| 40 |
if |
| 41 |
which $cmd </dev/null >/dev/null 2>&1 |
| 42 |
then |
| 43 |
: |
| 44 |
else |
| 45 |
return 1 |
| 46 |
fi |
| 47 |
|
| 48 |
# The GNU standard is --version |
| 49 |
if |
| 50 |
$cmd --version </dev/null >/dev/null 2>&1 |
| 51 |
then |
| 52 |
return 0 |
| 53 |
fi |
| 54 |
|
| 55 |
# Maybe it suppports -V instead |
| 56 |
if |
| 57 |
$cmd -V </dev/null >/dev/null 2>&1 |
| 58 |
then |
| 59 |
return 0 |
| 60 |
fi |
| 61 |
|
| 62 |
# Nope, the program seems broken |
| 63 |
return 1 |
| 64 |
} |
| 65 |
|
| 66 |
srcdir=`dirname $0` |
| 67 |
CONFIG=$srcdir/configure |
| 68 |
if |
| 69 |
[ X$srcdir = "X" ] |
| 70 |
then |
| 71 |
srcdir=. |
| 72 |
fi |
| 73 |
|
| 74 |
case "$*" in |
| 75 |
--help) IsHelp=yes;; |
| 76 |
-?) IsHelp=yes; set -- --help;; |
| 77 |
*) IsHelp=no;; |
| 78 |
esac |
| 79 |
|
| 80 |
arch=`uname -s` |
| 81 |
# Disable the errors on FreeBSD until a fix can be found. |
| 82 |
if [ ! "$arch" = "FreeBSD" ]; then |
| 83 |
set -e |
| 84 |
# |
| 85 |
# All errors are fatal from here on out... |
| 86 |
# The shell will complain and exit on any "uncaught" error code. |
| 87 |
# |
| 88 |
# |
| 89 |
# And the trap will ensure sure some kind of error message comes out. |
| 90 |
# |
| 91 |
trap 'echo ""; echo "$0 exiting due to error (sorry!)." >&2' 0 |
| 92 |
fi |
| 93 |
|
| 94 |
HERE=`pwd` |
| 95 |
cd $srcdir |
| 96 |
|
| 97 |
RC=0 |
| 98 |
|
| 99 |
gnu="ftp://ftp.gnu.org/pub/gnu" |
| 100 |
|
| 101 |
# Check for Autoconf |
| 102 |
pkg="autoconf" |
| 103 |
URL=$gnu/$pkg/ |
| 104 |
for command in autoconf autoconf213 autoconf253 autoconf259 |
| 105 |
do |
| 106 |
if |
| 107 |
testProgram $command == 1 |
| 108 |
then |
| 109 |
: OK $pkg is installed |
| 110 |
autoconf=$command |
| 111 |
autoheader=`echo "$autoconf" | sed -e 's/autoconf/autoheader/'` |
| 112 |
autom4te=`echo "$autoconf" | sed -e 's/autoconf/autmo4te/'` |
| 113 |
autoreconf=`echo "$autoconf" | sed -e 's/autoconf/autoreconf/'` |
| 114 |
autoscan=`echo "$autoconf" | sed -e 's/autoconf/autoscan/'` |
| 115 |
autoupdate=`echo "$autoconf" | sed -e 's/autoconf/autoupdate/'` |
| 116 |
ifnames=`echo "$autoconf" | sed -e 's/autoconf/ifnames/'` |
| 117 |
fi |
| 118 |
done |
| 119 |
|
| 120 |
|
| 121 |
# Check to see if we got a valid command. |
| 122 |
if |
| 123 |
$autoconf --version </dev/null >/dev/null 2>&1 |
| 124 |
then |
| 125 |
echo "Autoconf package $autoconf found." |
| 126 |
else |
| 127 |
RC=$? |
| 128 |
cat <<-EOF >&2 |
| 129 |
|
| 130 |
You must have $pkg installed to compile the linux-ha package. |
| 131 |
Download the appropriate package for your system, |
| 132 |
or get the source tarball at: $URL |
| 133 |
EOF |
| 134 |
fi |
| 135 |
|
| 136 |
# Create local copy so that the incremental updates will work. |
| 137 |
rm -f ./autoconf |
| 138 |
ln -s `which $autoconf` ./autoconf |
| 139 |
|
| 140 |
# Check for automake |
| 141 |
pkg="automake" |
| 142 |
URL=$gnu/$pkg/ |
| 143 |
for command in automake automake14 automake-1.4 automake15 automake-1.5 automake17 automake-1.7 automake19 automake-1.9 |
| 144 |
do |
| 145 |
if |
| 146 |
testProgram $command |
| 147 |
then |
| 148 |
: OK $pkg is installed |
| 149 |
automake=$command |
| 150 |
aclocal=`echo "$automake" | sed -e 's/automake/aclocal/'` |
| 151 |
|
| 152 |
fi |
| 153 |
done |
| 154 |
|
| 155 |
# Check to see if we got a valid command. |
| 156 |
if |
| 157 |
$automake --version </dev/null >/dev/null 2>&1 |
| 158 |
then |
| 159 |
echo "Automake package $automake found." |
| 160 |
else |
| 161 |
RC=$? |
| 162 |
cat <<-EOF >&2 |
| 163 |
|
| 164 |
You must have $pkg installed to compile the linux-ha package. |
| 165 |
Download the appropriate package for your system, |
| 166 |
or get the source tarball at: $URL |
| 167 |
EOF |
| 168 |
fi |
| 169 |
|
| 170 |
# Create local copy so that the incremental updates will work. |
| 171 |
rm -f ./automake |
| 172 |
ln -s `which $automake` ./automake |
| 173 |
|
| 174 |
# Check for Libtool |
| 175 |
pkg="libtool" |
| 176 |
for command in libtool libtool14 libtool15 glibtool |
| 177 |
do |
| 178 |
URL=$gnu/$pkg/ |
| 179 |
if |
| 180 |
testProgram $command |
| 181 |
then |
| 182 |
: OK $pkg is installed |
| 183 |
libtool=$command |
| 184 |
libtoolize=`echo "$libtool" | sed -e 's/libtool/libtoolize/'` |
| 185 |
fi |
| 186 |
done |
| 187 |
|
| 188 |
# Check to see if we got a valid command. |
| 189 |
if |
| 190 |
$libtool --version </dev/null >/dev/null 2>&1 |
| 191 |
then |
| 192 |
echo "Libtool package $libtool found." |
| 193 |
else |
| 194 |
RC=$? |
| 195 |
cat <<-EOF >&2 |
| 196 |
|
| 197 |
You must have $pkg installed to compile the linux-ha package. |
| 198 |
Download the appropriate package for your system, |
| 199 |
or get the source tarball at: $URL |
| 200 |
EOF |
| 201 |
fi |
| 202 |
|
| 203 |
# Create local copy so that the incremental updates will work. |
| 204 |
rm -f ./libtool |
| 205 |
ln -s `which $libtool` ./libtool |
| 206 |
|
| 207 |
case $RC in |
| 208 |
0) ;; |
| 209 |
*) exit $RC;; |
| 210 |
esac |
| 211 |
|
| 212 |
case $IsHelp in |
| 213 |
yes) $CONFIG "$@"; trap '' 0; exit 0;; |
| 214 |
esac |
| 215 |
|
| 216 |
oneline() { |
| 217 |
read x; echo "$x" |
| 218 |
} |
| 219 |
|
| 220 |
LT_version=`$libtool --version | oneline | sed -e 's%^[^0-9]*%%' -e s'% .*%%'` |
| 221 |
LT_majvers=`echo "$LT_version" | sed -e 's%\..*%%'` |
| 222 |
LT_minvers=`echo "$LT_version" | sed -e 's%^[^.]*\.%%' ` |
| 223 |
LT_minnum=`echo "$LT_minvers" | sed -e 's%[^0-9].*%%'` |
| 224 |
|
| 225 |
if |
| 226 |
[ $LT_majvers -lt 1 ] || [ $LT_majvers = 1 -a $LT_minnum -lt 4 ] |
| 227 |
then |
| 228 |
echo "Minimum version of libtool is 1.4. You have $LT_version installed." |
| 229 |
exit 1 |
| 230 |
fi |
| 231 |
|
| 232 |
echo $aclocal $ACLOCAL_FLAGS |
| 233 |
$aclocal $ACLOCAL_FLAGS |
| 234 |
|
| 235 |
# Create local copy so that the incremental updates will work. |
| 236 |
rm -f ./autoheader |
| 237 |
ln -s `which $autoheader` ./autoheader |
| 238 |
|
| 239 |
if |
| 240 |
echo $autoheader --version < /dev/null > /dev/null 2>&1 |
| 241 |
$autoheader --version < /dev/null > /dev/null 2>&1 |
| 242 |
then |
| 243 |
echo $autoheader |
| 244 |
$autoheader |
| 245 |
fi |
| 246 |
|
| 247 |
rm -rf libltdl libltdl.tar |
| 248 |
echo $libtoolize --ltdl --force --copy |
| 249 |
GREP_OPTIONS= $libtoolize --ltdl --force --copy || { |
| 250 |
if test -f /etc/debian_version; then |
| 251 |
echo "" |
| 252 |
echo "Running Debian? You probably need to install libltdl3-dev." |
| 253 |
fi |
| 254 |
exit 1 |
| 255 |
} |
| 256 |
|
| 257 |
|
| 258 |
echo $aclocal $ACLOCAL_FLAGS |
| 259 |
$aclocal $ACLOCAL_FLAGS |
| 260 |
|
| 261 |
# Emulate the old --ltdl-tar option... |
| 262 |
# If the libltdl directory is required we will unpack it later |
| 263 |
tar -cf libltdl.tar libltdl |
| 264 |
rm -rf libltdl |
| 265 |
|
| 266 |
echo $automake --add-missing --include-deps --copy |
| 267 |
$automake --add-missing --include-deps --copy |
| 268 |
|
| 269 |
echo $autoconf |
| 270 |
$autoconf |
| 271 |
|
| 272 |
test -f libtool.m4 || touch libtool.m4 |
| 273 |
test -f ltdl.m4 || touch ltdl.m4 |
| 274 |
|
| 275 |
cd $HERE |
| 276 |
|
| 277 |
if |
| 278 |
[ $# -lt 1 ] |
| 279 |
then |
| 280 |
echo Now run $CONFIG. |
| 281 |
else |
| 282 |
echo $CONFIG "$@" |
| 283 |
$CONFIG "$@" |
| 284 |
|
| 285 |
echo "Now type 'gmake' to compile the system, noting that" |
| 286 |
echo "'gmake' is often available as 'make'." |
| 287 |
echo |
| 288 |
fi |
| 289 |
trap '' 0 |