Blame missing

Packit e4b6da
#! /bin/sh
Packit e4b6da
# Common stub for a few missing GNU programs while installing.
Packit e4b6da
Packit e4b6da
scriptversion=2005-06-08.21
Packit e4b6da
Packit e4b6da
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
Packit e4b6da
#   Free Software Foundation, Inc.
Packit e4b6da
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
Packit e4b6da
Packit e4b6da
# This program is free software; you can redistribute it and/or modify
Packit e4b6da
# it under the terms of the GNU General Public License as published by
Packit e4b6da
# the Free Software Foundation; either version 2, or (at your option)
Packit e4b6da
# any later version.
Packit e4b6da
Packit e4b6da
# This program is distributed in the hope that it will be useful,
Packit e4b6da
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit e4b6da
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit e4b6da
# GNU General Public License for more details.
Packit e4b6da
Packit e4b6da
# You should have received a copy of the GNU General Public License
Packit e4b6da
# along with this program; if not, write to the Free Software
Packit e4b6da
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
Packit e4b6da
# 02110-1301, USA.
Packit e4b6da
Packit e4b6da
# As a special exception to the GNU General Public License, if you
Packit e4b6da
# distribute this file as part of a program that contains a
Packit e4b6da
# configuration script generated by Autoconf, you may include it under
Packit e4b6da
# the same distribution terms that you use for the rest of that program.
Packit e4b6da
Packit e4b6da
if test $# -eq 0; then
Packit e4b6da
  echo 1>&2 "Try \`$0 --help' for more information"
Packit e4b6da
  exit 1
Packit e4b6da
fi
Packit e4b6da
Packit e4b6da
run=:
Packit e4b6da
Packit e4b6da
# In the cases where this matters, `missing' is being run in the
Packit e4b6da
# srcdir already.
Packit e4b6da
if test -f configure.ac; then
Packit e4b6da
  configure_ac=configure.ac
Packit e4b6da
else
Packit e4b6da
  configure_ac=configure.in
Packit e4b6da
fi
Packit e4b6da
Packit e4b6da
msg="missing on your system"
Packit e4b6da
Packit e4b6da
case "$1" in
Packit e4b6da
--run)
Packit e4b6da
  # Try to run requested program, and just exit if it succeeds.
Packit e4b6da
  run=
Packit e4b6da
  shift
Packit e4b6da
  "$@" && exit 0
Packit e4b6da
  # Exit code 63 means version mismatch.  This often happens
Packit e4b6da
  # when the user try to use an ancient version of a tool on
Packit e4b6da
  # a file that requires a minimum version.  In this case we
Packit e4b6da
  # we should proceed has if the program had been absent, or
Packit e4b6da
  # if --run hadn't been passed.
Packit e4b6da
  if test $? = 63; then
Packit e4b6da
    run=:
Packit e4b6da
    msg="probably too old"
Packit e4b6da
  fi
Packit e4b6da
  ;;
Packit e4b6da
Packit e4b6da
  -h|--h|--he|--hel|--help)
Packit e4b6da
    echo "\
Packit e4b6da
$0 [OPTION]... PROGRAM [ARGUMENT]...
Packit e4b6da
Packit e4b6da
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
Packit e4b6da
error status if there is no known handling for PROGRAM.
Packit e4b6da
Packit e4b6da
Options:
Packit e4b6da
  -h, --help      display this help and exit
Packit e4b6da
  -v, --version   output version information and exit
Packit e4b6da
  --run           try to run the given command, and emulate it if it fails
