1# a silly hack that generates autoregen.sh but it's handy 2# Remove the old autoregen.sh first to create a new file, 3# as the current one may be being read by the shell executing 4# this script. 5if [ -f "autoregen.sh" ]; then 6 rm autoregen.sh 7fi 8echo "#!/bin/sh" > autoregen.sh 9echo "./autogen.sh $@ \$@" >> autoregen.sh 10chmod +x autoregen.sh 11 12# helper functions for autogen.sh 13 14debug () 15# print out a debug message if DEBUG is a defined variable 16{ 17 if test ! -z "$DEBUG" 18 then 19 echo "DEBUG: $1" 20 fi 21} 22 23 24autogen_options () 25{ 26 if test "x$1" = "x"; then 27 return 0 28 fi 29 30 while test "x$1" != "x" ; do 31 optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` 32 case "$1" in 33 --noconfigure) 34 NOCONFIGURE=defined 35 AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --noconfigure" 36 echo "+ configure run disabled" 37 shift 38 ;; 39 --nocheck) 40 AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --nocheck" 41 NOCHECK=defined 42 echo "+ autotools version check disabled" 43 shift 44 ;; 45 -d|--debug) 46 DEBUG=defined 47 AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --debug" 48 echo "+ debug output enabled" 49 shift 50 ;; 51 -h|--help) 52 echo "autogen.sh (autogen options) -- (configure options)" 53 echo "autogen.sh help options: " 54 echo " --noconfigure don't run the configure script" 55 echo " --nocheck don't do version checks" 56 echo " --debug debug the autogen process" 57 echo 58 echo " --with-autoconf PATH use autoconf in PATH" 59 echo " --with-automake PATH use automake in PATH" 60 echo 61 echo "Any argument either not in the above list or after a '--' will be " 62 echo "passed to ./configure." 63 exit 1 64 ;; 65 --with-automake=*) 66 AUTOMAKE=$optarg 67 echo "+ using alternate automake in $optarg" 68 CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-automake=$AUTOMAKE" 69 shift 70 ;; 71 --with-autoconf=*) 72 AUTOCONF=$optarg 73 echo "+ using alternate autoconf in $optarg" 74 CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-autoconf=$AUTOCONF" 75 shift 76 ;; 77 --) shift ; break ;; 78 *) 79 echo "+ passing argument $1 to configure" 80 CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT $1" 81 shift 82 ;; 83 esac 84 done 85 86 for arg do CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT $arg"; done 87 if test ! -z "$CONFIGURE_EXT_OPT" 88 then 89 echo "+ options passed to configure: $CONFIGURE_EXT_OPT" 90 fi 91} 92 93toplevel_check () 94{ 95 srcfile=$1 96 test -f $srcfile || { 97 echo "You must run this script in the top-level $package directory" 98 exit 1 99 } 100} 101 102tool_run () 103{ 104 tool=$1 105 options=$2 106 run_if_fail=$3 107 echo "+ running $tool $options..." 108 $tool $options || { 109 echo 110 echo $tool failed 111 eval $run_if_fail 112 exit 1 113 } 114} 115 116install_git_hooks () 117{ 118 if test -d .git; then 119 # install pre-commit hook for doing clean commits 120 for hook in pre-commit; do 121 if test ! \( -x .git/hooks/$hook -a -L .git/hooks/$hook \); then 122 echo "+ Installing git $hook hook" 123 rm -f .git/hooks/$hook 124 ln -s ../../common/hooks/$hook.hook .git/hooks/$hook || { 125 # if we couldn't create a symbolic link, try doing a plain cp 126 if cp common/hooks/pre-commit.hook .git/hooks/pre-commit; then 127 chmod +x .git/hooks/pre-commit; 128 else 129 echo "********** Couldn't install git $hook hook **********"; 130 fi 131 } 132 fi 133 done 134 fi 135} 136