missing revision 56f6b22b
156f6b22bSmrg#! /bin/sh 256f6b22bSmrg# Common stub for a few missing GNU programs while installing. 356f6b22bSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. 456f6b22bSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 556f6b22bSmrg 656f6b22bSmrg# This program is free software; you can redistribute it and/or modify 756f6b22bSmrg# it under the terms of the GNU General Public License as published by 856f6b22bSmrg# the Free Software Foundation; either version 2, or (at your option) 956f6b22bSmrg# any later version. 1056f6b22bSmrg 1156f6b22bSmrg# This program is distributed in the hope that it will be useful, 1256f6b22bSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1356f6b22bSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1456f6b22bSmrg# GNU General Public License for more details. 1556f6b22bSmrg 1656f6b22bSmrg# You should have received a copy of the GNU General Public License 1756f6b22bSmrg# along with this program; if not, write to the Free Software 1856f6b22bSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 1956f6b22bSmrg# 02111-1307, USA. 2056f6b22bSmrg 2156f6b22bSmrg# As a special exception to the GNU General Public License, if you 2256f6b22bSmrg# distribute this file as part of a program that contains a 2356f6b22bSmrg# configuration script generated by Autoconf, you may include it under 2456f6b22bSmrg# the same distribution terms that you use for the rest of that program. 2556f6b22bSmrg 2656f6b22bSmrgif test $# -eq 0; then 2756f6b22bSmrg echo 1>&2 "Try \`$0 --help' for more information" 2856f6b22bSmrg exit 1 2956f6b22bSmrgfi 3056f6b22bSmrg 3156f6b22bSmrgrun=: 3256f6b22bSmrg 3356f6b22bSmrg# In the cases where this matters, `missing' is being run in the 3456f6b22bSmrg# srcdir already. 3556f6b22bSmrgif test -f configure.ac; then 3656f6b22bSmrg configure_ac=configure.ac 3756f6b22bSmrgelse 3856f6b22bSmrg configure_ac=configure.in 3956f6b22bSmrgfi 4056f6b22bSmrg 4156f6b22bSmrgcase "$1" in 4256f6b22bSmrg--run) 4356f6b22bSmrg # Try to run requested program, and just exit if it succeeds. 4456f6b22bSmrg run= 4556f6b22bSmrg shift 4656f6b22bSmrg "$@" && exit 0 4756f6b22bSmrg ;; 4856f6b22bSmrgesac 4956f6b22bSmrg 5056f6b22bSmrg# If it does not exist, or fails to run (possibly an outdated version), 5156f6b22bSmrg# try to emulate it. 5256f6b22bSmrgcase "$1" in 5356f6b22bSmrg 5456f6b22bSmrg -h|--h|--he|--hel|--help) 5556f6b22bSmrg echo "\ 5656f6b22bSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 5756f6b22bSmrg 5856f6b22bSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 5956f6b22bSmrgerror status if there is no known handling for PROGRAM. 6056f6b22bSmrg 6156f6b22bSmrgOptions: 6256f6b22bSmrg -h, --help display this help and exit 6356f6b22bSmrg -v, --version output version information and exit 6456f6b22bSmrg --run try to run the given command, and emulate it if it fails 6556f6b22bSmrg 6656f6b22bSmrgSupported PROGRAM values: 6756f6b22bSmrg aclocal touch file \`aclocal.m4' 6856f6b22bSmrg autoconf touch file \`configure' 6956f6b22bSmrg autoheader touch file \`config.h.in' 7056f6b22bSmrg automake touch all \`Makefile.in' files 7156f6b22bSmrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 7256f6b22bSmrg flex create \`lex.yy.c', if possible, from existing .c 7356f6b22bSmrg help2man touch the output file 7456f6b22bSmrg lex create \`lex.yy.c', if possible, from existing .c 7556f6b22bSmrg makeinfo touch the output file 7656f6b22bSmrg tar try tar, gnutar, gtar, then tar without non-portable flags 7756f6b22bSmrg yacc create \`y.tab.[ch]', if possible, from existing .[ch]" 7856f6b22bSmrg ;; 7956f6b22bSmrg 8056f6b22bSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 8156f6b22bSmrg echo "missing 0.4 - GNU automake" 8256f6b22bSmrg ;; 8356f6b22bSmrg 8456f6b22bSmrg -*) 8556f6b22bSmrg echo 1>&2 "$0: Unknown \`$1' option" 8656f6b22bSmrg echo 1>&2 "Try \`$0 --help' for more information" 8756f6b22bSmrg exit 1 8856f6b22bSmrg ;; 8956f6b22bSmrg 9056f6b22bSmrg aclocal*) 9156f6b22bSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 9256f6b22bSmrg # We have it, but it failed. 9356f6b22bSmrg exit 1 9456f6b22bSmrg fi 9556f6b22bSmrg 9656f6b22bSmrg echo 1>&2 "\ 9756f6b22bSmrgWARNING: \`$1' is missing on your system. You should only need it if 9856f6b22bSmrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 9956f6b22bSmrg to install the \`Automake' and \`Perl' packages. Grab them from 10056f6b22bSmrg any GNU archive site." 10156f6b22bSmrg touch aclocal.m4 10256f6b22bSmrg ;; 10356f6b22bSmrg 10456f6b22bSmrg autoconf) 10556f6b22bSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 10656f6b22bSmrg # We have it, but it failed. 10756f6b22bSmrg exit 1 10856f6b22bSmrg fi 10956f6b22bSmrg 11056f6b22bSmrg echo 1>&2 "\ 11156f6b22bSmrgWARNING: \`$1' is missing on your system. You should only need it if 11256f6b22bSmrg you modified \`${configure_ac}'. You might want to install the 11356f6b22bSmrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 11456f6b22bSmrg archive site." 11556f6b22bSmrg touch configure 11656f6b22bSmrg ;; 11756f6b22bSmrg 11856f6b22bSmrg autoheader) 11956f6b22bSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 12056f6b22bSmrg # We have it, but it failed. 12156f6b22bSmrg exit 1 12256f6b22bSmrg fi 12356f6b22bSmrg 12456f6b22bSmrg echo 1>&2 "\ 12556f6b22bSmrgWARNING: \`$1' is missing on your system. You should only need it if 12656f6b22bSmrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 12756f6b22bSmrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 12856f6b22bSmrg from any GNU archive site." 12956f6b22bSmrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 13056f6b22bSmrg test -z "$files" && files="config.h" 13156f6b22bSmrg touch_files= 13256f6b22bSmrg for f in $files; do 13356f6b22bSmrg case "$f" in 13456f6b22bSmrg *:*) touch_files="$touch_files "`echo "$f" | 13556f6b22bSmrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 13656f6b22bSmrg *) touch_files="$touch_files $f.in";; 13756f6b22bSmrg esac 13856f6b22bSmrg done 13956f6b22bSmrg touch $touch_files 14056f6b22bSmrg ;; 14156f6b22bSmrg 14256f6b22bSmrg automake*) 14356f6b22bSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 14456f6b22bSmrg # We have it, but it failed. 14556f6b22bSmrg exit 1 14656f6b22bSmrg fi 14756f6b22bSmrg 14856f6b22bSmrg echo 1>&2 "\ 14956f6b22bSmrgWARNING: \`$1' is missing on your system. You should only need it if 15056f6b22bSmrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 15156f6b22bSmrg You might want to install the \`Automake' and \`Perl' packages. 15256f6b22bSmrg Grab them from any GNU archive site." 15356f6b22bSmrg find . -type f -name Makefile.am -print | 15456f6b22bSmrg sed 's/\.am$/.in/' | 15556f6b22bSmrg while read f; do touch "$f"; done 15656f6b22bSmrg ;; 15756f6b22bSmrg 15856f6b22bSmrg autom4te) 15956f6b22bSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 16056f6b22bSmrg # We have it, but it failed. 16156f6b22bSmrg exit 1 16256f6b22bSmrg fi 16356f6b22bSmrg 16456f6b22bSmrg echo 1>&2 "\ 16556f6b22bSmrgWARNING: \`$1' is needed, and you do not seem to have it handy on your 16656f6b22bSmrg system. You might have modified some files without having the 16756f6b22bSmrg proper tools for further handling them. 16856f6b22bSmrg You can get \`$1' as part of \`Autoconf' from any GNU 16956f6b22bSmrg archive site." 17056f6b22bSmrg 17156f6b22bSmrg file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 17256f6b22bSmrg test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 17356f6b22bSmrg if test -f "$file"; then 17456f6b22bSmrg touch $file 17556f6b22bSmrg else 17656f6b22bSmrg test -z "$file" || exec >$file 17756f6b22bSmrg echo "#! /bin/sh" 17856f6b22bSmrg echo "# Created by GNU Automake missing as a replacement of" 17956f6b22bSmrg echo "# $ $@" 18056f6b22bSmrg echo "exit 0" 18156f6b22bSmrg chmod +x $file 18256f6b22bSmrg exit 1 18356f6b22bSmrg fi 18456f6b22bSmrg ;; 18556f6b22bSmrg 18656f6b22bSmrg bison|yacc) 18756f6b22bSmrg echo 1>&2 "\ 18856f6b22bSmrgWARNING: \`$1' is missing on your system. You should only need it if 18956f6b22bSmrg you modified a \`.y' file. You may need the \`Bison' package 19056f6b22bSmrg in order for those modifications to take effect. You can get 19156f6b22bSmrg \`Bison' from any GNU archive site." 19256f6b22bSmrg rm -f y.tab.c y.tab.h 19356f6b22bSmrg if [ $# -ne 1 ]; then 19456f6b22bSmrg eval LASTARG="\${$#}" 19556f6b22bSmrg case "$LASTARG" in 19656f6b22bSmrg *.y) 19756f6b22bSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 19856f6b22bSmrg if [ -f "$SRCFILE" ]; then 19956f6b22bSmrg cp "$SRCFILE" y.tab.c 20056f6b22bSmrg fi 20156f6b22bSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 20256f6b22bSmrg if [ -f "$SRCFILE" ]; then 20356f6b22bSmrg cp "$SRCFILE" y.tab.h 20456f6b22bSmrg fi 20556f6b22bSmrg ;; 20656f6b22bSmrg esac 20756f6b22bSmrg fi 20856f6b22bSmrg if [ ! -f y.tab.h ]; then 20956f6b22bSmrg echo >y.tab.h 21056f6b22bSmrg fi 21156f6b22bSmrg if [ ! -f y.tab.c ]; then 21256f6b22bSmrg echo 'main() { return 0; }' >y.tab.c 21356f6b22bSmrg fi 21456f6b22bSmrg ;; 21556f6b22bSmrg 21656f6b22bSmrg lex|flex) 21756f6b22bSmrg echo 1>&2 "\ 21856f6b22bSmrgWARNING: \`$1' is missing on your system. You should only need it if 21956f6b22bSmrg you modified a \`.l' file. You may need the \`Flex' package 22056f6b22bSmrg in order for those modifications to take effect. You can get 22156f6b22bSmrg \`Flex' from any GNU archive site." 22256f6b22bSmrg rm -f lex.yy.c 22356f6b22bSmrg if [ $# -ne 1 ]; then 22456f6b22bSmrg eval LASTARG="\${$#}" 22556f6b22bSmrg case "$LASTARG" in 22656f6b22bSmrg *.l) 22756f6b22bSmrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 22856f6b22bSmrg if [ -f "$SRCFILE" ]; then 22956f6b22bSmrg cp "$SRCFILE" lex.yy.c 23056f6b22bSmrg fi 23156f6b22bSmrg ;; 23256f6b22bSmrg esac 23356f6b22bSmrg fi 23456f6b22bSmrg if [ ! -f lex.yy.c ]; then 23556f6b22bSmrg echo 'main() { return 0; }' >lex.yy.c 23656f6b22bSmrg fi 23756f6b22bSmrg ;; 23856f6b22bSmrg 23956f6b22bSmrg help2man) 24056f6b22bSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 24156f6b22bSmrg # We have it, but it failed. 24256f6b22bSmrg exit 1 24356f6b22bSmrg fi 24456f6b22bSmrg 24556f6b22bSmrg echo 1>&2 "\ 24656f6b22bSmrgWARNING: \`$1' is missing on your system. You should only need it if 24756f6b22bSmrg you modified a dependency of a manual page. You may need the 24856f6b22bSmrg \`Help2man' package in order for those modifications to take 24956f6b22bSmrg effect. You can get \`Help2man' from any GNU archive site." 25056f6b22bSmrg 25156f6b22bSmrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 25256f6b22bSmrg if test -z "$file"; then 25356f6b22bSmrg file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 25456f6b22bSmrg fi 25556f6b22bSmrg if [ -f "$file" ]; then 25656f6b22bSmrg touch $file 25756f6b22bSmrg else 25856f6b22bSmrg test -z "$file" || exec >$file 25956f6b22bSmrg echo ".ab help2man is required to generate this page" 26056f6b22bSmrg exit 1 26156f6b22bSmrg fi 26256f6b22bSmrg ;; 26356f6b22bSmrg 26456f6b22bSmrg makeinfo) 26556f6b22bSmrg if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then 26656f6b22bSmrg # We have makeinfo, but it failed. 26756f6b22bSmrg exit 1 26856f6b22bSmrg fi 26956f6b22bSmrg 27056f6b22bSmrg echo 1>&2 "\ 27156f6b22bSmrgWARNING: \`$1' is missing on your system. You should only need it if 27256f6b22bSmrg you modified a \`.texi' or \`.texinfo' file, or any other file 27356f6b22bSmrg indirectly affecting the aspect of the manual. The spurious 27456f6b22bSmrg call might also be the consequence of using a buggy \`make' (AIX, 27556f6b22bSmrg DU, IRIX). You might want to install the \`Texinfo' package or 27656f6b22bSmrg the \`GNU make' package. Grab either from any GNU archive site." 27756f6b22bSmrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 27856f6b22bSmrg if test -z "$file"; then 27956f6b22bSmrg file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 28056f6b22bSmrg file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` 28156f6b22bSmrg fi 28256f6b22bSmrg touch $file 28356f6b22bSmrg ;; 28456f6b22bSmrg 28556f6b22bSmrg tar) 28656f6b22bSmrg shift 28756f6b22bSmrg if test -n "$run"; then 28856f6b22bSmrg echo 1>&2 "ERROR: \`tar' requires --run" 28956f6b22bSmrg exit 1 29056f6b22bSmrg fi 29156f6b22bSmrg 29256f6b22bSmrg # We have already tried tar in the generic part. 29356f6b22bSmrg # Look for gnutar/gtar before invocation to avoid ugly error 29456f6b22bSmrg # messages. 29556f6b22bSmrg if (gnutar --version > /dev/null 2>&1); then 29656f6b22bSmrg gnutar "$@" && exit 0 29756f6b22bSmrg fi 29856f6b22bSmrg if (gtar --version > /dev/null 2>&1); then 29956f6b22bSmrg gtar "$@" && exit 0 30056f6b22bSmrg fi 30156f6b22bSmrg firstarg="$1" 30256f6b22bSmrg if shift; then 30356f6b22bSmrg case "$firstarg" in 30456f6b22bSmrg *o*) 30556f6b22bSmrg firstarg=`echo "$firstarg" | sed s/o//` 30656f6b22bSmrg tar "$firstarg" "$@" && exit 0 30756f6b22bSmrg ;; 30856f6b22bSmrg esac 30956f6b22bSmrg case "$firstarg" in 31056f6b22bSmrg *h*) 31156f6b22bSmrg firstarg=`echo "$firstarg" | sed s/h//` 31256f6b22bSmrg tar "$firstarg" "$@" && exit 0 31356f6b22bSmrg ;; 31456f6b22bSmrg esac 31556f6b22bSmrg fi 31656f6b22bSmrg 31756f6b22bSmrg echo 1>&2 "\ 31856f6b22bSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 31956f6b22bSmrg You may want to install GNU tar or Free paxutils, or check the 32056f6b22bSmrg command line arguments." 32156f6b22bSmrg exit 1 32256f6b22bSmrg ;; 32356f6b22bSmrg 32456f6b22bSmrg *) 32556f6b22bSmrg echo 1>&2 "\ 32656f6b22bSmrgWARNING: \`$1' is needed, and you do not seem to have it handy on your 32756f6b22bSmrg system. You might have modified some files without having the 32856f6b22bSmrg proper tools for further handling them. Check the \`README' file, 32956f6b22bSmrg it often tells you about the needed prerequisites for installing 33056f6b22bSmrg this package. You may also peek at any GNU archive site, in case 33156f6b22bSmrg some other package would contain this missing \`$1' program." 33256f6b22bSmrg exit 1 33356f6b22bSmrg ;; 33456f6b22bSmrgesac 33556f6b22bSmrg 33656f6b22bSmrgexit 0 337