Blame common/gst-autogen.sh

Packit 971217
# a silly hack that generates autoregen.sh but it's handy
Packit 971217
# Remove the old autoregen.sh first to create a new file,
Packit 971217
# as the current one may be being read by the shell executing
Packit 971217
# this script.
Packit 971217
if [ -f "autoregen.sh" ]; then
Packit 971217
  rm autoregen.sh
Packit 971217
fi
Packit 971217
echo "#!/bin/sh" > autoregen.sh
Packit 971217
echo "./autogen.sh $@ \$@" >> autoregen.sh
Packit 971217
chmod +x autoregen.sh
Packit 971217
Packit 971217
# helper functions for autogen.sh
Packit 971217
Packit 971217
debug ()
Packit 971217
# print out a debug message if DEBUG is a defined variable
Packit 971217
{
Packit 971217
  if test ! -z "$DEBUG"
Packit 971217
  then
Packit 971217
    echo "DEBUG: $1"
Packit 971217
  fi
Packit 971217
}
Packit 971217
Packit 971217
Packit 971217
autogen_options ()
Packit 971217
{
Packit 971217
  if test "x$1" = "x"; then
Packit 971217
    return 0
Packit 971217
  fi
Packit 971217
Packit 971217
  while test "x$1" != "x" ; do
Packit 971217
    optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
Packit 971217
    case "$1" in
Packit 971217
      --noconfigure)
Packit 971217
          NOCONFIGURE=defined
Packit 971217
	  AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --noconfigure"
Packit 971217
          echo "+ configure run disabled"
Packit 971217
          shift
Packit 971217
          ;;
Packit 971217
      --nocheck)
Packit 971217
	  AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --nocheck"
Packit 971217
          NOCHECK=defined
Packit 971217
          echo "+ autotools version check disabled"
Packit 971217
          shift
Packit 971217
          ;;
Packit 971217
      -d|--debug)
Packit 971217
          DEBUG=defined
Packit 971217
	  AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --debug"
Packit 971217
          echo "+ debug output enabled"
Packit 971217
          shift
Packit 971217
          ;;
Packit 971217
      -h|--help)
Packit 971217
          echo "autogen.sh (autogen options) -- (configure options)"
Packit 971217
          echo "autogen.sh help options: "
Packit 971217
          echo " --noconfigure            don't run the configure script"
Packit 971217
          echo " --nocheck                don't do version checks"
Packit 971217
          echo " --debug                  debug the autogen process"
Packit 971217
          echo
Packit 971217
          echo " --with-autoconf PATH     use autoconf in PATH"
Packit 971217
          echo " --with-automake PATH     use automake in PATH"
Packit 971217
          echo
Packit 971217
          echo "Any argument either not in the above list or after a '--' will be "
Packit 971217
          echo "passed to ./configure."
Packit 971217
	  exit 1
Packit 971217
          ;;
Packit 971217
      --with-automake=*)
Packit 971217
          AUTOMAKE=$optarg
Packit 971217
          echo "+ using alternate automake in $optarg"
Packit 971217
	  CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-automake=$AUTOMAKE"
Packit 971217
          shift
Packit 971217
          ;;
Packit 971217
      --with-autoconf=*)
Packit 971217
          AUTOCONF=$optarg
Packit 971217
          echo "+ using alternate autoconf in $optarg"
Packit 971217
	  CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-autoconf=$AUTOCONF"
Packit 971217
          shift
Packit 971217
          ;;
Packit 971217
      --) shift ; break ;;
Packit 971217
      *)
Packit 971217
          echo "+ passing argument $1 to configure"
Packit 971217
	  CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT $1"
Packit 971217
          shift
Packit 971217
          ;;
Packit 971217
    esac
Packit 971217
  done
Packit 971217
Packit 971217
  for arg do CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT $arg"; done
Packit 971217
  if test ! -z "$CONFIGURE_EXT_OPT"
Packit 971217
  then
Packit 971217
    echo "+ options passed to configure: $CONFIGURE_EXT_OPT"
Packit 971217
  fi
Packit 971217
}
Packit 971217
Packit 971217
toplevel_check ()
Packit 971217
{
Packit 971217
  srcfile=$1
Packit 971217
  test -f $srcfile || {
Packit 971217
        echo "You must run this script in the top-level $package directory"
Packit 971217
        exit 1
Packit 971217
  }
Packit 971217
}
Packit 971217
Packit 971217
tool_run ()
Packit 971217
{
Packit 971217
  tool=$1
Packit 971217
  options=$2
Packit 971217
  run_if_fail=$3
Packit 971217
  echo "+ running $tool $options..."
Packit 971217
  $tool $options || {
Packit 971217
    echo
Packit 971217
    echo $tool failed
Packit 971217
    eval $run_if_fail
Packit 971217
    exit 1
Packit 971217
  }
Packit 971217
}
Packit 971217
Packit 971217
install_git_hooks ()
Packit 971217
{
Packit 971217
  if test -d .git; then
Packit 971217
    # install pre-commit hook for doing clean commits
Packit 971217
    for hook in pre-commit; do
Packit 971217
      if test ! \( -x .git/hooks/$hook -a -L .git/hooks/$hook \); then
Packit 971217
        echo "+ Installing git $hook hook"
Packit 971217
        rm -f .git/hooks/$hook
Packit 971217
        ln -s ../../common/hooks/$hook.hook .git/hooks/$hook || {
Packit 971217
          # if we couldn't create a symbolic link, try doing a plain cp
Packit 971217
          if cp common/hooks/pre-commit.hook .git/hooks/pre-commit; then
Packit 971217
            chmod +x .git/hooks/pre-commit;
Packit 971217
          else
Packit 971217
            echo "********** Couldn't install git $hook hook **********";
Packit 971217
          fi
Packit 971217
        }
Packit 971217
      fi
Packit 971217
    done
Packit 971217
  fi
Packit 971217
}