Packit e4b6da
Packit e4b6da
Supported PROGRAM values:
Packit e4b6da
  aclocal      touch file \`aclocal.m4'
Packit e4b6da
  autoconf     touch file \`configure'
Packit e4b6da
  autoheader   touch file \`config.h.in'
Packit e4b6da
  automake     touch all \`Makefile.in' files
Packit e4b6da
  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
Packit e4b6da
  flex         create \`lex.yy.c', if possible, from existing .c
Packit e4b6da
  help2man     touch the output file
Packit e4b6da
  lex          create \`lex.yy.c', if possible, from existing .c
Packit e4b6da
  makeinfo     touch the output file
Packit e4b6da
  tar          try tar, gnutar, gtar, then tar without non-portable flags
Packit e4b6da
  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
Packit e4b6da
Packit e4b6da
Send bug reports to <bug-automake@gnu.org>."
Packit e4b6da
    exit $?
Packit e4b6da
    ;;
Packit e4b6da
Packit e4b6da
  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
Packit e4b6da
    echo "missing $scriptversion (GNU Automake)"
Packit e4b6da
    exit $?
Packit e4b6da
    ;;
Packit e4b6da
Packit e4b6da
  -*)
Packit e4b6da
    echo 1>&2 "$0: Unknown \`$1' option"
Packit e4b6da
    echo 1>&2 "Try \`$0 --help' for more information"
Packit e4b6da
    exit 1
Packit e4b6da
    ;;
Packit e4b6da
Packit e4b6da
esac
Packit e4b6da
Packit e4b6da
# Now exit if we have it, but it failed.  Also exit now if we
Packit e4b6da
# don't have it and --version was passed (most likely to detect
Packit e4b6da
# the program).
Packit e4b6da
case "$1" in
Packit e4b6da
  lex|yacc)
Packit e4b6da
    # Not GNU programs, they don't have --version.
Packit e4b6da
    ;;
Packit e4b6da
Packit e4b6da
  tar)
Packit e4b6da
    if test -n "$run"; then
Packit e4b6da
       echo 1>&2 "ERROR: \`tar' requires --run"
Packit e4b6da
       exit 1
Packit e4b6da
    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
Packit e4b6da
       exit 1
Packit e4b6da
    fi
Packit e4b6da
    ;;
Packit e4b6da
Packit e4b6da
  *)
Packit e4b6da
    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
Packit e4b6da
       # We have it, but it failed.
Packit e4b6da
       exit 1
Packit e4b6da
    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
Packit e4b6da
       # Could not run --version or --help.  This is probably someone
Packit e4b6da
       # running `$TOOL --version' or `$TOOL --help' to check whether
Packit e4b6da
       # $TOOL exists and not knowing $TOOL uses missing.
Packit e4b6da
       exit 1
Packit e4b6da
    fi
Packit e4b6da
    ;;
Packit e4b6da
esac
Packit e4b6da
Packit e4b6da
# If it does not exist, or fails to run (possibly an outdated version),
Packit e4b6da
# try to emulate it.
Packit e4b6da
case "$1" in
Packit e4b6da
  aclocal*)
Packit e4b6da
    echo 1>&2 "\
Packit e4b6da
WARNING: \`$1' is $msg.  You should only need it if
Packit e4b6da
         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
Packit e4b6da
         to install the \`Automake' and \`Perl' packages.  Grab them from
Packit e4b6da
         any GNU archive site."
Packit e4b6da
    touch aclocal.m4
Packit e4b6da
    ;;
Packit e4b6da
Packit e4b6da
  autoconf)
Packit e4b6da
    echo 1>&2 "\
Packit e4b6da
WARNING: \`$1' is $msg.  You should only need it if
Packit e4b6da
         you modified \`${configure_ac}'.  You might want to install the
Packit e4b6da
         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
Packit e4b6da
         archive site."
Packit e4b6da
    touch configure
Packit e4b6da
    ;;
Packit e4b6da
Packit e4b6da
  autoheader)
Packit e4b6da
    echo 1>&2 "\
Packit e4b6da
WARNING: \`$1' is $msg.  You should only need it if
Packit e4b6da
         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
Packit e4b6da
         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
Packit e4b6da
         from any GNU archive site."
Packit e4b6da
    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
Packit e4b6da
    test -z "$files" && files="config.h"
Packit e4b6da
    touch_files=
Packit e4b6da
    for f in $files; do
Packit e4b6da
      case "$f" in
Packit e4b6da
      *:*) touch_files="$touch_files "`echo "$f" |
Packit e4b6da
				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
Packit e4b6da
      *) touch_files="$touch_files $f.in";;
Packit e4b6da
      esac
Packit e4b6da
    done
Packit e4b6da
    touch $touch_files
Packit e4b6da
    ;;
Packit e4b6da
Packit e4b6da
  automake*)
