missing revision fb23d3a8
164ce7165Smrg#! /bin/sh 264ce7165Smrg# Common stub for a few missing GNU programs while installing. 364ce7165Smrg 4fb23d3a8Smrgscriptversion=2009-04-28.21; # UTC 564ce7165Smrg 6fb23d3a8Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 7fb23d3a8Smrg# 2008, 2009 Free Software Foundation, Inc. 864ce7165Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 964ce7165Smrg 1064ce7165Smrg# This program is free software; you can redistribute it and/or modify 1164ce7165Smrg# it under the terms of the GNU General Public License as published by 1264ce7165Smrg# the Free Software Foundation; either version 2, or (at your option) 1364ce7165Smrg# any later version. 1464ce7165Smrg 1564ce7165Smrg# This program is distributed in the hope that it will be useful, 1664ce7165Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1764ce7165Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1864ce7165Smrg# GNU General Public License for more details. 1964ce7165Smrg 2064ce7165Smrg# You should have received a copy of the GNU General Public License 21fb23d3a8Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 2264ce7165Smrg 2364ce7165Smrg# As a special exception to the GNU General Public License, if you 2464ce7165Smrg# distribute this file as part of a program that contains a 2564ce7165Smrg# configuration script generated by Autoconf, you may include it under 2664ce7165Smrg# the same distribution terms that you use for the rest of that program. 2764ce7165Smrg 2864ce7165Smrgif test $# -eq 0; then 2964ce7165Smrg echo 1>&2 "Try \`$0 --help' for more information" 3064ce7165Smrg exit 1 3164ce7165Smrgfi 3264ce7165Smrg 3364ce7165Smrgrun=: 3464ce7165Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 3564ce7165Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 3664ce7165Smrg 3764ce7165Smrg# In the cases where this matters, `missing' is being run in the 3864ce7165Smrg# srcdir already. 3964ce7165Smrgif test -f configure.ac; then 4064ce7165Smrg configure_ac=configure.ac 4164ce7165Smrgelse 4264ce7165Smrg configure_ac=configure.in 4364ce7165Smrgfi 4464ce7165Smrg 4564ce7165Smrgmsg="missing on your system" 4664ce7165Smrg 4764ce7165Smrgcase $1 in 4864ce7165Smrg--run) 4964ce7165Smrg # Try to run requested program, and just exit if it succeeds. 5064ce7165Smrg run= 5164ce7165Smrg shift 5264ce7165Smrg "$@" && exit 0 5364ce7165Smrg # Exit code 63 means version mismatch. This often happens 5464ce7165Smrg # when the user try to use an ancient version of a tool on 5564ce7165Smrg # a file that requires a minimum version. In this case we 5664ce7165Smrg # we should proceed has if the program had been absent, or 5764ce7165Smrg # if --run hadn't been passed. 5864ce7165Smrg if test $? = 63; then 5964ce7165Smrg run=: 6064ce7165Smrg msg="probably too old" 6164ce7165Smrg fi 6264ce7165Smrg ;; 6364ce7165Smrg 6464ce7165Smrg -h|--h|--he|--hel|--help) 6564ce7165Smrg echo "\ 6664ce7165Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 6764ce7165Smrg 6864ce7165SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 6964ce7165Smrgerror status if there is no known handling for PROGRAM. 7064ce7165Smrg 7164ce7165SmrgOptions: 7264ce7165Smrg -h, --help display this help and exit 7364ce7165Smrg -v, --version output version information and exit 7464ce7165Smrg --run try to run the given command, and emulate it if it fails 7564ce7165Smrg 7664ce7165SmrgSupported PROGRAM values: 7764ce7165Smrg aclocal touch file \`aclocal.m4' 7864ce7165Smrg autoconf touch file \`configure' 7964ce7165Smrg autoheader touch file \`config.h.in' 8064ce7165Smrg autom4te touch the output file, or create a stub one 8164ce7165Smrg automake touch all \`Makefile.in' files 8264ce7165Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 8364ce7165Smrg flex create \`lex.yy.c', if possible, from existing .c 8464ce7165Smrg help2man touch the output file 8564ce7165Smrg lex create \`lex.yy.c', if possible, from existing .c 8664ce7165Smrg makeinfo touch the output file 8764ce7165Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 8864ce7165Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 8964ce7165Smrg 90fb23d3a8SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 91fb23d3a8Smrg\`g' are ignored when checking the name. 92fb23d3a8Smrg 9364ce7165SmrgSend bug reports to <bug-automake@gnu.org>." 9464ce7165Smrg exit $? 9564ce7165Smrg ;; 9664ce7165Smrg 9764ce7165Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 9864ce7165Smrg echo "missing $scriptversion (GNU Automake)" 9964ce7165Smrg exit $? 10064ce7165Smrg ;; 10164ce7165Smrg 10264ce7165Smrg -*) 10364ce7165Smrg echo 1>&2 "$0: Unknown \`$1' option" 10464ce7165Smrg echo 1>&2 "Try \`$0 --help' for more information" 10564ce7165Smrg exit 1 10664ce7165Smrg ;; 10764ce7165Smrg 10864ce7165Smrgesac 10964ce7165Smrg 110fb23d3a8Smrg# normalize program name to check for. 111fb23d3a8Smrgprogram=`echo "$1" | sed ' 112fb23d3a8Smrg s/^gnu-//; t 113fb23d3a8Smrg s/^gnu//; t 114fb23d3a8Smrg s/^g//; t'` 115fb23d3a8Smrg 11664ce7165Smrg# Now exit if we have it, but it failed. Also exit now if we 11764ce7165Smrg# don't have it and --version was passed (most likely to detect 118fb23d3a8Smrg# the program). This is about non-GNU programs, so use $1 not 119fb23d3a8Smrg# $program. 12064ce7165Smrgcase $1 in 121fb23d3a8Smrg lex*|yacc*) 12264ce7165Smrg # Not GNU programs, they don't have --version. 12364ce7165Smrg ;; 12464ce7165Smrg 125fb23d3a8Smrg tar*) 12664ce7165Smrg if test -n "$run"; then 12764ce7165Smrg echo 1>&2 "ERROR: \`tar' requires --run" 12864ce7165Smrg exit 1 12964ce7165Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 13064ce7165Smrg exit 1 13164ce7165Smrg fi 13264ce7165Smrg ;; 13364ce7165Smrg 13464ce7165Smrg *) 13564ce7165Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 13664ce7165Smrg # We have it, but it failed. 13764ce7165Smrg exit 1 13864ce7165Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 13964ce7165Smrg # Could not run --version or --help. This is probably someone 14064ce7165Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 14164ce7165Smrg # $TOOL exists and not knowing $TOOL uses missing. 14264ce7165Smrg exit 1 14364ce7165Smrg fi 14464ce7165Smrg ;; 14564ce7165Smrgesac 14664ce7165Smrg 14764ce7165Smrg# If it does not exist, or fails to run (possibly an outdated version), 14864ce7165Smrg# try to emulate it. 149fb23d3a8Smrgcase $program in 15064ce7165Smrg aclocal*) 15164ce7165Smrg echo 1>&2 "\ 15264ce7165SmrgWARNING: \`$1' is $msg. You should only need it if 15364ce7165Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 15464ce7165Smrg to install the \`Automake' and \`Perl' packages. Grab them from 15564ce7165Smrg any GNU archive site." 15664ce7165Smrg touch aclocal.m4 15764ce7165Smrg ;; 15864ce7165Smrg 159fb23d3a8Smrg autoconf*) 16064ce7165Smrg echo 1>&2 "\ 16164ce7165SmrgWARNING: \`$1' is $msg. You should only need it if 16264ce7165Smrg you modified \`${configure_ac}'. You might want to install the 16364ce7165Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 16464ce7165Smrg archive site." 16564ce7165Smrg touch configure 16664ce7165Smrg ;; 16764ce7165Smrg 168fb23d3a8Smrg autoheader*) 16964ce7165Smrg echo 1>&2 "\ 17064ce7165SmrgWARNING: \`$1' is $msg. You should only need it if 17164ce7165Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 17264ce7165Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 17364ce7165Smrg from any GNU archive site." 17464ce7165Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 17564ce7165Smrg test -z "$files" && files="config.h" 17664ce7165Smrg touch_files= 17764ce7165Smrg for f in $files; do 17864ce7165Smrg case $f in 17964ce7165Smrg *:*) touch_files="$touch_files "`echo "$f" | 18064ce7165Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 18164ce7165Smrg *) touch_files="$touch_files $f.in";; 18264ce7165Smrg esac 18364ce7165Smrg done 18464ce7165Smrg touch $touch_files 18564ce7165Smrg ;; 18664ce7165Smrg 18764ce7165Smrg automake*) 18864ce7165Smrg echo 1>&2 "\ 18964ce7165SmrgWARNING: \`$1' is $msg. You should only need it if 19064ce7165Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 19164ce7165Smrg You might want to install the \`Automake' and \`Perl' packages. 19264ce7165Smrg Grab them from any GNU archive site." 19364ce7165Smrg find . -type f -name Makefile.am -print | 19464ce7165Smrg sed 's/\.am$/.in/' | 19564ce7165Smrg while read f; do touch "$f"; done 19664ce7165Smrg ;; 19764ce7165Smrg 198fb23d3a8Smrg autom4te*) 19964ce7165Smrg echo 1>&2 "\ 20064ce7165SmrgWARNING: \`$1' is needed, but is $msg. 20164ce7165Smrg You might have modified some files without having the 20264ce7165Smrg proper tools for further handling them. 20364ce7165Smrg You can get \`$1' as part of \`Autoconf' from any GNU 20464ce7165Smrg archive site." 20564ce7165Smrg 20664ce7165Smrg file=`echo "$*" | sed -n "$sed_output"` 20764ce7165Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 20864ce7165Smrg if test -f "$file"; then 20964ce7165Smrg touch $file 21064ce7165Smrg else 21164ce7165Smrg test -z "$file" || exec >$file 21264ce7165Smrg echo "#! /bin/sh" 21364ce7165Smrg echo "# Created by GNU Automake missing as a replacement of" 21464ce7165Smrg echo "# $ $@" 21564ce7165Smrg echo "exit 0" 21664ce7165Smrg chmod +x $file 21764ce7165Smrg exit 1 21864ce7165Smrg fi 21964ce7165Smrg ;; 22064ce7165Smrg 221fb23d3a8Smrg bison*|yacc*) 22264ce7165Smrg echo 1>&2 "\ 22364ce7165SmrgWARNING: \`$1' $msg. You should only need it if 22464ce7165Smrg you modified a \`.y' file. You may need the \`Bison' package 22564ce7165Smrg in order for those modifications to take effect. You can get 22664ce7165Smrg \`Bison' from any GNU archive site." 22764ce7165Smrg rm -f y.tab.c y.tab.h 22864ce7165Smrg if test $# -ne 1; then 22964ce7165Smrg eval LASTARG="\${$#}" 23064ce7165Smrg case $LASTARG in 23164ce7165Smrg *.y) 23264ce7165Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 23364ce7165Smrg if test -f "$SRCFILE"; then 23464ce7165Smrg cp "$SRCFILE" y.tab.c 23564ce7165Smrg fi 23664ce7165Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 23764ce7165Smrg if test -f "$SRCFILE"; then 23864ce7165Smrg cp "$SRCFILE" y.tab.h 23964ce7165Smrg fi 24064ce7165Smrg ;; 24164ce7165Smrg esac 24264ce7165Smrg fi 24364ce7165Smrg if test ! -f y.tab.h; then 24464ce7165Smrg echo >y.tab.h 24564ce7165Smrg fi 24664ce7165Smrg if test ! -f y.tab.c; then 24764ce7165Smrg echo 'main() { return 0; }' >y.tab.c 24864ce7165Smrg fi 24964ce7165Smrg ;; 25064ce7165Smrg 251fb23d3a8Smrg lex*|flex*) 25264ce7165Smrg echo 1>&2 "\ 25364ce7165SmrgWARNING: \`$1' is $msg. You should only need it if 25464ce7165Smrg you modified a \`.l' file. You may need the \`Flex' package 25564ce7165Smrg in order for those modifications to take effect. You can get 25664ce7165Smrg \`Flex' from any GNU archive site." 25764ce7165Smrg rm -f lex.yy.c 25864ce7165Smrg if test $# -ne 1; then 25964ce7165Smrg eval LASTARG="\${$#}" 26064ce7165Smrg case $LASTARG in 26164ce7165Smrg *.l) 26264ce7165Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 26364ce7165Smrg if test -f "$SRCFILE"; then 26464ce7165Smrg cp "$SRCFILE" lex.yy.c 26564ce7165Smrg fi 26664ce7165Smrg ;; 26764ce7165Smrg esac 26864ce7165Smrg fi 26964ce7165Smrg if test ! -f lex.yy.c; then 27064ce7165Smrg echo 'main() { return 0; }' >lex.yy.c 27164ce7165Smrg fi 27264ce7165Smrg ;; 27364ce7165Smrg 274fb23d3a8Smrg help2man*) 27564ce7165Smrg echo 1>&2 "\ 27664ce7165SmrgWARNING: \`$1' is $msg. You should only need it if 27764ce7165Smrg you modified a dependency of a manual page. You may need the 27864ce7165Smrg \`Help2man' package in order for those modifications to take 27964ce7165Smrg effect. You can get \`Help2man' from any GNU archive site." 28064ce7165Smrg 28164ce7165Smrg file=`echo "$*" | sed -n "$sed_output"` 28264ce7165Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 28364ce7165Smrg if test -f "$file"; then 28464ce7165Smrg touch $file 28564ce7165Smrg else 28664ce7165Smrg test -z "$file" || exec >$file 28764ce7165Smrg echo ".ab help2man is required to generate this page" 288fb23d3a8Smrg exit $? 28964ce7165Smrg fi 29064ce7165Smrg ;; 29164ce7165Smrg 292fb23d3a8Smrg makeinfo*) 29364ce7165Smrg echo 1>&2 "\ 29464ce7165SmrgWARNING: \`$1' is $msg. You should only need it if 29564ce7165Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 29664ce7165Smrg indirectly affecting the aspect of the manual. The spurious 29764ce7165Smrg call might also be the consequence of using a buggy \`make' (AIX, 29864ce7165Smrg DU, IRIX). You might want to install the \`Texinfo' package or 29964ce7165Smrg the \`GNU make' package. Grab either from any GNU archive site." 30064ce7165Smrg # The file to touch is that specified with -o ... 30164ce7165Smrg file=`echo "$*" | sed -n "$sed_output"` 30264ce7165Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 30364ce7165Smrg if test -z "$file"; then 30464ce7165Smrg # ... or it is the one specified with @setfilename ... 30564ce7165Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 30664ce7165Smrg file=`sed -n ' 30764ce7165Smrg /^@setfilename/{ 30864ce7165Smrg s/.* \([^ ]*\) *$/\1/ 30964ce7165Smrg p 31064ce7165Smrg q 31164ce7165Smrg }' $infile` 31264ce7165Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 31364ce7165Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 31464ce7165Smrg fi 31564ce7165Smrg # If the file does not exist, the user really needs makeinfo; 31664ce7165Smrg # let's fail without touching anything. 31764ce7165Smrg test -f $file || exit 1 31864ce7165Smrg touch $file 31964ce7165Smrg ;; 32064ce7165Smrg 321fb23d3a8Smrg tar*) 32264ce7165Smrg shift 32364ce7165Smrg 32464ce7165Smrg # We have already tried tar in the generic part. 32564ce7165Smrg # Look for gnutar/gtar before invocation to avoid ugly error 32664ce7165Smrg # messages. 32764ce7165Smrg if (gnutar --version > /dev/null 2>&1); then 32864ce7165Smrg gnutar "$@" && exit 0 32964ce7165Smrg fi 33064ce7165Smrg if (gtar --version > /dev/null 2>&1); then 33164ce7165Smrg gtar "$@" && exit 0 33264ce7165Smrg fi 33364ce7165Smrg firstarg="$1" 33464ce7165Smrg if shift; then 33564ce7165Smrg case $firstarg in 33664ce7165Smrg *o*) 33764ce7165Smrg firstarg=`echo "$firstarg" | sed s/o//` 33864ce7165Smrg tar "$firstarg" "$@" && exit 0 33964ce7165Smrg ;; 34064ce7165Smrg esac 34164ce7165Smrg case $firstarg in 34264ce7165Smrg *h*) 34364ce7165Smrg firstarg=`echo "$firstarg" | sed s/h//` 34464ce7165Smrg tar "$firstarg" "$@" && exit 0 34564ce7165Smrg ;; 34664ce7165Smrg esac 34764ce7165Smrg fi 34864ce7165Smrg 34964ce7165Smrg echo 1>&2 "\ 35064ce7165SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 35164ce7165Smrg You may want to install GNU tar or Free paxutils, or check the 35264ce7165Smrg command line arguments." 35364ce7165Smrg exit 1 35464ce7165Smrg ;; 35564ce7165Smrg 35664ce7165Smrg *) 35764ce7165Smrg echo 1>&2 "\ 35864ce7165SmrgWARNING: \`$1' is needed, and is $msg. 35964ce7165Smrg You might have modified some files without having the 36064ce7165Smrg proper tools for further handling them. Check the \`README' file, 36164ce7165Smrg it often tells you about the needed prerequisites for installing 36264ce7165Smrg this package. You may also peek at any GNU archive site, in case 36364ce7165Smrg some other package would contain this missing \`$1' program." 36464ce7165Smrg exit 1 36564ce7165Smrg ;; 36664ce7165Smrgesac 36764ce7165Smrg 36864ce7165Smrgexit 0 36964ce7165Smrg 37064ce7165Smrg# Local variables: 37164ce7165Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 37264ce7165Smrg# time-stamp-start: "scriptversion=" 37364ce7165Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 374fb23d3a8Smrg# time-stamp-time-zone: "UTC" 375fb23d3a8Smrg# time-stamp-end: "; # UTC" 37664ce7165Smrg# End: 377