Blame missing

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