missing revision 3e6697d4
10e20ee16Smrg#! /bin/sh 20e20ee16Smrg# Common stub for a few missing GNU programs while installing. 33e6697d4Smrg 43e6697d4Smrgscriptversion=2009-04-28.21; # UTC 53e6697d4Smrg 63e6697d4Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 73e6697d4Smrg# 2008, 2009 Free Software Foundation, Inc. 80e20ee16Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 90e20ee16Smrg 100e20ee16Smrg# This program is free software; you can redistribute it and/or modify 110e20ee16Smrg# it under the terms of the GNU General Public License as published by 120e20ee16Smrg# the Free Software Foundation; either version 2, or (at your option) 130e20ee16Smrg# any later version. 140e20ee16Smrg 150e20ee16Smrg# This program is distributed in the hope that it will be useful, 160e20ee16Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 170e20ee16Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 180e20ee16Smrg# GNU General Public License for more details. 190e20ee16Smrg 200e20ee16Smrg# You should have received a copy of the GNU General Public License 213e6697d4Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 220e20ee16Smrg 230e20ee16Smrg# As a special exception to the GNU General Public License, if you 240e20ee16Smrg# distribute this file as part of a program that contains a 250e20ee16Smrg# configuration script generated by Autoconf, you may include it under 260e20ee16Smrg# the same distribution terms that you use for the rest of that program. 270e20ee16Smrg 280e20ee16Smrgif test $# -eq 0; then 290e20ee16Smrg echo 1>&2 "Try \`$0 --help' for more information" 300e20ee16Smrg exit 1 310e20ee16Smrgfi 320e20ee16Smrg 330e20ee16Smrgrun=: 343e6697d4Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 353e6697d4Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 360e20ee16Smrg 370e20ee16Smrg# In the cases where this matters, `missing' is being run in the 380e20ee16Smrg# srcdir already. 390e20ee16Smrgif test -f configure.ac; then 400e20ee16Smrg configure_ac=configure.ac 410e20ee16Smrgelse 420e20ee16Smrg configure_ac=configure.in 430e20ee16Smrgfi 440e20ee16Smrg 453e6697d4Smrgmsg="missing on your system" 463e6697d4Smrg 473e6697d4Smrgcase $1 in 480e20ee16Smrg--run) 490e20ee16Smrg # Try to run requested program, and just exit if it succeeds. 500e20ee16Smrg run= 510e20ee16Smrg shift 520e20ee16Smrg "$@" && exit 0 533e6697d4Smrg # Exit code 63 means version mismatch. This often happens 543e6697d4Smrg # when the user try to use an ancient version of a tool on 553e6697d4Smrg # a file that requires a minimum version. In this case we 563e6697d4Smrg # we should proceed has if the program had been absent, or 573e6697d4Smrg # if --run hadn't been passed. 583e6697d4Smrg if test $? = 63; then 593e6697d4Smrg run=: 603e6697d4Smrg msg="probably too old" 613e6697d4Smrg fi 620e20ee16Smrg ;; 630e20ee16Smrg 640e20ee16Smrg -h|--h|--he|--hel|--help) 650e20ee16Smrg echo "\ 660e20ee16Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 670e20ee16Smrg 680e20ee16SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 690e20ee16Smrgerror status if there is no known handling for PROGRAM. 700e20ee16Smrg 710e20ee16SmrgOptions: 720e20ee16Smrg -h, --help display this help and exit 730e20ee16Smrg -v, --version output version information and exit 740e20ee16Smrg --run try to run the given command, and emulate it if it fails 750e20ee16Smrg 760e20ee16SmrgSupported PROGRAM values: 770e20ee16Smrg aclocal touch file \`aclocal.m4' 780e20ee16Smrg autoconf touch file \`configure' 790e20ee16Smrg autoheader touch file \`config.h.in' 803e6697d4Smrg autom4te touch the output file, or create a stub one 810e20ee16Smrg automake touch all \`Makefile.in' files 820e20ee16Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 830e20ee16Smrg flex create \`lex.yy.c', if possible, from existing .c 840e20ee16Smrg help2man touch the output file 850e20ee16Smrg lex create \`lex.yy.c', if possible, from existing .c 860e20ee16Smrg makeinfo touch the output file 870e20ee16Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 883e6697d4Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 893e6697d4Smrg 903e6697d4SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 913e6697d4Smrg\`g' are ignored when checking the name. 923e6697d4Smrg 933e6697d4SmrgSend bug reports to <bug-automake@gnu.org>." 943e6697d4Smrg exit $? 950e20ee16Smrg ;; 960e20ee16Smrg 970e20ee16Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 983e6697d4Smrg echo "missing $scriptversion (GNU Automake)" 993e6697d4Smrg exit $? 1000e20ee16Smrg ;; 1010e20ee16Smrg 1020e20ee16Smrg -*) 1030e20ee16Smrg echo 1>&2 "$0: Unknown \`$1' option" 1040e20ee16Smrg echo 1>&2 "Try \`$0 --help' for more information" 1050e20ee16Smrg exit 1 1060e20ee16Smrg ;; 1070e20ee16Smrg 1083e6697d4Smrgesac 1093e6697d4Smrg 1103e6697d4Smrg# normalize program name to check for. 1113e6697d4Smrgprogram=`echo "$1" | sed ' 1123e6697d4Smrg s/^gnu-//; t 1133e6697d4Smrg s/^gnu//; t 1143e6697d4Smrg s/^g//; t'` 1153e6697d4Smrg 1163e6697d4Smrg# Now exit if we have it, but it failed. Also exit now if we 1173e6697d4Smrg# don't have it and --version was passed (most likely to detect 1183e6697d4Smrg# the program). This is about non-GNU programs, so use $1 not 1193e6697d4Smrg# $program. 1203e6697d4Smrgcase $1 in 1213e6697d4Smrg lex*|yacc*) 1223e6697d4Smrg # Not GNU programs, they don't have --version. 1233e6697d4Smrg ;; 1243e6697d4Smrg 1253e6697d4Smrg tar*) 1263e6697d4Smrg if test -n "$run"; then 1273e6697d4Smrg echo 1>&2 "ERROR: \`tar' requires --run" 1283e6697d4Smrg exit 1 1293e6697d4Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1303e6697d4Smrg exit 1 1313e6697d4Smrg fi 1323e6697d4Smrg ;; 1333e6697d4Smrg 1343e6697d4Smrg *) 1350e20ee16Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 1360e20ee16Smrg # We have it, but it failed. 1370e20ee16Smrg exit 1 1383e6697d4Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1393e6697d4Smrg # Could not run --version or --help. This is probably someone 1403e6697d4Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 1413e6697d4Smrg # $TOOL exists and not knowing $TOOL uses missing. 1423e6697d4Smrg exit 1 1430e20ee16Smrg fi 1443e6697d4Smrg ;; 1453e6697d4Smrgesac 1460e20ee16Smrg 1473e6697d4Smrg# If it does not exist, or fails to run (possibly an outdated version), 1483e6697d4Smrg# try to emulate it. 1493e6697d4Smrgcase $program in 1503e6697d4Smrg aclocal*) 1510e20ee16Smrg echo 1>&2 "\ 1523e6697d4SmrgWARNING: \`$1' is $msg. You should only need it if 1530e20ee16Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 1540e20ee16Smrg to install the \`Automake' and \`Perl' packages. Grab them from 1550e20ee16Smrg any GNU archive site." 1560e20ee16Smrg touch aclocal.m4 1570e20ee16Smrg ;; 1580e20ee16Smrg 1593e6697d4Smrg autoconf*) 1600e20ee16Smrg echo 1>&2 "\ 1613e6697d4SmrgWARNING: \`$1' is $msg. You should only need it if 1620e20ee16Smrg you modified \`${configure_ac}'. You might want to install the 1630e20ee16Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 1640e20ee16Smrg archive site." 1650e20ee16Smrg touch configure 1660e20ee16Smrg ;; 1670e20ee16Smrg 1683e6697d4Smrg autoheader*) 1690e20ee16Smrg echo 1>&2 "\ 1703e6697d4SmrgWARNING: \`$1' is $msg. You should only need it if 1710e20ee16Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 1720e20ee16Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 1730e20ee16Smrg from any GNU archive site." 1740e20ee16Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 1750e20ee16Smrg test -z "$files" && files="config.h" 1760e20ee16Smrg touch_files= 1770e20ee16Smrg for f in $files; do 1783e6697d4Smrg case $f in 1790e20ee16Smrg *:*) touch_files="$touch_files "`echo "$f" | 1800e20ee16Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 1810e20ee16Smrg *) touch_files="$touch_files $f.in";; 1820e20ee16Smrg esac 1830e20ee16Smrg done 1840e20ee16Smrg touch $touch_files 1850e20ee16Smrg ;; 1860e20ee16Smrg 1870e20ee16Smrg automake*) 1880e20ee16Smrg echo 1>&2 "\ 1893e6697d4SmrgWARNING: \`$1' is $msg. You should only need it if 1900e20ee16Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 1910e20ee16Smrg You might want to install the \`Automake' and \`Perl' packages. 1920e20ee16Smrg Grab them from any GNU archive site." 1930e20ee16Smrg find . -type f -name Makefile.am -print | 1940e20ee16Smrg sed 's/\.am$/.in/' | 1950e20ee16Smrg while read f; do touch "$f"; done 1960e20ee16Smrg ;; 1970e20ee16Smrg 1983e6697d4Smrg autom4te*) 1990e20ee16Smrg echo 1>&2 "\ 2003e6697d4SmrgWARNING: \`$1' is needed, but is $msg. 2013e6697d4Smrg You might have modified some files without having the 2020e20ee16Smrg proper tools for further handling them. 2030e20ee16Smrg You can get \`$1' as part of \`Autoconf' from any GNU 2040e20ee16Smrg archive site." 2050e20ee16Smrg 2063e6697d4Smrg file=`echo "$*" | sed -n "$sed_output"` 2073e6697d4Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2080e20ee16Smrg if test -f "$file"; then 2090e20ee16Smrg touch $file 2100e20ee16Smrg else 2110e20ee16Smrg test -z "$file" || exec >$file 2120e20ee16Smrg echo "#! /bin/sh" 2130e20ee16Smrg echo "# Created by GNU Automake missing as a replacement of" 2140e20ee16Smrg echo "# $ $@" 2150e20ee16Smrg echo "exit 0" 2160e20ee16Smrg chmod +x $file 2170e20ee16Smrg exit 1 2180e20ee16Smrg fi 2190e20ee16Smrg ;; 2200e20ee16Smrg 2213e6697d4Smrg bison*|yacc*) 2220e20ee16Smrg echo 1>&2 "\ 2233e6697d4SmrgWARNING: \`$1' $msg. You should only need it if 2240e20ee16Smrg you modified a \`.y' file. You may need the \`Bison' package 2250e20ee16Smrg in order for those modifications to take effect. You can get 2260e20ee16Smrg \`Bison' from any GNU archive site." 2270e20ee16Smrg rm -f y.tab.c y.tab.h 2283e6697d4Smrg if test $# -ne 1; then 2290e20ee16Smrg eval LASTARG="\${$#}" 2303e6697d4Smrg case $LASTARG in 2310e20ee16Smrg *.y) 2320e20ee16Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 2333e6697d4Smrg if test -f "$SRCFILE"; then 2340e20ee16Smrg cp "$SRCFILE" y.tab.c 2350e20ee16Smrg fi 2360e20ee16Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 2373e6697d4Smrg if test -f "$SRCFILE"; then 2380e20ee16Smrg cp "$SRCFILE" y.tab.h 2390e20ee16Smrg fi 2400e20ee16Smrg ;; 2410e20ee16Smrg esac 2420e20ee16Smrg fi 2433e6697d4Smrg if test ! -f y.tab.h; then 2440e20ee16Smrg echo >y.tab.h 2450e20ee16Smrg fi 2463e6697d4Smrg if test ! -f y.tab.c; then 2470e20ee16Smrg echo 'main() { return 0; }' >y.tab.c 2480e20ee16Smrg fi 2490e20ee16Smrg ;; 2500e20ee16Smrg 2513e6697d4Smrg lex*|flex*) 2520e20ee16Smrg echo 1>&2 "\ 2533e6697d4SmrgWARNING: \`$1' is $msg. You should only need it if 2540e20ee16Smrg you modified a \`.l' file. You may need the \`Flex' package 2550e20ee16Smrg in order for those modifications to take effect. You can get 2560e20ee16Smrg \`Flex' from any GNU archive site." 2570e20ee16Smrg rm -f lex.yy.c 2583e6697d4Smrg if test $# -ne 1; then 2590e20ee16Smrg eval LASTARG="\${$#}" 2603e6697d4Smrg case $LASTARG in 2610e20ee16Smrg *.l) 2620e20ee16Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 2633e6697d4Smrg if test -f "$SRCFILE"; then 2640e20ee16Smrg cp "$SRCFILE" lex.yy.c 2650e20ee16Smrg fi 2660e20ee16Smrg ;; 2670e20ee16Smrg esac 2680e20ee16Smrg fi 2693e6697d4Smrg if test ! -f lex.yy.c; then 2700e20ee16Smrg echo 'main() { return 0; }' >lex.yy.c 2710e20ee16Smrg fi 2720e20ee16Smrg ;; 2730e20ee16Smrg 2743e6697d4Smrg help2man*) 2750e20ee16Smrg echo 1>&2 "\ 2763e6697d4SmrgWARNING: \`$1' is $msg. You should only need it if 2770e20ee16Smrg you modified a dependency of a manual page. You may need the 2780e20ee16Smrg \`Help2man' package in order for those modifications to take 2790e20ee16Smrg effect. You can get \`Help2man' from any GNU archive site." 2800e20ee16Smrg 2813e6697d4Smrg file=`echo "$*" | sed -n "$sed_output"` 2823e6697d4Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2833e6697d4Smrg if test -f "$file"; then 2840e20ee16Smrg touch $file 2850e20ee16Smrg else 2860e20ee16Smrg test -z "$file" || exec >$file 2870e20ee16Smrg echo ".ab help2man is required to generate this page" 2883e6697d4Smrg exit $? 2890e20ee16Smrg fi 2900e20ee16Smrg ;; 2910e20ee16Smrg 2923e6697d4Smrg makeinfo*) 2930e20ee16Smrg echo 1>&2 "\ 2943e6697d4SmrgWARNING: \`$1' is $msg. You should only need it if 2950e20ee16Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 2960e20ee16Smrg indirectly affecting the aspect of the manual. The spurious 2970e20ee16Smrg call might also be the consequence of using a buggy \`make' (AIX, 2980e20ee16Smrg DU, IRIX). You might want to install the \`Texinfo' package or 2990e20ee16Smrg the \`GNU make' package. Grab either from any GNU archive site." 3003e6697d4Smrg # The file to touch is that specified with -o ... 3013e6697d4Smrg file=`echo "$*" | sed -n "$sed_output"` 3023e6697d4Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 3030e20ee16Smrg if test -z "$file"; then 3043e6697d4Smrg # ... or it is the one specified with @setfilename ... 3053e6697d4Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 3063e6697d4Smrg file=`sed -n ' 3073e6697d4Smrg /^@setfilename/{ 3083e6697d4Smrg s/.* \([^ ]*\) *$/\1/ 3093e6697d4Smrg p 3103e6697d4Smrg q 3113e6697d4Smrg }' $infile` 3123e6697d4Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 3133e6697d4Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 3140e20ee16Smrg fi 3153e6697d4Smrg # If the file does not exist, the user really needs makeinfo; 3163e6697d4Smrg # let's fail without touching anything. 3173e6697d4Smrg test -f $file || exit 1 3180e20ee16Smrg touch $file 3190e20ee16Smrg ;; 3200e20ee16Smrg 3213e6697d4Smrg tar*) 3220e20ee16Smrg shift 3230e20ee16Smrg 3240e20ee16Smrg # We have already tried tar in the generic part. 3250e20ee16Smrg # Look for gnutar/gtar before invocation to avoid ugly error 3260e20ee16Smrg # messages. 3270e20ee16Smrg if (gnutar --version > /dev/null 2>&1); then 3280e20ee16Smrg gnutar "$@" && exit 0 3290e20ee16Smrg fi 3300e20ee16Smrg if (gtar --version > /dev/null 2>&1); then 3310e20ee16Smrg gtar "$@" && exit 0 3320e20ee16Smrg fi 3330e20ee16Smrg firstarg="$1" 3340e20ee16Smrg if shift; then 3353e6697d4Smrg case $firstarg in 3360e20ee16Smrg *o*) 3370e20ee16Smrg firstarg=`echo "$firstarg" | sed s/o//` 3380e20ee16Smrg tar "$firstarg" "$@" && exit 0 3390e20ee16Smrg ;; 3400e20ee16Smrg esac 3413e6697d4Smrg case $firstarg in 3420e20ee16Smrg *h*) 3430e20ee16Smrg firstarg=`echo "$firstarg" | sed s/h//` 3440e20ee16Smrg tar "$firstarg" "$@" && exit 0 3450e20ee16Smrg ;; 3460e20ee16Smrg esac 3470e20ee16Smrg fi 3480e20ee16Smrg 3490e20ee16Smrg echo 1>&2 "\ 3500e20ee16SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 3510e20ee16Smrg You may want to install GNU tar or Free paxutils, or check the 3520e20ee16Smrg command line arguments." 3530e20ee16Smrg exit 1 3540e20ee16Smrg ;; 3550e20ee16Smrg 3560e20ee16Smrg *) 3570e20ee16Smrg echo 1>&2 "\ 3583e6697d4SmrgWARNING: \`$1' is needed, and is $msg. 3593e6697d4Smrg You might have modified some files without having the 3600e20ee16Smrg proper tools for further handling them. Check the \`README' file, 3610e20ee16Smrg it often tells you about the needed prerequisites for installing 3620e20ee16Smrg this package. You may also peek at any GNU archive site, in case 3630e20ee16Smrg some other package would contain this missing \`$1' program." 3640e20ee16Smrg exit 1 3650e20ee16Smrg ;; 3660e20ee16Smrgesac 3670e20ee16Smrg 3680e20ee16Smrgexit 0 3693e6697d4Smrg 3703e6697d4Smrg# Local variables: 3713e6697d4Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 3723e6697d4Smrg# time-stamp-start: "scriptversion=" 3733e6697d4Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 3743e6697d4Smrg# time-stamp-time-zone: "UTC" 3753e6697d4Smrg# time-stamp-end: "; # UTC" 3763e6697d4Smrg# End: 377