Blame missing

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