Blame missing

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