Blame missing

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