Blame missing

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