Blame missing

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