Blame missing

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