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