]> jfr.im git - irc/rqf/shadowircd.git/blob - autogen.sh
1e9709c090ab1530a8eef4d10707a7eddc891f73
[irc/rqf/shadowircd.git] / 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 AUTOHEADER=${AUTOHEADER:-autoheader}
14 AUTOMAKE=${AUTOMAKE:-automake}
15
16 dump_help_screen ()
17 {
18 echo "Usage: $0 [options]"
19 echo
20 echo "options:"
21 echo " -h,--help show this help screen"
22 echo
23 exit 0
24 }
25
26 parse_options ()
27 {
28 while test "$1" != "" ; do
29 case $1 in
30 -h|--help)
31 dump_help_screen
32 ;;
33 *)
34 echo Invalid argument - $1
35 dump_help_screen
36 ;;
37 esac
38 shift
39 done
40 }
41
42 run_or_die ()
43 {
44 COMMAND=$1
45
46 # check for empty commands
47 if test -z "$COMMAND" ; then
48 echo "*warning* no command specified"
49 return 1
50 fi
51
52 shift;
53
54 OPTIONS="$@"
55
56 # print a message
57 echo -n "*info* running $COMMAND"
58 if test -n "$OPTIONS" ; then
59 echo " ($OPTIONS)"
60 else
61 echo
62 fi
63
64 # run or die
65 $COMMAND $OPTIONS ; RESULT=$?
66 if test $RESULT -ne 0 ; then
67 echo "*error* $COMMAND failed. (exit code = $RESULT)"
68 exit 1
69 fi
70
71 return 0
72 }
73
74 parse_options "$@"
75
76 cd $TOP_DIR
77
78 run_or_die $AUTOHEADER
79 run_or_die $AUTOCONF
80 run_or_die $AUTOMAKE
81
82 cd $TOP_DIR/libratbox
83
84 run_or_die $AUTOHEADER
85 run_or_die $AUTOCONF
86 run_or_die $AUTOMAKE
87
88 cd $LAST_DIR