Blame missing

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