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