Packit e4b6da
    echo 1>&2 "\
Packit e4b6da
WARNING: \`$1' is $msg.  You should only need it if
Packit e4b6da
         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
Packit e4b6da
         You might want to install the \`Automake' and \`Perl' packages.
Packit e4b6da
         Grab them from any GNU archive site."
Packit e4b6da
    find . -type f -name Makefile.am -print |
Packit e4b6da
	   sed 's/\.am$/.in/' |
Packit e4b6da
	   while read f; do touch "$f"; done
Packit e4b6da
    ;;
Packit e4b6da
Packit e4b6da
  autom4te)
Packit e4b6da
    echo 1>&2 "\
Packit e4b6da
WARNING: \`$1' is needed, but is $msg.
Packit e4b6da
         You might have modified some files without having the
Packit e4b6da
         proper tools for further handling them.
Packit e4b6da
         You can get \`$1' as part of \`Autoconf' from any GNU
Packit e4b6da
         archive site."
Packit e4b6da
Packit e4b6da
    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
Packit e4b6da
    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
Packit e4b6da
    if test -f "$file"; then
Packit e4b6da
	touch $file
Packit e4b6da
    else
Packit e4b6da
	test -z "$file" || exec >$file
Packit e4b6da
	echo "#! /bin/sh"
Packit e4b6da
	echo "# Created by GNU Automake missing as a replacement of"
Packit e4b6da
	echo "#  $ $@"
Packit e4b6da
	echo "exit 0"
Packit e4b6da
	chmod +x $file
Packit e4b6da
	exit 1
Packit e4b6da
    fi
Packit e4b6da
    ;;
Packit e4b6da
Packit e4b6da
  bison|yacc)
Packit e4b6da
    echo 1>&2 "\
Packit e4b6da
WARNING: \`$1' $msg.  You should only need it if
Packit e4b6da
         you modified a \`.y' file.  You may need the \`Bison' package
Packit e4b6da
         in order for those modifications to take effect.  You can get
Packit e4b6da
         \`Bison' from any GNU archive site."
Packit e4b6da
    rm -f y.tab.c y.tab.h
Packit e4b6da
    if [ $# -ne 1 ]; then
Packit e4b6da
        eval LASTARG="\${$#}"
Packit e4b6da
	case "$LASTARG" in
Packit e4b6da
	*.y)
Packit e4b6da
	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
Packit e4b6da
	    if [ -f "$SRCFILE" ]; then
Packit e4b6da
	         cp "$SRCFILE" y.tab.c
Packit e4b6da
	    fi
Packit e4b6da
	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
Packit e4b6da
	    if [ -f "$SRCFILE" ]; then
Packit e4b6da
	         cp "$SRCFILE" y.tab.h
Packit e4b6da
	    fi
Packit e4b6da
	  ;;
Packit e4b6da
	esac
Packit e4b6da
    fi
Packit e4b6da
    if [ ! -f y.tab.h ]; then
Packit e4b6da
	echo >y.tab.h
Packit e4b6da
    fi
Packit e4b6da
    if [ ! -f y.tab.c ]; then
Packit e4b6da
	echo 'main() { return 0; }' >y.tab.c
Packit e4b6da
    fi
Packit e4b6da
    ;;
Packit e4b6da
Packit e4b6da
  lex|flex)
Packit e4b6da
    echo 1>&2 "\
Packit e4b6da
WARNING: \`$1' is $msg.  You should only need it if
Packit e4b6da
         you modified a \`.l' file.  You may need the \`Flex' package
Packit e4b6da
         in order for those modifications to take effect.  You can get
Packit e4b6da
         \`Flex' from any GNU archive site."
Packit e4b6da
    rm -f lex.yy.c
Packit e4b6da
    if [ $# -ne 1 ]; then
Packit e4b6da
        eval LASTARG="\${$#}"
Packit e4b6da
	case "$LASTARG" in
Packit e4b6da
	*.l)
Packit e4b6da
	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
Packit e4b6da
	    if [ -f "$SRCFILE" ]; then
Packit e4b6da
	         cp "$SRCFILE" lex.yy.c
Packit e4b6da
	    fi
Packit e4b6da
	  ;;
Packit e4b6da
	esac
Packit e4b6da
    fi
Packit e4b6da
    if [ ! -f lex.yy.c ]; then
Packit e4b6da
	echo 'main() { return 0; }' >lex.yy.c
Packit e4b6da
    fi
Packit e4b6da
    ;;
Packit e4b6da
Packit e4b6da
  help2man)
Packit e4b6da
    echo 1>&2 "\
Packit e4b6da
WARNING: \`$1' is $msg.  You should only need it if
Packit e4b6da
	 you modified a dependency of a manual page.  You may need the
Packit e4b6da
	 \`Help2man' package in order for those modifications to take
Packit e4b6da
	 effect.  You can get \`Help2man' from any GNU archive site."
Packit e4b6da
Packit e4b6da
    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
Packit e4b6da
    if test -z "$file"; then
Packit e4b6da
	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
Packit e4b6da
    fi
Packit e4b6da
    if [ -f "$file" ]; then
Packit e4b6da
	touch $file
Packit e4b6da
    else
Packit e4b6da
	test -z "$file" || exec >$file
Packit e4b6da
	echo ".ab help2man is required to generate this page"
Packit e4b6da
	exit 1
Packit e4b6da
    fi
Packit e4b6da
    ;;
Packit e4b6da
Packit e4b6da
  makeinfo)
Packit e4b6da
    echo 1>&2 "\
Packit e4b6da
WARNING: \`$1' is $msg.  You should only need it if
Packit e4b6da
         you modified a \`.texi' or \`.texinfo' file, or any other file
Packit e4b6da
         indirectly affecting the aspect of the manual.  The spurious
Packit e4b6da
         call might also be the consequence of using a buggy \`make' (AIX,
Packit e4b6da
         DU, IRIX).  You might want to install the \`Texinfo' package or
Packit e4b6da
         the \`GNU make' package.  Grab either from any GNU archive site."
Packit e4b6da
    # The file to touch is that specified with -o ...
Packit e4b6da
    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
Packit e4b6da
    if test -z "$file"; then
Packit e4b6da
      # ... or it is the one specified with @setfilename ...
Packit e4b6da
      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
Packit e4b6da
      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
Packit e4b6da
      # ... or it is derived from the source name (dir/f.texi becomes f.info)
Packit e4b6da
      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
Packit e4b6da
    fi
Packit e4b6da
    # If the file does not exist, the user really needs makeinfo;
Packit e4b6da
    # let's fail without touching anything.
Packit e4b6da
    test -f $file || exit 1
Packit e4b6da
    touch $file
Packit e4b6da
    ;;
Packit e4b6da
Packit e4b6da
  tar)
Packit e4b6da
    shift
Packit e4b6da
Packit e4b6da
    # We have already tried tar in the generic part.
Packit e4b6da
    # Look for gnutar/gtar before invocation to avoid ugly error
Packit e4b6da
    # messages.
Packit e4b6da
    if (gnutar --version > /dev/null 2>&1;; then
Packit e4b6da
       gnutar "$@" && exit 0
Packit e4b6da
    fi
Packit e4b6da
    if (gtar --version > /dev/null 2>&1;; then
Packit e4b6da
       gtar "$@" && exit 0
Packit e4b6da
    fi
Packit e4b6da
    firstarg="$1"
Packit e4b6da
    if shift; then
Packit e4b6da
	case "$firstarg" in
Packit e4b6da
	*o*)
Packit e4b6da
	    firstarg=`echo "$firstarg" | sed s/o//`
