missing revision 00084f2c
127702724Smrg#! /bin/sh 227702724Smrg# Common stub for a few missing GNU programs while installing. 327702724Smrg 400084f2cSmrgscriptversion=2009-04-28.21; # UTC 527702724Smrg 600084f2cSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 700084f2cSmrg# 2008, 2009 Free Software Foundation, Inc. 827702724Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 927702724Smrg 1027702724Smrg# This program is free software; you can redistribute it and/or modify 1127702724Smrg# it under the terms of the GNU General Public License as published by 1227702724Smrg# the Free Software Foundation; either version 2, or (at your option) 1327702724Smrg# any later version. 1427702724Smrg 1527702724Smrg# This program is distributed in the hope that it will be useful, 1627702724Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1727702724Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1827702724Smrg# GNU General Public License for more details. 1927702724Smrg 2027702724Smrg# You should have received a copy of the GNU General Public License 2100084f2cSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 2227702724Smrg 2327702724Smrg# As a special exception to the GNU General Public License, if you 2427702724Smrg# distribute this file as part of a program that contains a 2527702724Smrg# configuration script generated by Autoconf, you may include it under 2627702724Smrg# the same distribution terms that you use for the rest of that program. 2727702724Smrg 2827702724Smrgif test $# -eq 0; then 2927702724Smrg echo 1>&2 "Try \`$0 --help' for more information" 3027702724Smrg exit 1 3127702724Smrgfi 3227702724Smrg 3327702724Smrgrun=: 34e19dfac4Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 35e19dfac4Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 3627702724Smrg 3727702724Smrg# In the cases where this matters, `missing' is being run in the 3827702724Smrg# srcdir already. 3927702724Smrgif test -f configure.ac; then 4027702724Smrg configure_ac=configure.ac 4127702724Smrgelse 4227702724Smrg configure_ac=configure.in 4327702724Smrgfi 4427702724Smrg 4527702724Smrgmsg="missing on your system" 4627702724Smrg 47e19dfac4Smrgcase $1 in 4827702724Smrg--run) 4927702724Smrg # Try to run requested program, and just exit if it succeeds. 5027702724Smrg run= 5127702724Smrg shift 5227702724Smrg "$@" && exit 0 5327702724Smrg # Exit code 63 means version mismatch. This often happens 5427702724Smrg # when the user try to use an ancient version of a tool on 5527702724Smrg # a file that requires a minimum version. In this case we 5627702724Smrg # we should proceed has if the program had been absent, or 5727702724Smrg # if --run hadn't been passed. 5827702724Smrg if test $? = 63; then 5927702724Smrg run=: 6027702724Smrg msg="probably too old" 6127702724Smrg fi 6227702724Smrg ;; 6327702724Smrg 6427702724Smrg -h|--h|--he|--hel|--help) 6527702724Smrg echo "\ 6627702724Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 6727702724Smrg 6827702724SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 6927702724Smrgerror status if there is no known handling for PROGRAM. 7027702724Smrg 7127702724SmrgOptions: 7227702724Smrg -h, --help display this help and exit 7327702724Smrg -v, --version output version information and exit 7427702724Smrg --run try to run the given command, and emulate it if it fails 7527702724Smrg 7627702724SmrgSupported PROGRAM values: 7727702724Smrg aclocal touch file \`aclocal.m4' 7827702724Smrg autoconf touch file \`configure' 7927702724Smrg autoheader touch file \`config.h.in' 80e19dfac4Smrg autom4te touch the output file, or create a stub one 8127702724Smrg automake touch all \`Makefile.in' files 8227702724Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 8327702724Smrg flex create \`lex.yy.c', if possible, from existing .c 8427702724Smrg help2man touch the output file 8527702724Smrg lex create \`lex.yy.c', if possible, from existing .c 8627702724Smrg makeinfo touch the output file 8727702724Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 8827702724Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 8927702724Smrg 9000084f2cSmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 9100084f2cSmrg\`g' are ignored when checking the name. 9200084f2cSmrg 9327702724SmrgSend bug reports to <bug-automake@gnu.org>." 9427702724Smrg exit $? 9527702724Smrg ;; 9627702724Smrg 9727702724Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 9827702724Smrg echo "missing $scriptversion (GNU Automake)" 9927702724Smrg exit $? 10027702724Smrg ;; 10127702724Smrg 10227702724Smrg -*) 10327702724Smrg echo 1>&2 "$0: Unknown \`$1' option" 10427702724Smrg echo 1>&2 "Try \`$0 --help' for more information" 10527702724Smrg exit 1 10627702724Smrg ;; 10727702724Smrg 10827702724Smrgesac 10927702724Smrg 11000084f2cSmrg# normalize program name to check for. 11100084f2cSmrgprogram=`echo "$1" | sed ' 11200084f2cSmrg s/^gnu-//; t 11300084f2cSmrg s/^gnu//; t 11400084f2cSmrg s/^g//; t'` 11500084f2cSmrg 11627702724Smrg# Now exit if we have it, but it failed. Also exit now if we 11727702724Smrg# don't have it and --version was passed (most likely to detect 11800084f2cSmrg# the program). This is about non-GNU programs, so use $1 not 11900084f2cSmrg# $program. 120e19dfac4Smrgcase $1 in 12100084f2cSmrg lex*|yacc*) 12227702724Smrg # Not GNU programs, they don't have --version. 12327702724Smrg ;; 12427702724Smrg 12500084f2cSmrg tar*) 12627702724Smrg if test -n "$run"; then 12727702724Smrg echo 1>&2 "ERROR: \`tar' requires --run" 12827702724Smrg exit 1 12927702724Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 13027702724Smrg exit 1 13127702724Smrg fi 13227702724Smrg ;; 13327702724Smrg 13427702724Smrg *) 13527702724Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 13627702724Smrg # We have it, but it failed. 13727702724Smrg exit 1 13827702724Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 13927702724Smrg # Could not run --version or --help. This is probably someone 14027702724Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 14127702724Smrg # $TOOL exists and not knowing $TOOL uses missing. 14227702724Smrg exit 1 14327702724Smrg fi 14427702724Smrg ;; 14527702724Smrgesac 14627702724Smrg 14727702724Smrg# If it does not exist, or fails to run (possibly an outdated version), 14827702724Smrg# try to emulate it. 14900084f2cSmrgcase $program in 15027702724Smrg aclocal*) 15127702724Smrg echo 1>&2 "\ 15227702724SmrgWARNING: \`$1' is $msg. You should only need it if 15327702724Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 15427702724Smrg to install the \`Automake' and \`Perl' packages. Grab them from 15527702724Smrg any GNU archive site." 15627702724Smrg touch aclocal.m4 15727702724Smrg ;; 15827702724Smrg 15900084f2cSmrg autoconf*) 16027702724Smrg echo 1>&2 "\ 16127702724SmrgWARNING: \`$1' is $msg. You should only need it if 16227702724Smrg you modified \`${configure_ac}'. You might want to install the 16327702724Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 16427702724Smrg archive site." 16527702724Smrg touch configure 16627702724Smrg ;; 16727702724Smrg 16800084f2cSmrg autoheader*) 16927702724Smrg echo 1>&2 "\ 17027702724SmrgWARNING: \`$1' is $msg. You should only need it if 17127702724Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 17227702724Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 17327702724Smrg from any GNU archive site." 17427702724Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 17527702724Smrg test -z "$files" && files="config.h" 17627702724Smrg touch_files= 17727702724Smrg for f in $files; do 178e19dfac4Smrg case $f in 17927702724Smrg *:*) touch_files="$touch_files "`echo "$f" | 18027702724Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 18127702724Smrg *) touch_files="$touch_files $f.in";; 18227702724Smrg esac 18327702724Smrg done 18427702724Smrg touch $touch_files 18527702724Smrg ;; 18627702724Smrg 18727702724Smrg automake*) 18827702724Smrg echo 1>&2 "\ 18927702724SmrgWARNING: \`$1' is $msg. You should only need it if 19027702724Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 19127702724Smrg You might want to install the \`Automake' and \`Perl' packages. 19227702724Smrg Grab them from any GNU archive site." 19327702724Smrg find . -type f -name Makefile.am -print | 19427702724Smrg sed 's/\.am$/.in/' | 19527702724Smrg while read f; do touch "$f"; done 19627702724Smrg ;; 19727702724Smrg 19800084f2cSmrg autom4te*) 19927702724Smrg echo 1>&2 "\ 20027702724SmrgWARNING: \`$1' is needed, but is $msg. 20127702724Smrg You might have modified some files without having the 20227702724Smrg proper tools for further handling them. 20327702724Smrg You can get \`$1' as part of \`Autoconf' from any GNU 20427702724Smrg archive site." 20527702724Smrg 206e19dfac4Smrg file=`echo "$*" | sed -n "$sed_output"` 207e19dfac4Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 20827702724Smrg if test -f "$file"; then 20927702724Smrg touch $file 21027702724Smrg else 21127702724Smrg test -z "$file" || exec >$file 21227702724Smrg echo "#! /bin/sh" 21327702724Smrg echo "# Created by GNU Automake missing as a replacement of" 21427702724Smrg echo "# $ $@" 21527702724Smrg echo "exit 0" 21627702724Smrg chmod +x $file 21727702724Smrg exit 1 21827702724Smrg fi 21927702724Smrg ;; 22027702724Smrg 22100084f2cSmrg bison*|yacc*) 22227702724Smrg echo 1>&2 "\ 22327702724SmrgWARNING: \`$1' $msg. You should only need it if 22427702724Smrg you modified a \`.y' file. You may need the \`Bison' package 22527702724Smrg in order for those modifications to take effect. You can get 22627702724Smrg \`Bison' from any GNU archive site." 22727702724Smrg rm -f y.tab.c y.tab.h 228e19dfac4Smrg if test $# -ne 1; then 22927702724Smrg eval LASTARG="\${$#}" 230e19dfac4Smrg case $LASTARG in 23127702724Smrg *.y) 23227702724Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 233e19dfac4Smrg if test -f "$SRCFILE"; then 23427702724Smrg cp "$SRCFILE" y.tab.c 23527702724Smrg fi 23627702724Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 237e19dfac4Smrg if test -f "$SRCFILE"; then 23827702724Smrg cp "$SRCFILE" y.tab.h 23927702724Smrg fi 24027702724Smrg ;; 24127702724Smrg esac 24227702724Smrg fi 243e19dfac4Smrg if test ! -f y.tab.h; then 24427702724Smrg echo >y.tab.h 24527702724Smrg fi 246e19dfac4Smrg if test ! -f y.tab.c; then 24727702724Smrg echo 'main() { return 0; }' >y.tab.c 24827702724Smrg fi 24927702724Smrg ;; 25027702724Smrg 25100084f2cSmrg lex*|flex*) 25227702724Smrg echo 1>&2 "\ 25327702724SmrgWARNING: \`$1' is $msg. You should only need it if 25427702724Smrg you modified a \`.l' file. You may need the \`Flex' package 25527702724Smrg in order for those modifications to take effect. You can get 25627702724Smrg \`Flex' from any GNU archive site." 25727702724Smrg rm -f lex.yy.c 258e19dfac4Smrg if test $# -ne 1; then 25927702724Smrg eval LASTARG="\${$#}" 260e19dfac4Smrg case $LASTARG in 26127702724Smrg *.l) 26227702724Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 263e19dfac4Smrg if test -f "$SRCFILE"; then 26427702724Smrg cp "$SRCFILE" lex.yy.c 26527702724Smrg fi 26627702724Smrg ;; 26727702724Smrg esac 26827702724Smrg fi 269e19dfac4Smrg if test ! -f lex.yy.c; then 27027702724Smrg echo 'main() { return 0; }' >lex.yy.c 27127702724Smrg fi 27227702724Smrg ;; 27327702724Smrg 27400084f2cSmrg help2man*) 27527702724Smrg echo 1>&2 "\ 27627702724SmrgWARNING: \`$1' is $msg. You should only need it if 27727702724Smrg you modified a dependency of a manual page. You may need the 27827702724Smrg \`Help2man' package in order for those modifications to take 27927702724Smrg effect. You can get \`Help2man' from any GNU archive site." 28027702724Smrg 281e19dfac4Smrg file=`echo "$*" | sed -n "$sed_output"` 282e19dfac4Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 283e19dfac4Smrg if test -f "$file"; then 28427702724Smrg touch $file 28527702724Smrg else 28627702724Smrg test -z "$file" || exec >$file 28727702724Smrg echo ".ab help2man is required to generate this page" 28800084f2cSmrg exit $? 28927702724Smrg fi 29027702724Smrg ;; 29127702724Smrg 29200084f2cSmrg makeinfo*) 29327702724Smrg echo 1>&2 "\ 29427702724SmrgWARNING: \`$1' is $msg. You should only need it if 29527702724Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 29627702724Smrg indirectly affecting the aspect of the manual. The spurious 29727702724Smrg call might also be the consequence of using a buggy \`make' (AIX, 29827702724Smrg DU, IRIX). You might want to install the \`Texinfo' package or 29927702724Smrg the \`GNU make' package. Grab either from any GNU archive site." 30027702724Smrg # The file to touch is that specified with -o ... 301e19dfac4Smrg file=`echo "$*" | sed -n "$sed_output"` 302e19dfac4Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 30327702724Smrg if test -z "$file"; then 30427702724Smrg # ... or it is the one specified with @setfilename ... 30527702724Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 306e19dfac4Smrg file=`sed -n ' 307e19dfac4Smrg /^@setfilename/{ 308e19dfac4Smrg s/.* \([^ ]*\) *$/\1/ 309e19dfac4Smrg p 310e19dfac4Smrg q 311e19dfac4Smrg }' $infile` 31227702724Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 31327702724Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 31427702724Smrg fi 31527702724Smrg # If the file does not exist, the user really needs makeinfo; 31627702724Smrg # let's fail without touching anything. 31727702724Smrg test -f $file || exit 1 31827702724Smrg touch $file 31927702724Smrg ;; 32027702724Smrg 32100084f2cSmrg tar*) 32227702724Smrg shift 32327702724Smrg 32427702724Smrg # We have already tried tar in the generic part. 32527702724Smrg # Look for gnutar/gtar before invocation to avoid ugly error 32627702724Smrg # messages. 32727702724Smrg if (gnutar --version > /dev/null 2>&1); then 32827702724Smrg gnutar "$@" && exit 0 32927702724Smrg fi 33027702724Smrg if (gtar --version > /dev/null 2>&1); then 33127702724Smrg gtar "$@" && exit 0 33227702724Smrg fi 33327702724Smrg firstarg="$1" 33427702724Smrg if shift; then 335e19dfac4Smrg case $firstarg in 33627702724Smrg *o*) 33727702724Smrg firstarg=`echo "$firstarg" | sed s/o//` 33827702724Smrg tar "$firstarg" "$@" && exit 0 33927702724Smrg ;; 34027702724Smrg esac 341e19dfac4Smrg case $firstarg in 34227702724Smrg *h*) 34327702724Smrg firstarg=`echo "$firstarg" | sed s/h//` 34427702724Smrg tar "$firstarg" "$@" && exit 0 34527702724Smrg ;; 34627702724Smrg esac 34727702724Smrg fi 34827702724Smrg 34927702724Smrg echo 1>&2 "\ 35027702724SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 35127702724Smrg You may want to install GNU tar or Free paxutils, or check the 35227702724Smrg command line arguments." 35327702724Smrg exit 1 35427702724Smrg ;; 35527702724Smrg 35627702724Smrg *) 35727702724Smrg echo 1>&2 "\ 35827702724SmrgWARNING: \`$1' is needed, and is $msg. 35927702724Smrg You might have modified some files without having the 36027702724Smrg proper tools for further handling them. Check the \`README' file, 36127702724Smrg it often tells you about the needed prerequisites for installing 36227702724Smrg this package. You may also peek at any GNU archive site, in case 36327702724Smrg some other package would contain this missing \`$1' program." 36427702724Smrg exit 1 36527702724Smrg ;; 36627702724Smrgesac 36727702724Smrg 36827702724Smrgexit 0 36927702724Smrg 37027702724Smrg# Local variables: 37127702724Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 37227702724Smrg# time-stamp-start: "scriptversion=" 37327702724Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 37400084f2cSmrg# time-stamp-time-zone: "UTC" 37500084f2cSmrg# time-stamp-end: "; # UTC" 37627702724Smrg# End: 377