Blame missing

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