missing revision 0fa2845d
10fa2845dSmrg#! /bin/sh 20fa2845dSmrg# Common stub for a few missing GNU programs while installing. 30fa2845dSmrg 40fa2845dSmrgscriptversion=2006-05-10.23 50fa2845dSmrg 60fa2845dSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 70fa2845dSmrg# Free Software Foundation, Inc. 80fa2845dSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 90fa2845dSmrg 100fa2845dSmrg# This program is free software; you can redistribute it and/or modify 110fa2845dSmrg# it under the terms of the GNU General Public License as published by 120fa2845dSmrg# the Free Software Foundation; either version 2, or (at your option) 130fa2845dSmrg# any later version. 140fa2845dSmrg 150fa2845dSmrg# This program is distributed in the hope that it will be useful, 160fa2845dSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 170fa2845dSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 180fa2845dSmrg# GNU General Public License for more details. 190fa2845dSmrg 200fa2845dSmrg# You should have received a copy of the GNU General Public License 210fa2845dSmrg# along with this program; if not, write to the Free Software 220fa2845dSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 230fa2845dSmrg# 02110-1301, USA. 240fa2845dSmrg 250fa2845dSmrg# As a special exception to the GNU General Public License, if you 260fa2845dSmrg# distribute this file as part of a program that contains a 270fa2845dSmrg# configuration script generated by Autoconf, you may include it under 280fa2845dSmrg# the same distribution terms that you use for the rest of that program. 290fa2845dSmrg 300fa2845dSmrgif test $# -eq 0; then 310fa2845dSmrg echo 1>&2 "Try \`$0 --help' for more information" 320fa2845dSmrg exit 1 330fa2845dSmrgfi 340fa2845dSmrg 350fa2845dSmrgrun=: 360fa2845dSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 370fa2845dSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 380fa2845dSmrg 390fa2845dSmrg# In the cases where this matters, `missing' is being run in the 400fa2845dSmrg# srcdir already. 410fa2845dSmrgif test -f configure.ac; then 420fa2845dSmrg configure_ac=configure.ac 430fa2845dSmrgelse 440fa2845dSmrg configure_ac=configure.in 450fa2845dSmrgfi 460fa2845dSmrg 470fa2845dSmrgmsg="missing on your system" 480fa2845dSmrg 490fa2845dSmrgcase $1 in 500fa2845dSmrg--run) 510fa2845dSmrg # Try to run requested program, and just exit if it succeeds. 520fa2845dSmrg run= 530fa2845dSmrg shift 540fa2845dSmrg "$@" && exit 0 550fa2845dSmrg # Exit code 63 means version mismatch. This often happens 560fa2845dSmrg # when the user try to use an ancient version of a tool on 570fa2845dSmrg # a file that requires a minimum version. In this case we 580fa2845dSmrg # we should proceed has if the program had been absent, or 590fa2845dSmrg # if --run hadn't been passed. 600fa2845dSmrg if test $? = 63; then 610fa2845dSmrg run=: 620fa2845dSmrg msg="probably too old" 630fa2845dSmrg fi 640fa2845dSmrg ;; 650fa2845dSmrg 660fa2845dSmrg -h|--h|--he|--hel|--help) 670fa2845dSmrg echo "\ 680fa2845dSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 690fa2845dSmrg 700fa2845dSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 710fa2845dSmrgerror status if there is no known handling for PROGRAM. 720fa2845dSmrg 730fa2845dSmrgOptions: 740fa2845dSmrg -h, --help display this help and exit 750fa2845dSmrg -v, --version output version information and exit 760fa2845dSmrg --run try to run the given command, and emulate it if it fails 770fa2845dSmrg 780fa2845dSmrgSupported PROGRAM values: 790fa2845dSmrg aclocal touch file \`aclocal.m4' 800fa2845dSmrg autoconf touch file \`configure' 810fa2845dSmrg autoheader touch file \`config.h.in' 820fa2845dSmrg autom4te touch the output file, or create a stub one 830fa2845dSmrg automake touch all \`Makefile.in' files 840fa2845dSmrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 850fa2845dSmrg flex create \`lex.yy.c', if possible, from existing .c 860fa2845dSmrg help2man touch the output file 870fa2845dSmrg lex create \`lex.yy.c', if possible, from existing .c 880fa2845dSmrg makeinfo touch the output file 890fa2845dSmrg tar try tar, gnutar, gtar, then tar without non-portable flags 900fa2845dSmrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 910fa2845dSmrg 920fa2845dSmrgSend bug reports to <bug-automake@gnu.org>." 930fa2845dSmrg exit $? 940fa2845dSmrg ;; 950fa2845dSmrg 960fa2845dSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 970fa2845dSmrg echo "missing $scriptversion (GNU Automake)" 980fa2845dSmrg exit $? 990fa2845dSmrg ;; 1000fa2845dSmrg 1010fa2845dSmrg -*) 1020fa2845dSmrg echo 1>&2 "$0: Unknown \`$1' option" 1030fa2845dSmrg echo 1>&2 "Try \`$0 --help' for more information" 1040fa2845dSmrg exit 1 1050fa2845dSmrg ;; 1060fa2845dSmrg 1070fa2845dSmrgesac 1080fa2845dSmrg 1090fa2845dSmrg# Now exit if we have it, but it failed. Also exit now if we 1100fa2845dSmrg# don't have it and --version was passed (most likely to detect 1110fa2845dSmrg# the program). 1120fa2845dSmrgcase $1 in 1130fa2845dSmrg lex|yacc) 1140fa2845dSmrg # Not GNU programs, they don't have --version. 1150fa2845dSmrg ;; 1160fa2845dSmrg 1170fa2845dSmrg tar) 1180fa2845dSmrg if test -n "$run"; then 1190fa2845dSmrg echo 1>&2 "ERROR: \`tar' requires --run" 1200fa2845dSmrg exit 1 1210fa2845dSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1220fa2845dSmrg exit 1 1230fa2845dSmrg fi 1240fa2845dSmrg ;; 1250fa2845dSmrg 1260fa2845dSmrg *) 1270fa2845dSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 1280fa2845dSmrg # We have it, but it failed. 1290fa2845dSmrg exit 1 1300fa2845dSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1310fa2845dSmrg # Could not run --version or --help. This is probably someone 1320fa2845dSmrg # running `$TOOL --version' or `$TOOL --help' to check whether 1330fa2845dSmrg # $TOOL exists and not knowing $TOOL uses missing. 1340fa2845dSmrg exit 1 1350fa2845dSmrg fi 1360fa2845dSmrg ;; 1370fa2845dSmrgesac 1380fa2845dSmrg 1390fa2845dSmrg# If it does not exist, or fails to run (possibly an outdated version), 1400fa2845dSmrg# try to emulate it. 1410fa2845dSmrgcase $1 in 1420fa2845dSmrg aclocal*) 1430fa2845dSmrg echo 1>&2 "\ 1440fa2845dSmrgWARNING: \`$1' is $msg. You should only need it if 1450fa2845dSmrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 1460fa2845dSmrg to install the \`Automake' and \`Perl' packages. Grab them from 1470fa2845dSmrg any GNU archive site." 1480fa2845dSmrg touch aclocal.m4 1490fa2845dSmrg ;; 1500fa2845dSmrg 1510fa2845dSmrg autoconf) 1520fa2845dSmrg echo 1>&2 "\ 1530fa2845dSmrgWARNING: \`$1' is $msg. You should only need it if 1540fa2845dSmrg you modified \`${configure_ac}'. You might want to install the 1550fa2845dSmrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 1560fa2845dSmrg archive site." 1570fa2845dSmrg touch configure 1580fa2845dSmrg ;; 1590fa2845dSmrg 1600fa2845dSmrg autoheader) 1610fa2845dSmrg echo 1>&2 "\ 1620fa2845dSmrgWARNING: \`$1' is $msg. You should only need it if 1630fa2845dSmrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 1640fa2845dSmrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 1650fa2845dSmrg from any GNU archive site." 1660fa2845dSmrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 1670fa2845dSmrg test -z "$files" && files="config.h" 1680fa2845dSmrg touch_files= 1690fa2845dSmrg for f in $files; do 1700fa2845dSmrg case $f in 1710fa2845dSmrg *:*) touch_files="$touch_files "`echo "$f" | 1720fa2845dSmrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 1730fa2845dSmrg *) touch_files="$touch_files $f.in";; 1740fa2845dSmrg esac 1750fa2845dSmrg done 1760fa2845dSmrg touch $touch_files 1770fa2845dSmrg ;; 1780fa2845dSmrg 1790fa2845dSmrg automake*) 1800fa2845dSmrg echo 1>&2 "\ 1810fa2845dSmrgWARNING: \`$1' is $msg. You should only need it if 1820fa2845dSmrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 1830fa2845dSmrg You might want to install the \`Automake' and \`Perl' packages. 1840fa2845dSmrg Grab them from any GNU archive site." 1850fa2845dSmrg find . -type f -name Makefile.am -print | 1860fa2845dSmrg sed 's/\.am$/.in/' | 1870fa2845dSmrg while read f; do touch "$f"; done 1880fa2845dSmrg ;; 1890fa2845dSmrg 1900fa2845dSmrg autom4te) 1910fa2845dSmrg echo 1>&2 "\ 1920fa2845dSmrgWARNING: \`$1' is needed, but is $msg. 1930fa2845dSmrg You might have modified some files without having the 1940fa2845dSmrg proper tools for further handling them. 1950fa2845dSmrg You can get \`$1' as part of \`Autoconf' from any GNU 1960fa2845dSmrg archive site." 1970fa2845dSmrg 1980fa2845dSmrg file=`echo "$*" | sed -n "$sed_output"` 1990fa2845dSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2000fa2845dSmrg if test -f "$file"; then 2010fa2845dSmrg touch $file 2020fa2845dSmrg else 2030fa2845dSmrg test -z "$file" || exec >$file 2040fa2845dSmrg echo "#! /bin/sh" 2050fa2845dSmrg echo "# Created by GNU Automake missing as a replacement of" 2060fa2845dSmrg echo "# $ $@" 2070fa2845dSmrg echo "exit 0" 2080fa2845dSmrg chmod +x $file 2090fa2845dSmrg exit 1 2100fa2845dSmrg fi 2110fa2845dSmrg ;; 2120fa2845dSmrg 2130fa2845dSmrg bison|yacc) 2140fa2845dSmrg echo 1>&2 "\ 2150fa2845dSmrgWARNING: \`$1' $msg. You should only need it if 2160fa2845dSmrg you modified a \`.y' file. You may need the \`Bison' package 2170fa2845dSmrg in order for those modifications to take effect. You can get 2180fa2845dSmrg \`Bison' from any GNU archive site." 2190fa2845dSmrg rm -f y.tab.c y.tab.h 2200fa2845dSmrg if test $# -ne 1; then 2210fa2845dSmrg eval LASTARG="\${$#}" 2220fa2845dSmrg case $LASTARG in 2230fa2845dSmrg *.y) 2240fa2845dSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 2250fa2845dSmrg if test -f "$SRCFILE"; then 2260fa2845dSmrg cp "$SRCFILE" y.tab.c 2270fa2845dSmrg fi 2280fa2845dSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 2290fa2845dSmrg if test -f "$SRCFILE"; then 2300fa2845dSmrg cp "$SRCFILE" y.tab.h 2310fa2845dSmrg fi 2320fa2845dSmrg ;; 2330fa2845dSmrg esac 2340fa2845dSmrg fi 2350fa2845dSmrg if test ! -f y.tab.h; then 2360fa2845dSmrg echo >y.tab.h 2370fa2845dSmrg fi 2380fa2845dSmrg if test ! -f y.tab.c; then 2390fa2845dSmrg echo 'main() { return 0; }' >y.tab.c 2400fa2845dSmrg fi 2410fa2845dSmrg ;; 2420fa2845dSmrg 2430fa2845dSmrg lex|flex) 2440fa2845dSmrg echo 1>&2 "\ 2450fa2845dSmrgWARNING: \`$1' is $msg. You should only need it if 2460fa2845dSmrg you modified a \`.l' file. You may need the \`Flex' package 2470fa2845dSmrg in order for those modifications to take effect. You can get 2480fa2845dSmrg \`Flex' from any GNU archive site." 2490fa2845dSmrg rm -f lex.yy.c 2500fa2845dSmrg if test $# -ne 1; then 2510fa2845dSmrg eval LASTARG="\${$#}" 2520fa2845dSmrg case $LASTARG in 2530fa2845dSmrg *.l) 2540fa2845dSmrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 2550fa2845dSmrg if test -f "$SRCFILE"; then 2560fa2845dSmrg cp "$SRCFILE" lex.yy.c 2570fa2845dSmrg fi 2580fa2845dSmrg ;; 2590fa2845dSmrg esac 2600fa2845dSmrg fi 2610fa2845dSmrg if test ! -f lex.yy.c; then 2620fa2845dSmrg echo 'main() { return 0; }' >lex.yy.c 2630fa2845dSmrg fi 2640fa2845dSmrg ;; 2650fa2845dSmrg 2660fa2845dSmrg help2man) 2670fa2845dSmrg echo 1>&2 "\ 2680fa2845dSmrgWARNING: \`$1' is $msg. You should only need it if 2690fa2845dSmrg you modified a dependency of a manual page. You may need the 2700fa2845dSmrg \`Help2man' package in order for those modifications to take 2710fa2845dSmrg effect. You can get \`Help2man' from any GNU archive site." 2720fa2845dSmrg 2730fa2845dSmrg file=`echo "$*" | sed -n "$sed_output"` 2740fa2845dSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2750fa2845dSmrg if test -f "$file"; then 2760fa2845dSmrg touch $file 2770fa2845dSmrg else 2780fa2845dSmrg test -z "$file" || exec >$file 2790fa2845dSmrg echo ".ab help2man is required to generate this page" 2800fa2845dSmrg exit 1 2810fa2845dSmrg fi 2820fa2845dSmrg ;; 2830fa2845dSmrg 2840fa2845dSmrg makeinfo) 2850fa2845dSmrg echo 1>&2 "\ 2860fa2845dSmrgWARNING: \`$1' is $msg. You should only need it if 2870fa2845dSmrg you modified a \`.texi' or \`.texinfo' file, or any other file 2880fa2845dSmrg indirectly affecting the aspect of the manual. The spurious 2890fa2845dSmrg call might also be the consequence of using a buggy \`make' (AIX, 2900fa2845dSmrg DU, IRIX). You might want to install the \`Texinfo' package or 2910fa2845dSmrg the \`GNU make' package. Grab either from any GNU archive site." 2920fa2845dSmrg # The file to touch is that specified with -o ... 2930fa2845dSmrg file=`echo "$*" | sed -n "$sed_output"` 2940fa2845dSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2950fa2845dSmrg if test -z "$file"; then 2960fa2845dSmrg # ... or it is the one specified with @setfilename ... 2970fa2845dSmrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 2980fa2845dSmrg file=`sed -n ' 2990fa2845dSmrg /^@setfilename/{ 3000fa2845dSmrg s/.* \([^ ]*\) *$/\1/ 3010fa2845dSmrg p 3020fa2845dSmrg q 3030fa2845dSmrg }' $infile` 3040fa2845dSmrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 3050fa2845dSmrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 3060fa2845dSmrg fi 3070fa2845dSmrg # If the file does not exist, the user really needs makeinfo; 3080fa2845dSmrg # let's fail without touching anything. 3090fa2845dSmrg test -f $file || exit 1 3100fa2845dSmrg touch $file 3110fa2845dSmrg ;; 3120fa2845dSmrg 3130fa2845dSmrg tar) 3140fa2845dSmrg shift 3150fa2845dSmrg 3160fa2845dSmrg # We have already tried tar in the generic part. 3170fa2845dSmrg # Look for gnutar/gtar before invocation to avoid ugly error 3180fa2845dSmrg # messages. 3190fa2845dSmrg if (gnutar --version > /dev/null 2>&1); then 3200fa2845dSmrg gnutar "$@" && exit 0 3210fa2845dSmrg fi 3220fa2845dSmrg if (gtar --version > /dev/null 2>&1); then 3230fa2845dSmrg gtar "$@" && exit 0 3240fa2845dSmrg fi 3250fa2845dSmrg firstarg="$1" 3260fa2845dSmrg if shift; then 3270fa2845dSmrg case $firstarg in 3280fa2845dSmrg *o*) 3290fa2845dSmrg firstarg=`echo "$firstarg" | sed s/o//` 3300fa2845dSmrg tar "$firstarg" "$@" && exit 0 3310fa2845dSmrg ;; 3320fa2845dSmrg esac 3330fa2845dSmrg case $firstarg in 3340fa2845dSmrg *h*) 3350fa2845dSmrg firstarg=`echo "$firstarg" | sed s/h//` 3360fa2845dSmrg tar "$firstarg" "$@" && exit 0 3370fa2845dSmrg ;; 3380fa2845dSmrg esac 3390fa2845dSmrg fi 3400fa2845dSmrg 3410fa2845dSmrg echo 1>&2 "\ 3420fa2845dSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 3430fa2845dSmrg You may want to install GNU tar or Free paxutils, or check the 3440fa2845dSmrg command line arguments." 3450fa2845dSmrg exit 1 3460fa2845dSmrg ;; 3470fa2845dSmrg 3480fa2845dSmrg *) 3490fa2845dSmrg echo 1>&2 "\ 3500fa2845dSmrgWARNING: \`$1' is needed, and is $msg. 3510fa2845dSmrg You might have modified some files without having the 3520fa2845dSmrg proper tools for further handling them. Check the \`README' file, 3530fa2845dSmrg it often tells you about the needed prerequisites for installing 3540fa2845dSmrg this package. You may also peek at any GNU archive site, in case 3550fa2845dSmrg some other package would contain this missing \`$1' program." 3560fa2845dSmrg exit 1 3570fa2845dSmrg ;; 3580fa2845dSmrgesac 3590fa2845dSmrg 3600fa2845dSmrgexit 0 3610fa2845dSmrg 3620fa2845dSmrg# Local variables: 3630fa2845dSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 3640fa2845dSmrg# time-stamp-start: "scriptversion=" 3650fa2845dSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 3660fa2845dSmrg# time-stamp-end: "$" 3670fa2845dSmrg# End: 368