Blame build-aux/missing

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