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