missing revision b698ba48
109885543Smrg#! /bin/sh 209885543Smrg# Common stub for a few missing GNU programs while installing. 309885543Smrg 4b698ba48Smrgscriptversion=2009-04-28.21; # UTC 509885543Smrg 6b698ba48Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 7b698ba48Smrg# 2008, 2009 Free Software Foundation, Inc. 809885543Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 909885543Smrg 1009885543Smrg# This program is free software; you can redistribute it and/or modify 1109885543Smrg# it under the terms of the GNU General Public License as published by 1209885543Smrg# the Free Software Foundation; either version 2, or (at your option) 1309885543Smrg# any later version. 1409885543Smrg 1509885543Smrg# This program is distributed in the hope that it will be useful, 1609885543Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1709885543Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1809885543Smrg# GNU General Public License for more details. 1909885543Smrg 2009885543Smrg# You should have received a copy of the GNU General Public License 21b698ba48Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 2209885543Smrg 2309885543Smrg# As a special exception to the GNU General Public License, if you 2409885543Smrg# distribute this file as part of a program that contains a 2509885543Smrg# configuration script generated by Autoconf, you may include it under 2609885543Smrg# the same distribution terms that you use for the rest of that program. 2709885543Smrg 2809885543Smrgif test $# -eq 0; then 2909885543Smrg echo 1>&2 "Try \`$0 --help' for more information" 3009885543Smrg exit 1 3109885543Smrgfi 3209885543Smrg 3309885543Smrgrun=: 347104f784Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 357104f784Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 3609885543Smrg 3709885543Smrg# In the cases where this matters, `missing' is being run in the 3809885543Smrg# srcdir already. 3909885543Smrgif test -f configure.ac; then 4009885543Smrg configure_ac=configure.ac 4109885543Smrgelse 4209885543Smrg configure_ac=configure.in 4309885543Smrgfi 4409885543Smrg 4509885543Smrgmsg="missing on your system" 4609885543Smrg 477104f784Smrgcase $1 in 4809885543Smrg--run) 4909885543Smrg # Try to run requested program, and just exit if it succeeds. 5009885543Smrg run= 5109885543Smrg shift 5209885543Smrg "$@" && exit 0 5309885543Smrg # Exit code 63 means version mismatch. This often happens 5409885543Smrg # when the user try to use an ancient version of a tool on 5509885543Smrg # a file that requires a minimum version. In this case we 5609885543Smrg # we should proceed has if the program had been absent, or 5709885543Smrg # if --run hadn't been passed. 5809885543Smrg if test $? = 63; then 5909885543Smrg run=: 6009885543Smrg msg="probably too old" 6109885543Smrg fi 6209885543Smrg ;; 6309885543Smrg 6409885543Smrg -h|--h|--he|--hel|--help) 6509885543Smrg echo "\ 6609885543Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 6709885543Smrg 6809885543SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 6909885543Smrgerror status if there is no known handling for PROGRAM. 7009885543Smrg 7109885543SmrgOptions: 7209885543Smrg -h, --help display this help and exit 7309885543Smrg -v, --version output version information and exit 7409885543Smrg --run try to run the given command, and emulate it if it fails 7509885543Smrg 7609885543SmrgSupported PROGRAM values: 7709885543Smrg aclocal touch file \`aclocal.m4' 7809885543Smrg autoconf touch file \`configure' 7909885543Smrg autoheader touch file \`config.h.in' 807104f784Smrg autom4te touch the output file, or create a stub one 8109885543Smrg automake touch all \`Makefile.in' files 8209885543Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 8309885543Smrg flex create \`lex.yy.c', if possible, from existing .c 8409885543Smrg help2man touch the output file 8509885543Smrg lex create \`lex.yy.c', if possible, from existing .c 8609885543Smrg makeinfo touch the output file 8709885543Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 8809885543Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 8909885543Smrg 90b698ba48SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 91b698ba48Smrg\`g' are ignored when checking the name. 92b698ba48Smrg 9309885543SmrgSend bug reports to <bug-automake@gnu.org>." 9409885543Smrg exit $? 9509885543Smrg ;; 9609885543Smrg 9709885543Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 9809885543Smrg echo "missing $scriptversion (GNU Automake)" 9909885543Smrg exit $? 10009885543Smrg ;; 10109885543Smrg 10209885543Smrg -*) 10309885543Smrg echo 1>&2 "$0: Unknown \`$1' option" 10409885543Smrg echo 1>&2 "Try \`$0 --help' for more information" 10509885543Smrg exit 1 10609885543Smrg ;; 10709885543Smrg 10809885543Smrgesac 10909885543Smrg 110b698ba48Smrg# normalize program name to check for. 111b698ba48Smrgprogram=`echo "$1" | sed ' 112b698ba48Smrg s/^gnu-//; t 113b698ba48Smrg s/^gnu//; t 114b698ba48Smrg s/^g//; t'` 115b698ba48Smrg 11609885543Smrg# Now exit if we have it, but it failed. Also exit now if we 11709885543Smrg# don't have it and --version was passed (most likely to detect 118b698ba48Smrg# the program). This is about non-GNU programs, so use $1 not 119b698ba48Smrg# $program. 1207104f784Smrgcase $1 in 121b698ba48Smrg lex*|yacc*) 12209885543Smrg # Not GNU programs, they don't have --version. 12309885543Smrg ;; 12409885543Smrg 125b698ba48Smrg tar*) 12609885543Smrg if test -n "$run"; then 12709885543Smrg echo 1>&2 "ERROR: \`tar' requires --run" 12809885543Smrg exit 1 12909885543Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 13009885543Smrg exit 1 13109885543Smrg fi 13209885543Smrg ;; 13309885543Smrg 13409885543Smrg *) 13509885543Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 13609885543Smrg # We have it, but it failed. 13709885543Smrg exit 1 13809885543Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 13909885543Smrg # Could not run --version or --help. This is probably someone 14009885543Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 14109885543Smrg # $TOOL exists and not knowing $TOOL uses missing. 14209885543Smrg exit 1 14309885543Smrg fi 14409885543Smrg ;; 14509885543Smrgesac 14609885543Smrg 14709885543Smrg# If it does not exist, or fails to run (possibly an outdated version), 14809885543Smrg# try to emulate it. 149b698ba48Smrgcase $program in 15009885543Smrg aclocal*) 15109885543Smrg echo 1>&2 "\ 15209885543SmrgWARNING: \`$1' is $msg. You should only need it if 15309885543Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 15409885543Smrg to install the \`Automake' and \`Perl' packages. Grab them from 15509885543Smrg any GNU archive site." 15609885543Smrg touch aclocal.m4 15709885543Smrg ;; 15809885543Smrg 159b698ba48Smrg autoconf*) 16009885543Smrg echo 1>&2 "\ 16109885543SmrgWARNING: \`$1' is $msg. You should only need it if 16209885543Smrg you modified \`${configure_ac}'. You might want to install the 16309885543Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 16409885543Smrg archive site." 16509885543Smrg touch configure 16609885543Smrg ;; 16709885543Smrg 168b698ba48Smrg autoheader*) 16909885543Smrg echo 1>&2 "\ 17009885543SmrgWARNING: \`$1' is $msg. You should only need it if 17109885543Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 17209885543Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 17309885543Smrg from any GNU archive site." 17409885543Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 17509885543Smrg test -z "$files" && files="config.h" 17609885543Smrg touch_files= 17709885543Smrg for f in $files; do 1787104f784Smrg case $f in 17909885543Smrg *:*) touch_files="$touch_files "`echo "$f" | 18009885543Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 18109885543Smrg *) touch_files="$touch_files $f.in";; 18209885543Smrg esac 18309885543Smrg done 18409885543Smrg touch $touch_files 18509885543Smrg ;; 18609885543Smrg 18709885543Smrg automake*) 18809885543Smrg echo 1>&2 "\ 18909885543SmrgWARNING: \`$1' is $msg. You should only need it if 19009885543Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 19109885543Smrg You might want to install the \`Automake' and \`Perl' packages. 19209885543Smrg Grab them from any GNU archive site." 19309885543Smrg find . -type f -name Makefile.am -print | 19409885543Smrg sed 's/\.am$/.in/' | 19509885543Smrg while read f; do touch "$f"; done 19609885543Smrg ;; 19709885543Smrg 198b698ba48Smrg autom4te*) 19909885543Smrg echo 1>&2 "\ 20009885543SmrgWARNING: \`$1' is needed, but is $msg. 20109885543Smrg You might have modified some files without having the 20209885543Smrg proper tools for further handling them. 20309885543Smrg You can get \`$1' as part of \`Autoconf' from any GNU 20409885543Smrg archive site." 20509885543Smrg 2067104f784Smrg file=`echo "$*" | sed -n "$sed_output"` 2077104f784Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 20809885543Smrg if test -f "$file"; then 20909885543Smrg touch $file 21009885543Smrg else 21109885543Smrg test -z "$file" || exec >$file 21209885543Smrg echo "#! /bin/sh" 21309885543Smrg echo "# Created by GNU Automake missing as a replacement of" 21409885543Smrg echo "# $ $@" 21509885543Smrg echo "exit 0" 21609885543Smrg chmod +x $file 21709885543Smrg exit 1 21809885543Smrg fi 21909885543Smrg ;; 22009885543Smrg 221b698ba48Smrg bison*|yacc*) 22209885543Smrg echo 1>&2 "\ 22309885543SmrgWARNING: \`$1' $msg. You should only need it if 22409885543Smrg you modified a \`.y' file. You may need the \`Bison' package 22509885543Smrg in order for those modifications to take effect. You can get 22609885543Smrg \`Bison' from any GNU archive site." 22709885543Smrg rm -f y.tab.c y.tab.h 2287104f784Smrg if test $# -ne 1; then 22909885543Smrg eval LASTARG="\${$#}" 2307104f784Smrg case $LASTARG in 23109885543Smrg *.y) 23209885543Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 2337104f784Smrg if test -f "$SRCFILE"; then 23409885543Smrg cp "$SRCFILE" y.tab.c 23509885543Smrg fi 23609885543Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 2377104f784Smrg if test -f "$SRCFILE"; then 23809885543Smrg cp "$SRCFILE" y.tab.h 23909885543Smrg fi 24009885543Smrg ;; 24109885543Smrg esac 24209885543Smrg fi 2437104f784Smrg if test ! -f y.tab.h; then 24409885543Smrg echo >y.tab.h 24509885543Smrg fi 2467104f784Smrg if test ! -f y.tab.c; then 24709885543Smrg echo 'main() { return 0; }' >y.tab.c 24809885543Smrg fi 24909885543Smrg ;; 25009885543Smrg 251b698ba48Smrg lex*|flex*) 25209885543Smrg echo 1>&2 "\ 25309885543SmrgWARNING: \`$1' is $msg. You should only need it if 25409885543Smrg you modified a \`.l' file. You may need the \`Flex' package 25509885543Smrg in order for those modifications to take effect. You can get 25609885543Smrg \`Flex' from any GNU archive site." 25709885543Smrg rm -f lex.yy.c 2587104f784Smrg if test $# -ne 1; then 25909885543Smrg eval LASTARG="\${$#}" 2607104f784Smrg case $LASTARG in 26109885543Smrg *.l) 26209885543Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 2637104f784Smrg if test -f "$SRCFILE"; then 26409885543Smrg cp "$SRCFILE" lex.yy.c 26509885543Smrg fi 26609885543Smrg ;; 26709885543Smrg esac 26809885543Smrg fi 2697104f784Smrg if test ! -f lex.yy.c; then 27009885543Smrg echo 'main() { return 0; }' >lex.yy.c 27109885543Smrg fi 27209885543Smrg ;; 27309885543Smrg 274b698ba48Smrg help2man*) 27509885543Smrg echo 1>&2 "\ 27609885543SmrgWARNING: \`$1' is $msg. You should only need it if 27709885543Smrg you modified a dependency of a manual page. You may need the 27809885543Smrg \`Help2man' package in order for those modifications to take 27909885543Smrg effect. You can get \`Help2man' from any GNU archive site." 28009885543Smrg 2817104f784Smrg file=`echo "$*" | sed -n "$sed_output"` 2827104f784Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2837104f784Smrg if test -f "$file"; then 28409885543Smrg touch $file 28509885543Smrg else 28609885543Smrg test -z "$file" || exec >$file 28709885543Smrg echo ".ab help2man is required to generate this page" 288b698ba48Smrg exit $? 28909885543Smrg fi 29009885543Smrg ;; 29109885543Smrg 292b698ba48Smrg makeinfo*) 29309885543Smrg echo 1>&2 "\ 29409885543SmrgWARNING: \`$1' is $msg. You should only need it if 29509885543Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 29609885543Smrg indirectly affecting the aspect of the manual. The spurious 29709885543Smrg call might also be the consequence of using a buggy \`make' (AIX, 29809885543Smrg DU, IRIX). You might want to install the \`Texinfo' package or 29909885543Smrg the \`GNU make' package. Grab either from any GNU archive site." 30009885543Smrg # The file to touch is that specified with -o ... 3017104f784Smrg file=`echo "$*" | sed -n "$sed_output"` 3027104f784Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 30309885543Smrg if test -z "$file"; then 30409885543Smrg # ... or it is the one specified with @setfilename ... 30509885543Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 3067104f784Smrg file=`sed -n ' 3077104f784Smrg /^@setfilename/{ 3087104f784Smrg s/.* \([^ ]*\) *$/\1/ 3097104f784Smrg p 3107104f784Smrg q 3117104f784Smrg }' $infile` 31209885543Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 31309885543Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 31409885543Smrg fi 31509885543Smrg # If the file does not exist, the user really needs makeinfo; 31609885543Smrg # let's fail without touching anything. 31709885543Smrg test -f $file || exit 1 31809885543Smrg touch $file 31909885543Smrg ;; 32009885543Smrg 321b698ba48Smrg tar*) 32209885543Smrg shift 32309885543Smrg 32409885543Smrg # We have already tried tar in the generic part. 32509885543Smrg # Look for gnutar/gtar before invocation to avoid ugly error 32609885543Smrg # messages. 32709885543Smrg if (gnutar --version > /dev/null 2>&1); then 32809885543Smrg gnutar "$@" && exit 0 32909885543Smrg fi 33009885543Smrg if (gtar --version > /dev/null 2>&1); then 33109885543Smrg gtar "$@" && exit 0 33209885543Smrg fi 33309885543Smrg firstarg="$1" 33409885543Smrg if shift; then 3357104f784Smrg case $firstarg in 33609885543Smrg *o*) 33709885543Smrg firstarg=`echo "$firstarg" | sed s/o//` 33809885543Smrg tar "$firstarg" "$@" && exit 0 33909885543Smrg ;; 34009885543Smrg esac 3417104f784Smrg case $firstarg in 34209885543Smrg *h*) 34309885543Smrg firstarg=`echo "$firstarg" | sed s/h//` 34409885543Smrg tar "$firstarg" "$@" && exit 0 34509885543Smrg ;; 34609885543Smrg esac 34709885543Smrg fi 34809885543Smrg 34909885543Smrg echo 1>&2 "\ 35009885543SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 35109885543Smrg You may want to install GNU tar or Free paxutils, or check the 35209885543Smrg command line arguments." 35309885543Smrg exit 1 35409885543Smrg ;; 35509885543Smrg 35609885543Smrg *) 35709885543Smrg echo 1>&2 "\ 35809885543SmrgWARNING: \`$1' is needed, and is $msg. 35909885543Smrg You might have modified some files without having the 36009885543Smrg proper tools for further handling them. Check the \`README' file, 36109885543Smrg it often tells you about the needed prerequisites for installing 36209885543Smrg this package. You may also peek at any GNU archive site, in case 36309885543Smrg some other package would contain this missing \`$1' program." 36409885543Smrg exit 1 36509885543Smrg ;; 36609885543Smrgesac 36709885543Smrg 36809885543Smrgexit 0 36909885543Smrg 37009885543Smrg# Local variables: 37109885543Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 37209885543Smrg# time-stamp-start: "scriptversion=" 37309885543Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 374b698ba48Smrg# time-stamp-time-zone: "UTC" 375b698ba48Smrg# time-stamp-end: "; # UTC" 37609885543Smrg# End: 377