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