missing revision 1d54945d
11d54945dSmrg#! /bin/sh 21d54945dSmrg# Common stub for a few missing GNU programs while installing. 31d54945dSmrg 41d54945dSmrgscriptversion=2005-06-08.21 51d54945dSmrg 61d54945dSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 71d54945dSmrg# Free Software Foundation, Inc. 81d54945dSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 91d54945dSmrg 101d54945dSmrg# This program is free software; you can redistribute it and/or modify 111d54945dSmrg# it under the terms of the GNU General Public License as published by 121d54945dSmrg# the Free Software Foundation; either version 2, or (at your option) 131d54945dSmrg# any later version. 141d54945dSmrg 151d54945dSmrg# This program is distributed in the hope that it will be useful, 161d54945dSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 171d54945dSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 181d54945dSmrg# GNU General Public License for more details. 191d54945dSmrg 201d54945dSmrg# You should have received a copy of the GNU General Public License 211d54945dSmrg# along with this program; if not, write to the Free Software 221d54945dSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 231d54945dSmrg# 02110-1301, USA. 241d54945dSmrg 251d54945dSmrg# As a special exception to the GNU General Public License, if you 261d54945dSmrg# distribute this file as part of a program that contains a 271d54945dSmrg# configuration script generated by Autoconf, you may include it under 281d54945dSmrg# the same distribution terms that you use for the rest of that program. 291d54945dSmrg 301d54945dSmrgif test $# -eq 0; then 311d54945dSmrg echo 1>&2 "Try \`$0 --help' for more information" 321d54945dSmrg exit 1 331d54945dSmrgfi 341d54945dSmrg 351d54945dSmrgrun=: 361d54945dSmrg 371d54945dSmrg# In the cases where this matters, `missing' is being run in the 381d54945dSmrg# srcdir already. 391d54945dSmrgif test -f configure.ac; then 401d54945dSmrg configure_ac=configure.ac 411d54945dSmrgelse 421d54945dSmrg configure_ac=configure.in 431d54945dSmrgfi 441d54945dSmrg 451d54945dSmrgmsg="missing on your system" 461d54945dSmrg 471d54945dSmrgcase "$1" in 481d54945dSmrg--run) 491d54945dSmrg # Try to run requested program, and just exit if it succeeds. 501d54945dSmrg run= 511d54945dSmrg shift 521d54945dSmrg "$@" && exit 0 531d54945dSmrg # Exit code 63 means version mismatch. This often happens 541d54945dSmrg # when the user try to use an ancient version of a tool on 551d54945dSmrg # a file that requires a minimum version. In this case we 561d54945dSmrg # we should proceed has if the program had been absent, or 571d54945dSmrg # if --run hadn't been passed. 581d54945dSmrg if test $? = 63; then 591d54945dSmrg run=: 601d54945dSmrg msg="probably too old" 611d54945dSmrg fi 621d54945dSmrg ;; 631d54945dSmrg 641d54945dSmrg -h|--h|--he|--hel|--help) 651d54945dSmrg echo "\ 661d54945dSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 671d54945dSmrg 681d54945dSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 691d54945dSmrgerror status if there is no known handling for PROGRAM. 701d54945dSmrg 711d54945dSmrgOptions: 721d54945dSmrg -h, --help display this help and exit 731d54945dSmrg -v, --version output version information and exit 741d54945dSmrg --run try to run the given command, and emulate it if it fails 751d54945dSmrg 761d54945dSmrgSupported PROGRAM values: 771d54945dSmrg aclocal touch file \`aclocal.m4' 781d54945dSmrg autoconf touch file \`configure' 791d54945dSmrg autoheader touch file \`config.h.in' 801d54945dSmrg automake touch all \`Makefile.in' files 811d54945dSmrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 821d54945dSmrg flex create \`lex.yy.c', if possible, from existing .c 831d54945dSmrg help2man touch the output file 841d54945dSmrg lex create \`lex.yy.c', if possible, from existing .c 851d54945dSmrg makeinfo touch the output file 861d54945dSmrg tar try tar, gnutar, gtar, then tar without non-portable flags 871d54945dSmrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 881d54945dSmrg 891d54945dSmrgSend bug reports to <bug-automake@gnu.org>." 901d54945dSmrg exit $? 911d54945dSmrg ;; 921d54945dSmrg 931d54945dSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 941d54945dSmrg echo "missing $scriptversion (GNU Automake)" 951d54945dSmrg exit $? 961d54945dSmrg ;; 971d54945dSmrg 981d54945dSmrg -*) 991d54945dSmrg echo 1>&2 "$0: Unknown \`$1' option" 1001d54945dSmrg echo 1>&2 "Try \`$0 --help' for more information" 1011d54945dSmrg exit 1 1021d54945dSmrg ;; 1031d54945dSmrg 1041d54945dSmrgesac 1051d54945dSmrg 1061d54945dSmrg# Now exit if we have it, but it failed. Also exit now if we 1071d54945dSmrg# don't have it and --version was passed (most likely to detect 1081d54945dSmrg# the program). 1091d54945dSmrgcase "$1" in 1101d54945dSmrg lex|yacc) 1111d54945dSmrg # Not GNU programs, they don't have --version. 1121d54945dSmrg ;; 1131d54945dSmrg 1141d54945dSmrg tar) 1151d54945dSmrg if test -n "$run"; then 1161d54945dSmrg echo 1>&2 "ERROR: \`tar' requires --run" 1171d54945dSmrg exit 1 1181d54945dSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1191d54945dSmrg exit 1 1201d54945dSmrg fi 1211d54945dSmrg ;; 1221d54945dSmrg 1231d54945dSmrg *) 1241d54945dSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 1251d54945dSmrg # We have it, but it failed. 1261d54945dSmrg exit 1 1271d54945dSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1281d54945dSmrg # Could not run --version or --help. This is probably someone 1291d54945dSmrg # running `$TOOL --version' or `$TOOL --help' to check whether 1301d54945dSmrg # $TOOL exists and not knowing $TOOL uses missing. 1311d54945dSmrg exit 1 1321d54945dSmrg fi 1331d54945dSmrg ;; 1341d54945dSmrgesac 1351d54945dSmrg 1361d54945dSmrg# If it does not exist, or fails to run (possibly an outdated version), 1371d54945dSmrg# try to emulate it. 1381d54945dSmrgcase "$1" in 1391d54945dSmrg aclocal*) 1401d54945dSmrg echo 1>&2 "\ 1411d54945dSmrgWARNING: \`$1' is $msg. You should only need it if 1421d54945dSmrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 1431d54945dSmrg to install the \`Automake' and \`Perl' packages. Grab them from 1441d54945dSmrg any GNU archive site." 1451d54945dSmrg touch aclocal.m4 1461d54945dSmrg ;; 1471d54945dSmrg 1481d54945dSmrg autoconf) 1491d54945dSmrg echo 1>&2 "\ 1501d54945dSmrgWARNING: \`$1' is $msg. You should only need it if 1511d54945dSmrg you modified \`${configure_ac}'. You might want to install the 1521d54945dSmrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 1531d54945dSmrg archive site." 1541d54945dSmrg touch configure 1551d54945dSmrg ;; 1561d54945dSmrg 1571d54945dSmrg autoheader) 1581d54945dSmrg echo 1>&2 "\ 1591d54945dSmrgWARNING: \`$1' is $msg. You should only need it if 1601d54945dSmrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 1611d54945dSmrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 1621d54945dSmrg from any GNU archive site." 1631d54945dSmrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 1641d54945dSmrg test -z "$files" && files="config.h" 1651d54945dSmrg touch_files= 1661d54945dSmrg for f in $files; do 1671d54945dSmrg case "$f" in 1681d54945dSmrg *:*) touch_files="$touch_files "`echo "$f" | 1691d54945dSmrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 1701d54945dSmrg *) touch_files="$touch_files $f.in";; 1711d54945dSmrg esac 1721d54945dSmrg done 1731d54945dSmrg touch $touch_files 1741d54945dSmrg ;; 1751d54945dSmrg 1761d54945dSmrg automake*) 1771d54945dSmrg echo 1>&2 "\ 1781d54945dSmrgWARNING: \`$1' is $msg. You should only need it if 1791d54945dSmrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 1801d54945dSmrg You might want to install the \`Automake' and \`Perl' packages. 1811d54945dSmrg Grab them from any GNU archive site." 1821d54945dSmrg find . -type f -name Makefile.am -print | 1831d54945dSmrg sed 's/\.am$/.in/' | 1841d54945dSmrg while read f; do touch "$f"; done 1851d54945dSmrg ;; 1861d54945dSmrg 1871d54945dSmrg autom4te) 1881d54945dSmrg echo 1>&2 "\ 1891d54945dSmrgWARNING: \`$1' is needed, but is $msg. 1901d54945dSmrg You might have modified some files without having the 1911d54945dSmrg proper tools for further handling them. 1921d54945dSmrg You can get \`$1' as part of \`Autoconf' from any GNU 1931d54945dSmrg archive site." 1941d54945dSmrg 1951d54945dSmrg file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 1961d54945dSmrg test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 1971d54945dSmrg if test -f "$file"; then 1981d54945dSmrg touch $file 1991d54945dSmrg else 2001d54945dSmrg test -z "$file" || exec >$file 2011d54945dSmrg echo "#! /bin/sh" 2021d54945dSmrg echo "# Created by GNU Automake missing as a replacement of" 2031d54945dSmrg echo "# $ $@" 2041d54945dSmrg echo "exit 0" 2051d54945dSmrg chmod +x $file 2061d54945dSmrg exit 1 2071d54945dSmrg fi 2081d54945dSmrg ;; 2091d54945dSmrg 2101d54945dSmrg bison|yacc) 2111d54945dSmrg echo 1>&2 "\ 2121d54945dSmrgWARNING: \`$1' $msg. You should only need it if 2131d54945dSmrg you modified a \`.y' file. You may need the \`Bison' package 2141d54945dSmrg in order for those modifications to take effect. You can get 2151d54945dSmrg \`Bison' from any GNU archive site." 2161d54945dSmrg rm -f y.tab.c y.tab.h 2171d54945dSmrg if [ $# -ne 1 ]; then 2181d54945dSmrg eval LASTARG="\${$#}" 2191d54945dSmrg case "$LASTARG" in 2201d54945dSmrg *.y) 2211d54945dSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 2221d54945dSmrg if [ -f "$SRCFILE" ]; then 2231d54945dSmrg cp "$SRCFILE" y.tab.c 2241d54945dSmrg fi 2251d54945dSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 2261d54945dSmrg if [ -f "$SRCFILE" ]; then 2271d54945dSmrg cp "$SRCFILE" y.tab.h 2281d54945dSmrg fi 2291d54945dSmrg ;; 2301d54945dSmrg esac 2311d54945dSmrg fi 2321d54945dSmrg if [ ! -f y.tab.h ]; then 2331d54945dSmrg echo >y.tab.h 2341d54945dSmrg fi 2351d54945dSmrg if [ ! -f y.tab.c ]; then 2361d54945dSmrg echo 'main() { return 0; }' >y.tab.c 2371d54945dSmrg fi 2381d54945dSmrg ;; 2391d54945dSmrg 2401d54945dSmrg lex|flex) 2411d54945dSmrg echo 1>&2 "\ 2421d54945dSmrgWARNING: \`$1' is $msg. You should only need it if 2431d54945dSmrg you modified a \`.l' file. You may need the \`Flex' package 2441d54945dSmrg in order for those modifications to take effect. You can get 2451d54945dSmrg \`Flex' from any GNU archive site." 2461d54945dSmrg rm -f lex.yy.c 2471d54945dSmrg if [ $# -ne 1 ]; then 2481d54945dSmrg eval LASTARG="\${$#}" 2491d54945dSmrg case "$LASTARG" in 2501d54945dSmrg *.l) 2511d54945dSmrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 2521d54945dSmrg if [ -f "$SRCFILE" ]; then 2531d54945dSmrg cp "$SRCFILE" lex.yy.c 2541d54945dSmrg fi 2551d54945dSmrg ;; 2561d54945dSmrg esac 2571d54945dSmrg fi 2581d54945dSmrg if [ ! -f lex.yy.c ]; then 2591d54945dSmrg echo 'main() { return 0; }' >lex.yy.c 2601d54945dSmrg fi 2611d54945dSmrg ;; 2621d54945dSmrg 2631d54945dSmrg help2man) 2641d54945dSmrg echo 1>&2 "\ 2651d54945dSmrgWARNING: \`$1' is $msg. You should only need it if 2661d54945dSmrg you modified a dependency of a manual page. You may need the 2671d54945dSmrg \`Help2man' package in order for those modifications to take 2681d54945dSmrg effect. You can get \`Help2man' from any GNU archive site." 2691d54945dSmrg 2701d54945dSmrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 2711d54945dSmrg if test -z "$file"; then 2721d54945dSmrg file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 2731d54945dSmrg fi 2741d54945dSmrg if [ -f "$file" ]; then 2751d54945dSmrg touch $file 2761d54945dSmrg else 2771d54945dSmrg test -z "$file" || exec >$file 2781d54945dSmrg echo ".ab help2man is required to generate this page" 2791d54945dSmrg exit 1 2801d54945dSmrg fi 2811d54945dSmrg ;; 2821d54945dSmrg 2831d54945dSmrg makeinfo) 2841d54945dSmrg echo 1>&2 "\ 2851d54945dSmrgWARNING: \`$1' is $msg. You should only need it if 2861d54945dSmrg you modified a \`.texi' or \`.texinfo' file, or any other file 2871d54945dSmrg indirectly affecting the aspect of the manual. The spurious 2881d54945dSmrg call might also be the consequence of using a buggy \`make' (AIX, 2891d54945dSmrg DU, IRIX). You might want to install the \`Texinfo' package or 2901d54945dSmrg the \`GNU make' package. Grab either from any GNU archive site." 2911d54945dSmrg # The file to touch is that specified with -o ... 2921d54945dSmrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 2931d54945dSmrg if test -z "$file"; then 2941d54945dSmrg # ... or it is the one specified with @setfilename ... 2951d54945dSmrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 2961d54945dSmrg file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` 2971d54945dSmrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 2981d54945dSmrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 2991d54945dSmrg fi 3001d54945dSmrg # If the file does not exist, the user really needs makeinfo; 3011d54945dSmrg # let's fail without touching anything. 3021d54945dSmrg test -f $file || exit 1 3031d54945dSmrg touch $file 3041d54945dSmrg ;; 3051d54945dSmrg 3061d54945dSmrg tar) 3071d54945dSmrg shift 3081d54945dSmrg 3091d54945dSmrg # We have already tried tar in the generic part. 3101d54945dSmrg # Look for gnutar/gtar before invocation to avoid ugly error 3111d54945dSmrg # messages. 3121d54945dSmrg if (gnutar --version > /dev/null 2>&1); then 3131d54945dSmrg gnutar "$@" && exit 0 3141d54945dSmrg fi 3151d54945dSmrg if (gtar --version > /dev/null 2>&1); then 3161d54945dSmrg gtar "$@" && exit 0 3171d54945dSmrg fi 3181d54945dSmrg firstarg="$1" 3191d54945dSmrg if shift; then 3201d54945dSmrg case "$firstarg" in 3211d54945dSmrg *o*) 3221d54945dSmrg firstarg=`echo "$firstarg" | sed s/o//` 3231d54945dSmrg tar "$firstarg" "$@" && exit 0 3241d54945dSmrg ;; 3251d54945dSmrg esac 3261d54945dSmrg case "$firstarg" in 3271d54945dSmrg *h*) 3281d54945dSmrg firstarg=`echo "$firstarg" | sed s/h//` 3291d54945dSmrg tar "$firstarg" "$@" && exit 0 3301d54945dSmrg ;; 3311d54945dSmrg esac 3321d54945dSmrg fi 3331d54945dSmrg 3341d54945dSmrg echo 1>&2 "\ 3351d54945dSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 3361d54945dSmrg You may want to install GNU tar or Free paxutils, or check the 3371d54945dSmrg command line arguments." 3381d54945dSmrg exit 1 3391d54945dSmrg ;; 3401d54945dSmrg 3411d54945dSmrg *) 3421d54945dSmrg echo 1>&2 "\ 3431d54945dSmrgWARNING: \`$1' is needed, and is $msg. 3441d54945dSmrg You might have modified some files without having the 3451d54945dSmrg proper tools for further handling them. Check the \`README' file, 3461d54945dSmrg it often tells you about the needed prerequisites for installing 3471d54945dSmrg this package. You may also peek at any GNU archive site, in case 3481d54945dSmrg some other package would contain this missing \`$1' program." 3491d54945dSmrg exit 1 3501d54945dSmrg ;; 3511d54945dSmrgesac 3521d54945dSmrg 3531d54945dSmrgexit 0 3541d54945dSmrg 3551d54945dSmrg# Local variables: 3561d54945dSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 3571d54945dSmrg# time-stamp-start: "scriptversion=" 3581d54945dSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 3591d54945dSmrg# time-stamp-end: "$" 3601d54945dSmrg# End: 361