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