2013-01-19 19:02:02 -05:00
|
|
|
#! /bin/sh
|
|
|
|
|
2020-05-18 16:12:48 -04:00
|
|
|
args=$(getopt bfos "$@")
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "Usage: autogen.sh [-b] [-f] [-o] [-s] [--]"
|
|
|
|
echo
|
|
|
|
echo "> -b: do not update the system detection scripts"
|
|
|
|
echo "> -f: force the recreation of all autoconf scripts"
|
|
|
|
echo "> -o: overwrite/downgrade system detection scripts"
|
|
|
|
echo "> -s: setup an environment for developers"
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
|
|
|
force=false
|
|
|
|
update_config=true
|
|
|
|
overwrite_config=false
|
|
|
|
dev_setup=false
|
|
|
|
|
|
|
|
eval set -- "$args"
|
|
|
|
|
|
|
|
while [ $# -ne 0 ]; do
|
|
|
|
case $1 in
|
|
|
|
-b)
|
|
|
|
update_config=false
|
|
|
|
;;
|
|
|
|
-f)
|
|
|
|
force=true
|
|
|
|
;;
|
|
|
|
-o)
|
|
|
|
overwrite_config=true
|
|
|
|
;;
|
|
|
|
-s)
|
|
|
|
dev_setup=true
|
|
|
|
;;
|
|
|
|
--)
|
|
|
|
shift
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -s configure ]; then
|
|
|
|
if [ "$force" != true ]; then
|
|
|
|
echo "autoconf scripts already exist." >&2
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
elif [ "$dev_setup" != true ]; then
|
|
|
|
echo "A development environment was not created."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2019-05-16 17:38:48 -04:00
|
|
|
if glibtoolize --version >/dev/null 2>&1; then
|
2013-01-19 19:37:13 -05:00
|
|
|
LIBTOOLIZE='glibtoolize'
|
|
|
|
else
|
|
|
|
LIBTOOLIZE='libtoolize'
|
|
|
|
fi
|
|
|
|
|
2017-05-19 08:51:56 -04:00
|
|
|
command -v command >/dev/null 2>&1 || {
|
|
|
|
echo "command is required, but wasn't found on this system"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
command -v $LIBTOOLIZE >/dev/null 2>&1 || {
|
2015-11-19 11:05:28 -05:00
|
|
|
echo "libtool is required, but wasn't found on this system"
|
|
|
|
exit 1
|
2017-05-19 08:51:56 -04:00
|
|
|
}
|
2015-11-19 11:05:28 -05:00
|
|
|
|
2017-05-19 08:51:56 -04:00
|
|
|
command -v autoconf >/dev/null 2>&1 || {
|
2015-11-19 11:05:28 -05:00
|
|
|
echo "autoconf is required, but wasn't found on this system"
|
|
|
|
exit 1
|
2017-05-19 08:51:56 -04:00
|
|
|
}
|
2015-11-19 11:05:28 -05:00
|
|
|
|
2017-05-19 08:51:56 -04:00
|
|
|
command -v automake >/dev/null 2>&1 || {
|
2015-11-19 11:05:28 -05:00
|
|
|
echo "automake is required, but wasn't found on this system"
|
|
|
|
exit 1
|
2017-05-19 08:51:56 -04:00
|
|
|
}
|
2015-11-19 11:05:28 -05:00
|
|
|
|
2020-05-18 16:12:48 -04:00
|
|
|
if [ "$overwrite_config" = false ]; then
|
|
|
|
if [ -f build-aux/config.guess ]; then
|
|
|
|
mv build-aux/config.guess build-aux/config.guess.stable
|
|
|
|
fi
|
|
|
|
if [ -f build-aux/config.sub ]; then
|
|
|
|
mv build-aux/config.sub build-aux/config.sub.stable
|
|
|
|
fi
|
|
|
|
fi
|
2020-05-26 08:38:51 -04:00
|
|
|
$LIBTOOLIZE &&
|
|
|
|
aclocal &&
|
|
|
|
automake --add-missing --force-missing --include-deps &&
|
|
|
|
autoconf
|
2020-05-18 16:12:48 -04:00
|
|
|
if [ "$overwrite_config" = false ]; then
|
|
|
|
if [ -f build-aux/config.guess.stable ]; then
|
|
|
|
mv build-aux/config.guess.stable build-aux/config.guess
|
|
|
|
fi
|
|
|
|
if [ -f build-aux/config.sub.stable ]; then
|
|
|
|
mv build-aux/config.sub.stable build-aux/config.sub
|
|
|
|
fi
|
|
|
|
fi
|
2015-11-19 11:05:28 -05:00
|
|
|
|
2020-05-18 16:12:48 -04:00
|
|
|
[ "$update_config" = true ] && [ -z "$DO_NOT_UPDATE_CONFIG_SCRIPTS" ] &&
|
2019-05-16 17:38:48 -04:00
|
|
|
command -v curl >/dev/null 2>&1 && {
|
|
|
|
echo "Downloading config.guess and config.sub..."
|
|
|
|
|
2020-05-18 13:32:35 -04:00
|
|
|
curl -sSL --fail -o config.guess \
|
2019-05-03 05:15:27 -04:00
|
|
|
'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' &&
|
|
|
|
mv -f config.guess build-aux/config.guess
|
|
|
|
|
2020-05-18 13:32:35 -04:00
|
|
|
curl -sSL --fail -o config.sub \
|
2019-05-03 05:15:27 -04:00
|
|
|
'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' &&
|
|
|
|
mv -f config.sub build-aux/config.sub
|
2019-05-16 17:38:48 -04:00
|
|
|
|
|
|
|
echo "Done."
|
2019-05-03 05:15:27 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
rm -f config.guess config.sub
|