missing revision 43df4709
1209ff23fSmrg#! /bin/sh 243df4709Smrg# Common stub for a few missing GNU programs while installing. 3209ff23fSmrg 443df4709Smrgscriptversion=2009-04-28.21; # UTC 5209ff23fSmrg 643df4709Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 743df4709Smrg# 2008, 2009 Free Software Foundation, Inc. 843df4709Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9209ff23fSmrg 10209ff23fSmrg# This program is free software; you can redistribute it and/or modify 11209ff23fSmrg# it under the terms of the GNU General Public License as published by 12209ff23fSmrg# the Free Software Foundation; either version 2, or (at your option) 13209ff23fSmrg# any later version. 14209ff23fSmrg 15209ff23fSmrg# This program is distributed in the hope that it will be useful, 16209ff23fSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 17209ff23fSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18209ff23fSmrg# GNU General Public License for more details. 19209ff23fSmrg 20209ff23fSmrg# You should have received a copy of the GNU General Public License 212f39173dSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 22209ff23fSmrg 23209ff23fSmrg# As a special exception to the GNU General Public License, if you 24209ff23fSmrg# distribute this file as part of a program that contains a 25209ff23fSmrg# configuration script generated by Autoconf, you may include it under 26209ff23fSmrg# the same distribution terms that you use for the rest of that program. 27209ff23fSmrg 28209ff23fSmrgif test $# -eq 0; then 2943df4709Smrg echo 1>&2 "Try \`$0 --help' for more information" 30209ff23fSmrg exit 1 31209ff23fSmrgfi 32209ff23fSmrg 3343df4709Smrgrun=: 3443df4709Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 3543df4709Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 36209ff23fSmrg 3743df4709Smrg# In the cases where this matters, `missing' is being run in the 3843df4709Smrg# srcdir already. 3943df4709Smrgif test -f configure.ac; then 4043df4709Smrg configure_ac=configure.ac 4143df4709Smrgelse 4243df4709Smrg configure_ac=configure.in 4343df4709Smrgfi 44209ff23fSmrg 4543df4709Smrgmsg="missing on your system" 4643df4709Smrg 4743df4709Smrgcase $1 in 4843df4709Smrg--run) 4943df4709Smrg # Try to run requested program, and just exit if it succeeds. 5043df4709Smrg run= 5143df4709Smrg shift 5243df4709Smrg "$@" && exit 0 5343df4709Smrg # Exit code 63 means version mismatch. This often happens 5443df4709Smrg # when the user try to use an ancient version of a tool on 5543df4709Smrg # a file that requires a minimum version. In this case we 5643df4709Smrg # we should proceed has if the program had been absent, or 5743df4709Smrg # if --run hadn't been passed. 5843df4709Smrg if test $? = 63; then 5943df4709Smrg run=: 6043df4709Smrg msg="probably too old" 6143df4709Smrg fi 6243df4709Smrg ;; 63209ff23fSmrg 64209ff23fSmrg -h|--h|--he|--hel|--help) 65209ff23fSmrg echo "\ 66209ff23fSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 67209ff23fSmrg 6843df4709SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 6943df4709Smrgerror status if there is no known handling for PROGRAM. 70209ff23fSmrg 71209ff23fSmrgOptions: 72209ff23fSmrg -h, --help display this help and exit 73209ff23fSmrg -v, --version output version information and exit 7443df4709Smrg --run try to run the given command, and emulate it if it fails 75209ff23fSmrg 76209ff23fSmrgSupported PROGRAM values: 7743df4709Smrg aclocal touch file \`aclocal.m4' 7843df4709Smrg autoconf touch file \`configure' 7943df4709Smrg autoheader touch file \`config.h.in' 8043df4709Smrg autom4te touch the output file, or create a stub one 8143df4709Smrg automake touch all \`Makefile.in' files 8243df4709Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 8343df4709Smrg flex create \`lex.yy.c', if possible, from existing .c 8443df4709Smrg help2man touch the output file 8543df4709Smrg lex create \`lex.yy.c', if possible, from existing .c 8643df4709Smrg makeinfo touch the output file 8743df4709Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 8843df4709Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 89209ff23fSmrg 9043df4709SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 9143df4709Smrg\`g' are ignored when checking the name. 922f39173dSmrg 93209ff23fSmrgSend bug reports to <bug-automake@gnu.org>." 94209ff23fSmrg exit $? 95209ff23fSmrg ;; 96209ff23fSmrg 97209ff23fSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 98209ff23fSmrg echo "missing $scriptversion (GNU Automake)" 99209ff23fSmrg exit $? 100209ff23fSmrg ;; 101209ff23fSmrg 102209ff23fSmrg -*) 10343df4709Smrg echo 1>&2 "$0: Unknown \`$1' option" 10443df4709Smrg echo 1>&2 "Try \`$0 --help' for more information" 105209ff23fSmrg exit 1 106209ff23fSmrg ;; 107209ff23fSmrg 108209ff23fSmrgesac 109209ff23fSmrg 11043df4709Smrg# normalize program name to check for. 11143df4709Smrgprogram=`echo "$1" | sed ' 11243df4709Smrg s/^gnu-//; t 11343df4709Smrg s/^gnu//; t 11443df4709Smrg s/^g//; t'` 11543df4709Smrg 11643df4709Smrg# Now exit if we have it, but it failed. Also exit now if we 11743df4709Smrg# don't have it and --version was passed (most likely to detect 11843df4709Smrg# the program). This is about non-GNU programs, so use $1 not 11943df4709Smrg# $program. 12043df4709Smrgcase $1 in 12143df4709Smrg lex*|yacc*) 12243df4709Smrg # Not GNU programs, they don't have --version. 12343df4709Smrg ;; 12443df4709Smrg 12543df4709Smrg tar*) 12643df4709Smrg if test -n "$run"; then 12743df4709Smrg echo 1>&2 "ERROR: \`tar' requires --run" 12843df4709Smrg exit 1 12943df4709Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 13043df4709Smrg exit 1 13143df4709Smrg fi 13243df4709Smrg ;; 13343df4709Smrg 13443df4709Smrg *) 13543df4709Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 13643df4709Smrg # We have it, but it failed. 13743df4709Smrg exit 1 13843df4709Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 13943df4709Smrg # Could not run --version or --help. This is probably someone 14043df4709Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 14143df4709Smrg # $TOOL exists and not knowing $TOOL uses missing. 14243df4709Smrg exit 1 14343df4709Smrg fi 14443df4709Smrg ;; 14543df4709Smrgesac 14643df4709Smrg 14743df4709Smrg# If it does not exist, or fails to run (possibly an outdated version), 14843df4709Smrg# try to emulate it. 14943df4709Smrgcase $program in 15043df4709Smrg aclocal*) 15143df4709Smrg echo 1>&2 "\ 15243df4709SmrgWARNING: \`$1' is $msg. You should only need it if 15343df4709Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 15443df4709Smrg to install the \`Automake' and \`Perl' packages. Grab them from 15543df4709Smrg any GNU archive site." 15643df4709Smrg touch aclocal.m4 15743df4709Smrg ;; 15843df4709Smrg 15943df4709Smrg autoconf*) 16043df4709Smrg echo 1>&2 "\ 16143df4709SmrgWARNING: \`$1' is $msg. You should only need it if 16243df4709Smrg you modified \`${configure_ac}'. You might want to install the 16343df4709Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 16443df4709Smrg archive site." 16543df4709Smrg touch configure 16643df4709Smrg ;; 16743df4709Smrg 16843df4709Smrg autoheader*) 16943df4709Smrg echo 1>&2 "\ 17043df4709SmrgWARNING: \`$1' is $msg. You should only need it if 17143df4709Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 17243df4709Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 17343df4709Smrg from any GNU archive site." 17443df4709Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 17543df4709Smrg test -z "$files" && files="config.h" 17643df4709Smrg touch_files= 17743df4709Smrg for f in $files; do 17843df4709Smrg case $f in 17943df4709Smrg *:*) touch_files="$touch_files "`echo "$f" | 18043df4709Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 18143df4709Smrg *) touch_files="$touch_files $f.in";; 18243df4709Smrg esac 18343df4709Smrg done 18443df4709Smrg touch $touch_files 18543df4709Smrg ;; 18643df4709Smrg 18743df4709Smrg automake*) 18843df4709Smrg echo 1>&2 "\ 18943df4709SmrgWARNING: \`$1' is $msg. You should only need it if 19043df4709Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 19143df4709Smrg You might want to install the \`Automake' and \`Perl' packages. 19243df4709Smrg Grab them from any GNU archive site." 19343df4709Smrg find . -type f -name Makefile.am -print | 19443df4709Smrg sed 's/\.am$/.in/' | 19543df4709Smrg while read f; do touch "$f"; done 19643df4709Smrg ;; 19743df4709Smrg 19843df4709Smrg autom4te*) 19943df4709Smrg echo 1>&2 "\ 20043df4709SmrgWARNING: \`$1' is needed, but is $msg. 20143df4709Smrg You might have modified some files without having the 20243df4709Smrg proper tools for further handling them. 20343df4709Smrg You can get \`$1' as part of \`Autoconf' from any GNU 20443df4709Smrg archive site." 20543df4709Smrg 20643df4709Smrg file=`echo "$*" | sed -n "$sed_output"` 20743df4709Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 20843df4709Smrg if test -f "$file"; then 20943df4709Smrg touch $file 21043df4709Smrg else 21143df4709Smrg test -z "$file" || exec >$file 21243df4709Smrg echo "#! /bin/sh" 21343df4709Smrg echo "# Created by GNU Automake missing as a replacement of" 21443df4709Smrg echo "# $ $@" 21543df4709Smrg echo "exit 0" 21643df4709Smrg chmod +x $file 21743df4709Smrg exit 1 21843df4709Smrg fi 21943df4709Smrg ;; 22043df4709Smrg 22143df4709Smrg bison*|yacc*) 22243df4709Smrg echo 1>&2 "\ 22343df4709SmrgWARNING: \`$1' $msg. You should only need it if 22443df4709Smrg you modified a \`.y' file. You may need the \`Bison' package 22543df4709Smrg in order for those modifications to take effect. You can get 22643df4709Smrg \`Bison' from any GNU archive site." 22743df4709Smrg rm -f y.tab.c y.tab.h 22843df4709Smrg if test $# -ne 1; then 22943df4709Smrg eval LASTARG="\${$#}" 23043df4709Smrg case $LASTARG in 23143df4709Smrg *.y) 23243df4709Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 23343df4709Smrg if test -f "$SRCFILE"; then 23443df4709Smrg cp "$SRCFILE" y.tab.c 23543df4709Smrg fi 23643df4709Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 23743df4709Smrg if test -f "$SRCFILE"; then 23843df4709Smrg cp "$SRCFILE" y.tab.h 23943df4709Smrg fi 24043df4709Smrg ;; 24143df4709Smrg esac 24243df4709Smrg fi 24343df4709Smrg if test ! -f y.tab.h; then 24443df4709Smrg echo >y.tab.h 24543df4709Smrg fi 24643df4709Smrg if test ! -f y.tab.c; then 24743df4709Smrg echo 'main() { return 0; }' >y.tab.c 24843df4709Smrg fi 24943df4709Smrg ;; 25043df4709Smrg 25143df4709Smrg lex*|flex*) 25243df4709Smrg echo 1>&2 "\ 25343df4709SmrgWARNING: \`$1' is $msg. You should only need it if 25443df4709Smrg you modified a \`.l' file. You may need the \`Flex' package 25543df4709Smrg in order for those modifications to take effect. You can get 25643df4709Smrg \`Flex' from any GNU archive site." 25743df4709Smrg rm -f lex.yy.c 25843df4709Smrg if test $# -ne 1; then 25943df4709Smrg eval LASTARG="\${$#}" 26043df4709Smrg case $LASTARG in 26143df4709Smrg *.l) 26243df4709Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 26343df4709Smrg if test -f "$SRCFILE"; then 26443df4709Smrg cp "$SRCFILE" lex.yy.c 26543df4709Smrg fi 26643df4709Smrg ;; 26743df4709Smrg esac 26843df4709Smrg fi 26943df4709Smrg if test ! -f lex.yy.c; then 27043df4709Smrg echo 'main() { return 0; }' >lex.yy.c 27143df4709Smrg fi 27243df4709Smrg ;; 27343df4709Smrg 27443df4709Smrg help2man*) 27543df4709Smrg echo 1>&2 "\ 27643df4709SmrgWARNING: \`$1' is $msg. You should only need it if 27743df4709Smrg you modified a dependency of a manual page. You may need the 27843df4709Smrg \`Help2man' package in order for those modifications to take 27943df4709Smrg effect. You can get \`Help2man' from any GNU archive site." 28043df4709Smrg 28143df4709Smrg file=`echo "$*" | sed -n "$sed_output"` 28243df4709Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 28343df4709Smrg if test -f "$file"; then 28443df4709Smrg touch $file 28543df4709Smrg else 28643df4709Smrg test -z "$file" || exec >$file 28743df4709Smrg echo ".ab help2man is required to generate this page" 28843df4709Smrg exit $? 28943df4709Smrg fi 29043df4709Smrg ;; 29143df4709Smrg 29243df4709Smrg makeinfo*) 29343df4709Smrg echo 1>&2 "\ 29443df4709SmrgWARNING: \`$1' is $msg. You should only need it if 29543df4709Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 29643df4709Smrg indirectly affecting the aspect of the manual. The spurious 29743df4709Smrg call might also be the consequence of using a buggy \`make' (AIX, 29843df4709Smrg DU, IRIX). You might want to install the \`Texinfo' package or 29943df4709Smrg the \`GNU make' package. Grab either from any GNU archive site." 30043df4709Smrg # The file to touch is that specified with -o ... 30143df4709Smrg file=`echo "$*" | sed -n "$sed_output"` 30243df4709Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 30343df4709Smrg if test -z "$file"; then 30443df4709Smrg # ... or it is the one specified with @setfilename ... 30543df4709Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 30643df4709Smrg file=`sed -n ' 30743df4709Smrg /^@setfilename/{ 30843df4709Smrg s/.* \([^ ]*\) *$/\1/ 30943df4709Smrg p 31043df4709Smrg q 31143df4709Smrg }' $infile` 31243df4709Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 31343df4709Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 31443df4709Smrg fi 31543df4709Smrg # If the file does not exist, the user really needs makeinfo; 31643df4709Smrg # let's fail without touching anything. 31743df4709Smrg test -f $file || exit 1 31843df4709Smrg touch $file 31943df4709Smrg ;; 32043df4709Smrg 32143df4709Smrg tar*) 32243df4709Smrg shift 32343df4709Smrg 32443df4709Smrg # We have already tried tar in the generic part. 32543df4709Smrg # Look for gnutar/gtar before invocation to avoid ugly error 32643df4709Smrg # messages. 32743df4709Smrg if (gnutar --version > /dev/null 2>&1); then 32843df4709Smrg gnutar "$@" && exit 0 32943df4709Smrg fi 33043df4709Smrg if (gtar --version > /dev/null 2>&1); then 33143df4709Smrg gtar "$@" && exit 0 33243df4709Smrg fi 33343df4709Smrg firstarg="$1" 33443df4709Smrg if shift; then 33543df4709Smrg case $firstarg in 33643df4709Smrg *o*) 33743df4709Smrg firstarg=`echo "$firstarg" | sed s/o//` 33843df4709Smrg tar "$firstarg" "$@" && exit 0 33943df4709Smrg ;; 34043df4709Smrg esac 34143df4709Smrg case $firstarg in 34243df4709Smrg *h*) 34343df4709Smrg firstarg=`echo "$firstarg" | sed s/h//` 34443df4709Smrg tar "$firstarg" "$@" && exit 0 34543df4709Smrg ;; 34643df4709Smrg esac 34743df4709Smrg fi 34843df4709Smrg 34943df4709Smrg echo 1>&2 "\ 35043df4709SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 35143df4709Smrg You may want to install GNU tar or Free paxutils, or check the 35243df4709Smrg command line arguments." 35343df4709Smrg exit 1 35443df4709Smrg ;; 35543df4709Smrg 35643df4709Smrg *) 35743df4709Smrg echo 1>&2 "\ 35843df4709SmrgWARNING: \`$1' is needed, and is $msg. 35943df4709Smrg You might have modified some files without having the 36043df4709Smrg proper tools for further handling them. Check the \`README' file, 36143df4709Smrg it often tells you about the needed prerequisites for installing 36243df4709Smrg this package. You may also peek at any GNU archive site, in case 36343df4709Smrg some other package would contain this missing \`$1' program." 36443df4709Smrg exit 1 36543df4709Smrg ;; 36643df4709Smrgesac 367209ff23fSmrg 36843df4709Smrgexit 0 369209ff23fSmrg 370209ff23fSmrg# Local variables: 371209ff23fSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 372209ff23fSmrg# time-stamp-start: "scriptversion=" 373209ff23fSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 3742f39173dSmrg# time-stamp-time-zone: "UTC" 3752f39173dSmrg# time-stamp-end: "; # UTC" 376209ff23fSmrg# End: 377