Packit e4b6da
	    tar "$firstarg" "$@" && exit 0
Packit e4b6da
	    ;;
Packit e4b6da
	esac
Packit e4b6da
	case "$firstarg" in
Packit e4b6da
	*h*)
Packit e4b6da
	    firstarg=`echo "$firstarg" | sed s/h//`
Packit e4b6da
	    tar "$firstarg" "$@" && exit 0
Packit e4b6da
	    ;;
Packit e4b6da
	esac
Packit e4b6da
    fi
Packit e4b6da
Packit e4b6da
    echo 1>&2 "\
Packit e4b6da
WARNING: I can't seem to be able to run \`tar' with the given arguments.
Packit e4b6da
         You may want to install GNU tar or Free paxutils, or check the
Packit e4b6da
         command line arguments."
Packit e4b6da
    exit 1
Packit e4b6da
    ;;
Packit e4b6da
Packit e4b6da
  *)
Packit e4b6da
    echo 1>&2 "\
Packit e4b6da
WARNING: \`$1' is needed, and is $msg.
Packit e4b6da
         You might have modified some files without having the
Packit e4b6da
         proper tools for further handling them.  Check the \`README' file,
Packit e4b6da
         it often tells you about the needed prerequisites for installing
Packit e4b6da
         this package.  You may also peek at any GNU archive site, in case
Packit e4b6da
         some other package would contain this missing \`$1' program."
Packit e4b6da
    exit 1
Packit e4b6da
    ;;
Packit e4b6da
esac
Packit e4b6da
Packit e4b6da
exit 0
Packit e4b6da
Packit e4b6da
# Local variables:
Packit e4b6da
# eval: (add-hook 'write-file-hooks 'time-stamp)
Packit e4b6da
# time-stamp-start: "scriptversion="
Packit e4b6da
# time-stamp-format: "%:y-%02m-%02d.%02H"
Packit e4b6da
# time-stamp-end: "$"
Packit e4b6da
# End: