0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-27 09:12:36 +01:00
construct/autogen.sh

95 lines
1.9 KiB
Bash
Raw Normal View History

2016-07-15 19:45:32 +02:00
#!/bin/bash
2016-03-06 00:47:48 +01:00
TOP_DIR=$(dirname $0)
LAST_DIR=$PWD
if test ! -f $TOP_DIR/configure.ac ; then
echo "You must execute this script from the top level directory."
exit 1
fi
AUTOCONF=${AUTOCONF:-autoconf}
ACLOCAL=${ACLOCAL:-aclocal}
AUTOMAKE=${AUTOMAKE:-automake}
AUTOHEADER=${AUTOHEADER:-autoheader}
LIBTOOLIZE=${LIBTOOLIZE:-libtoolize}
#SHTOOLIZE=${SHTOOLIZE:-shtoolize}
2016-03-06 00:47:48 +01:00
dump_help_screen ()
{
echo "Usage: $0 [options]"
echo
echo "options:"
echo " -n skip CVS changelog creation"
echo " -h,--help show this help screen"
echo
exit 0
}
parse_options ()
{
while test "$1" != "" ; do
case $1 in
-h|--help)
dump_help_screen
;;
-n)
SKIP_CVS_CHANGELOG=yes
;;
*)
echo Invalid argument - $1
dump_help_screen
;;
esac
shift
done
}
2016-07-15 19:45:32 +02:00
2016-03-06 00:47:48 +01:00
run_or_die ()
{
COMMAND=$1
# check for empty commands
if test -z "$COMMAND" ; then
2016-07-15 19:45:32 +02:00
echo -e "\033[1;5;31mERROR\033[0m No command specified!"
2016-03-06 00:47:48 +01:00
return 1
fi
2016-07-15 19:45:32 +02:00
shift;
2016-03-06 00:47:48 +01:00
OPTIONS="$@"
# print a message
if test -n "$OPTIONS" ; then
2016-07-15 19:45:32 +02:00
echo -en "\033[1m$COMMAND $OPTIONS\033[0m ... "
2016-03-06 00:47:48 +01:00
else
2016-07-15 19:45:32 +02:00
echo -en "\033[1m$COMMAND\033[0m ... "
2016-03-06 00:47:48 +01:00
fi
# run or die
$COMMAND $OPTIONS ; RESULT=$?
if test $RESULT -ne 0 ; then
2016-07-15 19:45:32 +02:00
echo -e "\033[1;5;31mERROR\033[0m $COMMAND failed. (exit code = $RESULT)"
2016-03-06 00:47:48 +01:00
exit 1
fi
2016-07-15 19:45:32 +02:00
echo -e "\033[0;32mOK\033[0m"
2016-03-06 00:47:48 +01:00
return 0
}
2016-07-15 19:45:32 +02:00
parse_options "$@"
2016-03-06 00:54:26 +01:00
2016-07-15 19:45:32 +02:00
echo "*** Generating Charybdis build..."
2016-03-06 00:47:48 +01:00
run_or_die $ACLOCAL -I m4
run_or_die $LIBTOOLIZE --force --copy
run_or_die $AUTOHEADER
run_or_die $AUTOCONF
2016-03-06 01:00:02 +01:00
run_or_die $AUTOMAKE --add-missing --copy
#run_or_die $SHTOOLIZE all
2016-07-15 19:45:32 +02:00
2016-07-20 20:55:46 +02:00
WCL_CONFIGURE=`wc -l ./configure`
echo -e "\033[1;30m*\033[0m $WCL_CONFIGURE"
2016-07-15 19:45:32 +02:00
echo
echo -e "\033[1;32m*\033[0m Ready to configure Charybdis."
echo -e "\033[1;5;33m*\033[0m Now run ./configure"