Blame as10k1/missing

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