missing revision 17ca54c3
117ca54c3Smrg#! /bin/sh 217ca54c3Smrg# Common stub for a few missing GNU programs while installing. 317ca54c3Smrg 417ca54c3Smrgscriptversion=2003-09-02.23 517ca54c3Smrg 617ca54c3Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 717ca54c3Smrg# Free Software Foundation, Inc. 817ca54c3Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 917ca54c3Smrg 1017ca54c3Smrg# This program is free software; you can redistribute it and/or modify 1117ca54c3Smrg# it under the terms of the GNU General Public License as published by 1217ca54c3Smrg# the Free Software Foundation; either version 2, or (at your option) 1317ca54c3Smrg# any later version. 1417ca54c3Smrg 1517ca54c3Smrg# This program is distributed in the hope that it will be useful, 1617ca54c3Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1717ca54c3Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1817ca54c3Smrg# GNU General Public License for more details. 1917ca54c3Smrg 2017ca54c3Smrg# You should have received a copy of the GNU General Public License 2117ca54c3Smrg# along with this program; if not, write to the Free Software 2217ca54c3Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 2317ca54c3Smrg# 02111-1307, USA. 2417ca54c3Smrg 2517ca54c3Smrg# As a special exception to the GNU General Public License, if you 2617ca54c3Smrg# distribute this file as part of a program that contains a 2717ca54c3Smrg# configuration script generated by Autoconf, you may include it under 2817ca54c3Smrg# the same distribution terms that you use for the rest of that program. 2917ca54c3Smrg 3017ca54c3Smrgif test $# -eq 0; then 3117ca54c3Smrg echo 1>&2 "Try \`$0 --help' for more information" 3217ca54c3Smrg exit 1 3317ca54c3Smrgfi 3417ca54c3Smrg 3517ca54c3Smrgrun=: 3617ca54c3Smrg 3717ca54c3Smrg# In the cases where this matters, `missing' is being run in the 3817ca54c3Smrg# srcdir already. 3917ca54c3Smrgif test -f configure.ac; then 4017ca54c3Smrg configure_ac=configure.ac 4117ca54c3Smrgelse 4217ca54c3Smrg configure_ac=configure.in 4317ca54c3Smrgfi 4417ca54c3Smrg 4517ca54c3Smrgmsg="missing on your system" 4617ca54c3Smrg 4717ca54c3Smrgcase "$1" in 4817ca54c3Smrg--run) 4917ca54c3Smrg # Try to run requested program, and just exit if it succeeds. 5017ca54c3Smrg run= 5117ca54c3Smrg shift 5217ca54c3Smrg "$@" && exit 0 5317ca54c3Smrg # Exit code 63 means version mismatch. This often happens 5417ca54c3Smrg # when the user try to use an ancient version of a tool on 5517ca54c3Smrg # a file that requires a minimum version. In this case we 5617ca54c3Smrg # we should proceed has if the program had been absent, or 5717ca54c3Smrg # if --run hadn't been passed. 5817ca54c3Smrg if test $? = 63; then 5917ca54c3Smrg run=: 6017ca54c3Smrg msg="probably too old" 6117ca54c3Smrg fi 6217ca54c3Smrg ;; 6317ca54c3Smrgesac 6417ca54c3Smrg 6517ca54c3Smrg# If it does not exist, or fails to run (possibly an outdated version), 6617ca54c3Smrg# try to emulate it. 6717ca54c3Smrgcase "$1" in 6817ca54c3Smrg 6917ca54c3Smrg -h|--h|--he|--hel|--help) 7017ca54c3Smrg echo "\ 7117ca54c3Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 7217ca54c3Smrg 7317ca54c3SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 7417ca54c3Smrgerror status if there is no known handling for PROGRAM. 7517ca54c3Smrg 7617ca54c3SmrgOptions: 7717ca54c3Smrg -h, --help display this help and exit 7817ca54c3Smrg -v, --version output version information and exit 7917ca54c3Smrg --run try to run the given command, and emulate it if it fails 8017ca54c3Smrg 8117ca54c3SmrgSupported PROGRAM values: 8217ca54c3Smrg aclocal touch file \`aclocal.m4' 8317ca54c3Smrg autoconf touch file \`configure' 8417ca54c3Smrg autoheader touch file \`config.h.in' 8517ca54c3Smrg automake touch all \`Makefile.in' files 8617ca54c3Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 8717ca54c3Smrg flex create \`lex.yy.c', if possible, from existing .c 8817ca54c3Smrg help2man touch the output file 8917ca54c3Smrg lex create \`lex.yy.c', if possible, from existing .c 9017ca54c3Smrg makeinfo touch the output file 9117ca54c3Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 9217ca54c3Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 9317ca54c3Smrg 9417ca54c3SmrgSend bug reports to <bug-automake@gnu.org>." 9517ca54c3Smrg ;; 9617ca54c3Smrg 9717ca54c3Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 9817ca54c3Smrg echo "missing $scriptversion (GNU Automake)" 9917ca54c3Smrg ;; 10017ca54c3Smrg 10117ca54c3Smrg -*) 10217ca54c3Smrg echo 1>&2 "$0: Unknown \`$1' option" 10317ca54c3Smrg echo 1>&2 "Try \`$0 --help' for more information" 10417ca54c3Smrg exit 1 10517ca54c3Smrg ;; 10617ca54c3Smrg 10717ca54c3Smrg aclocal*) 10817ca54c3Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 10917ca54c3Smrg # We have it, but it failed. 11017ca54c3Smrg exit 1 11117ca54c3Smrg fi 11217ca54c3Smrg 11317ca54c3Smrg echo 1>&2 "\ 11417ca54c3SmrgWARNING: \`$1' is $msg. You should only need it if 11517ca54c3Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 11617ca54c3Smrg to install the \`Automake' and \`Perl' packages. Grab them from 11717ca54c3Smrg any GNU archive site." 11817ca54c3Smrg touch aclocal.m4 11917ca54c3Smrg ;; 12017ca54c3Smrg 12117ca54c3Smrg autoconf) 12217ca54c3Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 12317ca54c3Smrg # We have it, but it failed. 12417ca54c3Smrg exit 1 12517ca54c3Smrg fi 12617ca54c3Smrg 12717ca54c3Smrg echo 1>&2 "\ 12817ca54c3SmrgWARNING: \`$1' is $msg. You should only need it if 12917ca54c3Smrg you modified \`${configure_ac}'. You might want to install the 13017ca54c3Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 13117ca54c3Smrg archive site." 13217ca54c3Smrg touch configure 13317ca54c3Smrg ;; 13417ca54c3Smrg 13517ca54c3Smrg autoheader) 13617ca54c3Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 13717ca54c3Smrg # We have it, but it failed. 13817ca54c3Smrg exit 1 13917ca54c3Smrg fi 14017ca54c3Smrg 14117ca54c3Smrg echo 1>&2 "\ 14217ca54c3SmrgWARNING: \`$1' is $msg. You should only need it if 14317ca54c3Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 14417ca54c3Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 14517ca54c3Smrg from any GNU archive site." 14617ca54c3Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 14717ca54c3Smrg test -z "$files" && files="config.h" 14817ca54c3Smrg touch_files= 14917ca54c3Smrg for f in $files; do 15017ca54c3Smrg case "$f" in 15117ca54c3Smrg *:*) touch_files="$touch_files "`echo "$f" | 15217ca54c3Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 15317ca54c3Smrg *) touch_files="$touch_files $f.in";; 15417ca54c3Smrg esac 15517ca54c3Smrg done 15617ca54c3Smrg touch $touch_files 15717ca54c3Smrg ;; 15817ca54c3Smrg 15917ca54c3Smrg automake*) 16017ca54c3Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 16117ca54c3Smrg # We have it, but it failed. 16217ca54c3Smrg exit 1 16317ca54c3Smrg fi 16417ca54c3Smrg 16517ca54c3Smrg echo 1>&2 "\ 16617ca54c3SmrgWARNING: \`$1' is $msg. You should only need it if 16717ca54c3Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 16817ca54c3Smrg You might want to install the \`Automake' and \`Perl' packages. 16917ca54c3Smrg Grab them from any GNU archive site." 17017ca54c3Smrg find . -type f -name Makefile.am -print | 17117ca54c3Smrg sed 's/\.am$/.in/' | 17217ca54c3Smrg while read f; do touch "$f"; done 17317ca54c3Smrg ;; 17417ca54c3Smrg 17517ca54c3Smrg autom4te) 17617ca54c3Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 17717ca54c3Smrg # We have it, but it failed. 17817ca54c3Smrg exit 1 17917ca54c3Smrg fi 18017ca54c3Smrg 18117ca54c3Smrg echo 1>&2 "\ 18217ca54c3SmrgWARNING: \`$1' is needed, but is $msg. 18317ca54c3Smrg You might have modified some files without having the 18417ca54c3Smrg proper tools for further handling them. 18517ca54c3Smrg You can get \`$1' as part of \`Autoconf' from any GNU 18617ca54c3Smrg archive site." 18717ca54c3Smrg 18817ca54c3Smrg file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 18917ca54c3Smrg test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 19017ca54c3Smrg if test -f "$file"; then 19117ca54c3Smrg touch $file 19217ca54c3Smrg else 19317ca54c3Smrg test -z "$file" || exec >$file 19417ca54c3Smrg echo "#! /bin/sh" 19517ca54c3Smrg echo "# Created by GNU Automake missing as a replacement of" 19617ca54c3Smrg echo "# $ $@" 19717ca54c3Smrg echo "exit 0" 19817ca54c3Smrg chmod +x $file 19917ca54c3Smrg exit 1 20017ca54c3Smrg fi 20117ca54c3Smrg ;; 20217ca54c3Smrg 20317ca54c3Smrg bison|yacc) 20417ca54c3Smrg echo 1>&2 "\ 20517ca54c3SmrgWARNING: \`$1' $msg. You should only need it if 20617ca54c3Smrg you modified a \`.y' file. You may need the \`Bison' package 20717ca54c3Smrg in order for those modifications to take effect. You can get 20817ca54c3Smrg \`Bison' from any GNU archive site." 20917ca54c3Smrg rm -f y.tab.c y.tab.h 21017ca54c3Smrg if [ $# -ne 1 ]; then 21117ca54c3Smrg eval LASTARG="\${$#}" 21217ca54c3Smrg case "$LASTARG" in 21317ca54c3Smrg *.y) 21417ca54c3Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 21517ca54c3Smrg if [ -f "$SRCFILE" ]; then 21617ca54c3Smrg cp "$SRCFILE" y.tab.c 21717ca54c3Smrg fi 21817ca54c3Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 21917ca54c3Smrg if [ -f "$SRCFILE" ]; then 22017ca54c3Smrg cp "$SRCFILE" y.tab.h 22117ca54c3Smrg fi 22217ca54c3Smrg ;; 22317ca54c3Smrg esac 22417ca54c3Smrg fi 22517ca54c3Smrg if [ ! -f y.tab.h ]; then 22617ca54c3Smrg echo >y.tab.h 22717ca54c3Smrg fi 22817ca54c3Smrg if [ ! -f y.tab.c ]; then 22917ca54c3Smrg echo 'main() { return 0; }' >y.tab.c 23017ca54c3Smrg fi 23117ca54c3Smrg ;; 23217ca54c3Smrg 23317ca54c3Smrg lex|flex) 23417ca54c3Smrg echo 1>&2 "\ 23517ca54c3SmrgWARNING: \`$1' is $msg. You should only need it if 23617ca54c3Smrg you modified a \`.l' file. You may need the \`Flex' package 23717ca54c3Smrg in order for those modifications to take effect. You can get 23817ca54c3Smrg \`Flex' from any GNU archive site." 23917ca54c3Smrg rm -f lex.yy.c 24017ca54c3Smrg if [ $# -ne 1 ]; then 24117ca54c3Smrg eval LASTARG="\${$#}" 24217ca54c3Smrg case "$LASTARG" in 24317ca54c3Smrg *.l) 24417ca54c3Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 24517ca54c3Smrg if [ -f "$SRCFILE" ]; then 24617ca54c3Smrg cp "$SRCFILE" lex.yy.c 24717ca54c3Smrg fi 24817ca54c3Smrg ;; 24917ca54c3Smrg esac 25017ca54c3Smrg fi 25117ca54c3Smrg if [ ! -f lex.yy.c ]; then 25217ca54c3Smrg echo 'main() { return 0; }' >lex.yy.c 25317ca54c3Smrg fi 25417ca54c3Smrg ;; 25517ca54c3Smrg 25617ca54c3Smrg help2man) 25717ca54c3Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 25817ca54c3Smrg # We have it, but it failed. 25917ca54c3Smrg exit 1 26017ca54c3Smrg fi 26117ca54c3Smrg 26217ca54c3Smrg echo 1>&2 "\ 26317ca54c3SmrgWARNING: \`$1' is $msg. You should only need it if 26417ca54c3Smrg you modified a dependency of a manual page. You may need the 26517ca54c3Smrg \`Help2man' package in order for those modifications to take 26617ca54c3Smrg effect. You can get \`Help2man' from any GNU archive site." 26717ca54c3Smrg 26817ca54c3Smrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 26917ca54c3Smrg if test -z "$file"; then 27017ca54c3Smrg file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 27117ca54c3Smrg fi 27217ca54c3Smrg if [ -f "$file" ]; then 27317ca54c3Smrg touch $file 27417ca54c3Smrg else 27517ca54c3Smrg test -z "$file" || exec >$file 27617ca54c3Smrg echo ".ab help2man is required to generate this page" 27717ca54c3Smrg exit 1 27817ca54c3Smrg fi 27917ca54c3Smrg ;; 28017ca54c3Smrg 28117ca54c3Smrg makeinfo) 28217ca54c3Smrg if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then 28317ca54c3Smrg # We have makeinfo, but it failed. 28417ca54c3Smrg exit 1 28517ca54c3Smrg fi 28617ca54c3Smrg 28717ca54c3Smrg echo 1>&2 "\ 28817ca54c3SmrgWARNING: \`$1' is $msg. You should only need it if 28917ca54c3Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 29017ca54c3Smrg indirectly affecting the aspect of the manual. The spurious 29117ca54c3Smrg call might also be the consequence of using a buggy \`make' (AIX, 29217ca54c3Smrg DU, IRIX). You might want to install the \`Texinfo' package or 29317ca54c3Smrg the \`GNU make' package. Grab either from any GNU archive site." 29417ca54c3Smrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 29517ca54c3Smrg if test -z "$file"; then 29617ca54c3Smrg file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 29717ca54c3Smrg file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` 29817ca54c3Smrg fi 29917ca54c3Smrg touch $file 30017ca54c3Smrg ;; 30117ca54c3Smrg 30217ca54c3Smrg tar) 30317ca54c3Smrg shift 30417ca54c3Smrg if test -n "$run"; then 30517ca54c3Smrg echo 1>&2 "ERROR: \`tar' requires --run" 30617ca54c3Smrg exit 1 30717ca54c3Smrg fi 30817ca54c3Smrg 30917ca54c3Smrg # We have already tried tar in the generic part. 31017ca54c3Smrg # Look for gnutar/gtar before invocation to avoid ugly error 31117ca54c3Smrg # messages. 31217ca54c3Smrg if (gnutar --version > /dev/null 2>&1); then 31317ca54c3Smrg gnutar "$@" && exit 0 31417ca54c3Smrg fi 31517ca54c3Smrg if (gtar --version > /dev/null 2>&1); then 31617ca54c3Smrg gtar "$@" && exit 0 31717ca54c3Smrg fi 31817ca54c3Smrg firstarg="$1" 31917ca54c3Smrg if shift; then 32017ca54c3Smrg case "$firstarg" in 32117ca54c3Smrg *o*) 32217ca54c3Smrg firstarg=`echo "$firstarg" | sed s/o//` 32317ca54c3Smrg tar "$firstarg" "$@" && exit 0 32417ca54c3Smrg ;; 32517ca54c3Smrg esac 32617ca54c3Smrg case "$firstarg" in 32717ca54c3Smrg *h*) 32817ca54c3Smrg firstarg=`echo "$firstarg" | sed s/h//` 32917ca54c3Smrg tar "$firstarg" "$@" && exit 0 33017ca54c3Smrg ;; 33117ca54c3Smrg esac 33217ca54c3Smrg fi 33317ca54c3Smrg 33417ca54c3Smrg echo 1>&2 "\ 33517ca54c3SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 33617ca54c3Smrg You may want to install GNU tar or Free paxutils, or check the 33717ca54c3Smrg command line arguments." 33817ca54c3Smrg exit 1 33917ca54c3Smrg ;; 34017ca54c3Smrg 34117ca54c3Smrg *) 34217ca54c3Smrg echo 1>&2 "\ 34317ca54c3SmrgWARNING: \`$1' is needed, and is $msg. 34417ca54c3Smrg You might have modified some files without having the 34517ca54c3Smrg proper tools for further handling them. Check the \`README' file, 34617ca54c3Smrg it often tells you about the needed prerequisites for installing 34717ca54c3Smrg this package. You may also peek at any GNU archive site, in case 34817ca54c3Smrg some other package would contain this missing \`$1' program." 34917ca54c3Smrg exit 1 35017ca54c3Smrg ;; 35117ca54c3Smrgesac 35217ca54c3Smrg 35317ca54c3Smrgexit 0 35417ca54c3Smrg 35517ca54c3Smrg# Local variables: 35617ca54c3Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 35717ca54c3Smrg# time-stamp-start: "scriptversion=" 35817ca54c3Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 35917ca54c3Smrg# time-stamp-end: "$" 36017ca54c3Smrg# End: 361