Blame missing

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