missing revision db17cd6d
176910425Smrg#! /bin/sh 276910425Smrg# Common stub for a few missing GNU programs while installing. 376910425Smrg 4db17cd6dSmrgscriptversion=2009-04-28.21; # UTC 576910425Smrg 6db17cd6dSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 7db17cd6dSmrg# 2008, 2009 Free Software Foundation, Inc. 876910425Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 976910425Smrg 1076910425Smrg# This program is free software; you can redistribute it and/or modify 1176910425Smrg# it under the terms of the GNU General Public License as published by 1276910425Smrg# the Free Software Foundation; either version 2, or (at your option) 1376910425Smrg# any later version. 1476910425Smrg 1576910425Smrg# This program is distributed in the hope that it will be useful, 1676910425Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1776910425Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1876910425Smrg# GNU General Public License for more details. 1976910425Smrg 2076910425Smrg# You should have received a copy of the GNU General Public License 21db17cd6dSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 2276910425Smrg 2376910425Smrg# As a special exception to the GNU General Public License, if you 2476910425Smrg# distribute this file as part of a program that contains a 2576910425Smrg# configuration script generated by Autoconf, you may include it under 2676910425Smrg# the same distribution terms that you use for the rest of that program. 2776910425Smrg 2876910425Smrgif test $# -eq 0; then 2976910425Smrg echo 1>&2 "Try \`$0 --help' for more information" 3076910425Smrg exit 1 3176910425Smrgfi 3276910425Smrg 3376910425Smrgrun=: 34db17cd6dSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 35db17cd6dSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 3676910425Smrg 3776910425Smrg# In the cases where this matters, `missing' is being run in the 3876910425Smrg# srcdir already. 3976910425Smrgif test -f configure.ac; then 4076910425Smrg configure_ac=configure.ac 4176910425Smrgelse 4276910425Smrg configure_ac=configure.in 4376910425Smrgfi 4476910425Smrg 4576910425Smrgmsg="missing on your system" 4676910425Smrg 47db17cd6dSmrgcase $1 in 4876910425Smrg--run) 4976910425Smrg # Try to run requested program, and just exit if it succeeds. 5076910425Smrg run= 5176910425Smrg shift 5276910425Smrg "$@" && exit 0 5376910425Smrg # Exit code 63 means version mismatch. This often happens 5476910425Smrg # when the user try to use an ancient version of a tool on 5576910425Smrg # a file that requires a minimum version. In this case we 5676910425Smrg # we should proceed has if the program had been absent, or 5776910425Smrg # if --run hadn't been passed. 5876910425Smrg if test $? = 63; then 5976910425Smrg run=: 6076910425Smrg msg="probably too old" 6176910425Smrg fi 6276910425Smrg ;; 6376910425Smrg 6476910425Smrg -h|--h|--he|--hel|--help) 6576910425Smrg echo "\ 6676910425Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 6776910425Smrg 6876910425SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 6976910425Smrgerror status if there is no known handling for PROGRAM. 7076910425Smrg 7176910425SmrgOptions: 7276910425Smrg -h, --help display this help and exit 7376910425Smrg -v, --version output version information and exit 7476910425Smrg --run try to run the given command, and emulate it if it fails 7576910425Smrg 7676910425SmrgSupported PROGRAM values: 7776910425Smrg aclocal touch file \`aclocal.m4' 7876910425Smrg autoconf touch file \`configure' 7976910425Smrg autoheader touch file \`config.h.in' 80db17cd6dSmrg autom4te touch the output file, or create a stub one 8176910425Smrg automake touch all \`Makefile.in' files 8276910425Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 8376910425Smrg flex create \`lex.yy.c', if possible, from existing .c 8476910425Smrg help2man touch the output file 8576910425Smrg lex create \`lex.yy.c', if possible, from existing .c 8676910425Smrg makeinfo touch the output file 8776910425Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 8876910425Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 8976910425Smrg 90db17cd6dSmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 91db17cd6dSmrg\`g' are ignored when checking the name. 92db17cd6dSmrg 9376910425SmrgSend bug reports to <bug-automake@gnu.org>." 9476910425Smrg exit $? 9576910425Smrg ;; 9676910425Smrg 9776910425Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 9876910425Smrg echo "missing $scriptversion (GNU Automake)" 9976910425Smrg exit $? 10076910425Smrg ;; 10176910425Smrg 10276910425Smrg -*) 10376910425Smrg echo 1>&2 "$0: Unknown \`$1' option" 10476910425Smrg echo 1>&2 "Try \`$0 --help' for more information" 10576910425Smrg exit 1 10676910425Smrg ;; 10776910425Smrg 10876910425Smrgesac 10976910425Smrg 110db17cd6dSmrg# normalize program name to check for. 111db17cd6dSmrgprogram=`echo "$1" | sed ' 112db17cd6dSmrg s/^gnu-//; t 113db17cd6dSmrg s/^gnu//; t 114db17cd6dSmrg s/^g//; t'` 115db17cd6dSmrg 11676910425Smrg# Now exit if we have it, but it failed. Also exit now if we 11776910425Smrg# don't have it and --version was passed (most likely to detect 118db17cd6dSmrg# the program). This is about non-GNU programs, so use $1 not 119db17cd6dSmrg# $program. 120db17cd6dSmrgcase $1 in 121db17cd6dSmrg lex*|yacc*) 12276910425Smrg # Not GNU programs, they don't have --version. 12376910425Smrg ;; 12476910425Smrg 125db17cd6dSmrg tar*) 12676910425Smrg if test -n "$run"; then 12776910425Smrg echo 1>&2 "ERROR: \`tar' requires --run" 12876910425Smrg exit 1 12976910425Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 13076910425Smrg exit 1 13176910425Smrg fi 13276910425Smrg ;; 13376910425Smrg 13476910425Smrg *) 13576910425Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 13676910425Smrg # We have it, but it failed. 13776910425Smrg exit 1 13876910425Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 13976910425Smrg # Could not run --version or --help. This is probably someone 14076910425Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 14176910425Smrg # $TOOL exists and not knowing $TOOL uses missing. 14276910425Smrg exit 1 14376910425Smrg fi 14476910425Smrg ;; 14576910425Smrgesac 14676910425Smrg 14776910425Smrg# If it does not exist, or fails to run (possibly an outdated version), 14876910425Smrg# try to emulate it. 149db17cd6dSmrgcase $program in 15076910425Smrg aclocal*) 15176910425Smrg echo 1>&2 "\ 15276910425SmrgWARNING: \`$1' is $msg. You should only need it if 15376910425Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 15476910425Smrg to install the \`Automake' and \`Perl' packages. Grab them from 15576910425Smrg any GNU archive site." 15676910425Smrg touch aclocal.m4 15776910425Smrg ;; 15876910425Smrg 159db17cd6dSmrg autoconf*) 16076910425Smrg echo 1>&2 "\ 16176910425SmrgWARNING: \`$1' is $msg. You should only need it if 16276910425Smrg you modified \`${configure_ac}'. You might want to install the 16376910425Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 16476910425Smrg archive site." 16576910425Smrg touch configure 16676910425Smrg ;; 16776910425Smrg 168db17cd6dSmrg autoheader*) 16976910425Smrg echo 1>&2 "\ 17076910425SmrgWARNING: \`$1' is $msg. You should only need it if 17176910425Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 17276910425Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 17376910425Smrg from any GNU archive site." 17476910425Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 17576910425Smrg test -z "$files" && files="config.h" 17676910425Smrg touch_files= 17776910425Smrg for f in $files; do 178db17cd6dSmrg case $f in 17976910425Smrg *:*) touch_files="$touch_files "`echo "$f" | 18076910425Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 18176910425Smrg *) touch_files="$touch_files $f.in";; 18276910425Smrg esac 18376910425Smrg done 18476910425Smrg touch $touch_files 18576910425Smrg ;; 18676910425Smrg 18776910425Smrg automake*) 18876910425Smrg echo 1>&2 "\ 18976910425SmrgWARNING: \`$1' is $msg. You should only need it if 19076910425Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 19176910425Smrg You might want to install the \`Automake' and \`Perl' packages. 19276910425Smrg Grab them from any GNU archive site." 19376910425Smrg find . -type f -name Makefile.am -print | 19476910425Smrg sed 's/\.am$/.in/' | 19576910425Smrg while read f; do touch "$f"; done 19676910425Smrg ;; 19776910425Smrg 198db17cd6dSmrg autom4te*) 19976910425Smrg echo 1>&2 "\ 20076910425SmrgWARNING: \`$1' is needed, but is $msg. 20176910425Smrg You might have modified some files without having the 20276910425Smrg proper tools for further handling them. 20376910425Smrg You can get \`$1' as part of \`Autoconf' from any GNU 20476910425Smrg archive site." 20576910425Smrg 206db17cd6dSmrg file=`echo "$*" | sed -n "$sed_output"` 207db17cd6dSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 20876910425Smrg if test -f "$file"; then 20976910425Smrg touch $file 21076910425Smrg else 21176910425Smrg test -z "$file" || exec >$file 21276910425Smrg echo "#! /bin/sh" 21376910425Smrg echo "# Created by GNU Automake missing as a replacement of" 21476910425Smrg echo "# $ $@" 21576910425Smrg echo "exit 0" 21676910425Smrg chmod +x $file 21776910425Smrg exit 1 21876910425Smrg fi 21976910425Smrg ;; 22076910425Smrg 221db17cd6dSmrg bison*|yacc*) 22276910425Smrg echo 1>&2 "\ 22376910425SmrgWARNING: \`$1' $msg. You should only need it if 22476910425Smrg you modified a \`.y' file. You may need the \`Bison' package 22576910425Smrg in order for those modifications to take effect. You can get 22676910425Smrg \`Bison' from any GNU archive site." 22776910425Smrg rm -f y.tab.c y.tab.h 228db17cd6dSmrg if test $# -ne 1; then 22976910425Smrg eval LASTARG="\${$#}" 230db17cd6dSmrg case $LASTARG in 23176910425Smrg *.y) 23276910425Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 233db17cd6dSmrg if test -f "$SRCFILE"; then 23476910425Smrg cp "$SRCFILE" y.tab.c 23576910425Smrg fi 23676910425Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 237db17cd6dSmrg if test -f "$SRCFILE"; then 23876910425Smrg cp "$SRCFILE" y.tab.h 23976910425Smrg fi 24076910425Smrg ;; 24176910425Smrg esac 24276910425Smrg fi 243db17cd6dSmrg if test ! -f y.tab.h; then 24476910425Smrg echo >y.tab.h 24576910425Smrg fi 246db17cd6dSmrg if test ! -f y.tab.c; then 24776910425Smrg echo 'main() { return 0; }' >y.tab.c 24876910425Smrg fi 24976910425Smrg ;; 25076910425Smrg 251db17cd6dSmrg lex*|flex*) 25276910425Smrg echo 1>&2 "\ 25376910425SmrgWARNING: \`$1' is $msg. You should only need it if 25476910425Smrg you modified a \`.l' file. You may need the \`Flex' package 25576910425Smrg in order for those modifications to take effect. You can get 25676910425Smrg \`Flex' from any GNU archive site." 25776910425Smrg rm -f lex.yy.c 258db17cd6dSmrg if test $# -ne 1; then 25976910425Smrg eval LASTARG="\${$#}" 260db17cd6dSmrg case $LASTARG in 26176910425Smrg *.l) 26276910425Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 263db17cd6dSmrg if test -f "$SRCFILE"; then 26476910425Smrg cp "$SRCFILE" lex.yy.c 26576910425Smrg fi 26676910425Smrg ;; 26776910425Smrg esac 26876910425Smrg fi 269db17cd6dSmrg if test ! -f lex.yy.c; then 27076910425Smrg echo 'main() { return 0; }' >lex.yy.c 27176910425Smrg fi 27276910425Smrg ;; 27376910425Smrg 274db17cd6dSmrg help2man*) 27576910425Smrg echo 1>&2 "\ 27676910425SmrgWARNING: \`$1' is $msg. You should only need it if 27776910425Smrg you modified a dependency of a manual page. You may need the 27876910425Smrg \`Help2man' package in order for those modifications to take 27976910425Smrg effect. You can get \`Help2man' from any GNU archive site." 28076910425Smrg 281db17cd6dSmrg file=`echo "$*" | sed -n "$sed_output"` 282db17cd6dSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 283db17cd6dSmrg if test -f "$file"; then 28476910425Smrg touch $file 28576910425Smrg else 28676910425Smrg test -z "$file" || exec >$file 28776910425Smrg echo ".ab help2man is required to generate this page" 288db17cd6dSmrg exit $? 28976910425Smrg fi 29076910425Smrg ;; 29176910425Smrg 292db17cd6dSmrg makeinfo*) 29376910425Smrg echo 1>&2 "\ 29476910425SmrgWARNING: \`$1' is $msg. You should only need it if 29576910425Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 29676910425Smrg indirectly affecting the aspect of the manual. The spurious 29776910425Smrg call might also be the consequence of using a buggy \`make' (AIX, 29876910425Smrg DU, IRIX). You might want to install the \`Texinfo' package or 29976910425Smrg the \`GNU make' package. Grab either from any GNU archive site." 30076910425Smrg # The file to touch is that specified with -o ... 301db17cd6dSmrg file=`echo "$*" | sed -n "$sed_output"` 302db17cd6dSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 30376910425Smrg if test -z "$file"; then 30476910425Smrg # ... or it is the one specified with @setfilename ... 30576910425Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 306db17cd6dSmrg file=`sed -n ' 307db17cd6dSmrg /^@setfilename/{ 308db17cd6dSmrg s/.* \([^ ]*\) *$/\1/ 309db17cd6dSmrg p 310db17cd6dSmrg q 311db17cd6dSmrg }' $infile` 31276910425Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 31376910425Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 31476910425Smrg fi 31576910425Smrg # If the file does not exist, the user really needs makeinfo; 31676910425Smrg # let's fail without touching anything. 31776910425Smrg test -f $file || exit 1 31876910425Smrg touch $file 31976910425Smrg ;; 32076910425Smrg 321db17cd6dSmrg tar*) 32276910425Smrg shift 32376910425Smrg 32476910425Smrg # We have already tried tar in the generic part. 32576910425Smrg # Look for gnutar/gtar before invocation to avoid ugly error 32676910425Smrg # messages. 32776910425Smrg if (gnutar --version > /dev/null 2>&1); then 32876910425Smrg gnutar "$@" && exit 0 32976910425Smrg fi 33076910425Smrg if (gtar --version > /dev/null 2>&1); then 33176910425Smrg gtar "$@" && exit 0 33276910425Smrg fi 33376910425Smrg firstarg="$1" 33476910425Smrg if shift; then 335db17cd6dSmrg case $firstarg in 33676910425Smrg *o*) 33776910425Smrg firstarg=`echo "$firstarg" | sed s/o//` 33876910425Smrg tar "$firstarg" "$@" && exit 0 33976910425Smrg ;; 34076910425Smrg esac 341db17cd6dSmrg case $firstarg in 34276910425Smrg *h*) 34376910425Smrg firstarg=`echo "$firstarg" | sed s/h//` 34476910425Smrg tar "$firstarg" "$@" && exit 0 34576910425Smrg ;; 34676910425Smrg esac 34776910425Smrg fi 34876910425Smrg 34976910425Smrg echo 1>&2 "\ 35076910425SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 35176910425Smrg You may want to install GNU tar or Free paxutils, or check the 35276910425Smrg command line arguments." 35376910425Smrg exit 1 35476910425Smrg ;; 35576910425Smrg 35676910425Smrg *) 35776910425Smrg echo 1>&2 "\ 35876910425SmrgWARNING: \`$1' is needed, and is $msg. 35976910425Smrg You might have modified some files without having the 36076910425Smrg proper tools for further handling them. Check the \`README' file, 36176910425Smrg it often tells you about the needed prerequisites for installing 36276910425Smrg this package. You may also peek at any GNU archive site, in case 36376910425Smrg some other package would contain this missing \`$1' program." 36476910425Smrg exit 1 36576910425Smrg ;; 36676910425Smrgesac 36776910425Smrg 36876910425Smrgexit 0 36976910425Smrg 37076910425Smrg# Local variables: 37176910425Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 37276910425Smrg# time-stamp-start: "scriptversion=" 37376910425Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 374db17cd6dSmrg# time-stamp-time-zone: "UTC" 375db17cd6dSmrg# time-stamp-end: "; # UTC" 37676910425Smrg# End: 377