Blame missing

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