]> jfr.im git - irc/atheme/libmowgli-2.git/blob - autogen.sh
src/libmowgli/eventloop/helper: trampoline: ensure fds are valid
[irc/atheme/libmowgli-2.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
15 dump_help_screen ()
16 {
17 echo "Usage: gen-auto-scripts.sh [options]"
18 echo
19 echo "options:"
20 echo " -n skip CVS changelog creation"
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 -n)
34 SKIP_CVS_CHANGELOG=yes
35 ;;
36 *)
37 echo Invalid argument - $1
38 dump_help_screen
39 ;;
40 esac
41 shift
42 done
43 }
44
45 run_or_die ()
46 {
47 COMMAND=$1
48
49 # check for empty commands
50 if test -z "$COMMAND" ; then
51 echo "*warning* no command specified"
52 return 1
53 fi
54
55 shift;
56
57 OPTIONS="$@"
58
59 # print a message
60 printf "%s" "*info* running $COMMAND"
61 if test -n "$OPTIONS" ; then
62 echo " ($OPTIONS)"
63 else
64 echo
65 fi
66
67 # run or die
68 $COMMAND $OPTIONS ; RESULT=$?
69 if test $RESULT -ne 0 ; then
70 echo "*error* $COMMAND failed. (exit code = $RESULT)"
71 exit 1
72 fi
73
74 return 0
75 }
76
77 parse_options "$@"
78
79 cd $TOP_DIR
80
81 run_or_die $ACLOCAL
82 run_or_die $AUTOHEADER
83 run_or_die $AUTOCONF
84
85 cd $LAST_DIR
86