]> jfr.im git - solanum.git/blob - libratbox/autogen.sh
Merge branch 'master' of github.com:charybdis-ircd/charybdis
[solanum.git] / libratbox / autogen.sh
1 #! /bin/sh
2
3 TOP_DIR=$(dirname $0)
4 LAST_DIR=$PWD
5
6 if test ! -f $TOP_DIR/configure.ac ; then
7 echo "You must execute this script from the top level directory."
8 exit 1
9 fi
10
11 AUTOCONF=${AUTOCONF:-autoconf}
12 ACLOCAL=${ACLOCAL:-aclocal}
13 AUTOMAKE=${AUTOMAKE:-automake}
14 AUTOHEADER=${AUTOHEADER:-autoheader}
15 LIBTOOLIZE=${LIBTOOLIZE:-libtoolize}
16
17 dump_help_screen ()
18 {
19 echo "Usage: $0 [options]"
20 echo
21 echo "options:"
22 echo " -n skip CVS changelog creation"
23 echo " -h,--help show this help screen"
24 echo
25 exit 0
26 }
27
28 parse_options ()
29 {
30 while test "$1" != "" ; do
31 case $1 in
32 -h|--help)
33 dump_help_screen
34 ;;
35 -n)
36 SKIP_CVS_CHANGELOG=yes
37 ;;
38 *)
39 echo Invalid argument - $1
40 dump_help_screen
41 ;;
42 esac
43 shift
44 done
45 }
46
47 run_or_die ()
48 {
49 COMMAND=$1
50
51 # check for empty commands
52 if test -z "$COMMAND" ; then
53 echo "*warning* no command specified"
54 return 1
55 fi
56
57 shift;
58
59 OPTIONS="$@"
60
61 # print a message
62 echo -n "*info* running $COMMAND"
63 if test -n "$OPTIONS" ; then
64 echo " ($OPTIONS)"
65 else
66 echo
67 fi
68
69 # run or die
70 $COMMAND $OPTIONS ; RESULT=$?
71 if test $RESULT -ne 0 ; then
72 echo "*error* $COMMAND failed. (exit code = $RESULT)"
73 exit 1
74 fi
75
76 return 0
77 }
78
79 parse_options "$@"
80
81 cd $TOP_DIR
82
83 run_or_die $ACLOCAL
84 run_or_die $LIBTOOLIZE --force --copy
85 run_or_die $AUTOHEADER
86 run_or_die $AUTOCONF
87 run_or_die $AUTOMAKE --add-missing --copy