missing revision ec713c28
11d54945dSmrg#! /bin/sh 21d54945dSmrg# Common stub for a few missing GNU programs while installing. 31d54945dSmrg 4ec713c28Smrgscriptversion=2009-04-28.21; # UTC 51d54945dSmrg 6ec713c28Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 7ec713c28Smrg# 2008, 2009 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 21ec713c28Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 221d54945dSmrg 231d54945dSmrg# As a special exception to the GNU General Public License, if you 241d54945dSmrg# distribute this file as part of a program that contains a 251d54945dSmrg# configuration script generated by Autoconf, you may include it under 261d54945dSmrg# the same distribution terms that you use for the rest of that program. 271d54945dSmrg 281d54945dSmrgif test $# -eq 0; then 291d54945dSmrg echo 1>&2 "Try \`$0 --help' for more information" 301d54945dSmrg exit 1 311d54945dSmrgfi 321d54945dSmrg 331d54945dSmrgrun=: 34ba85709eSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 35ba85709eSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 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 47ba85709eSmrgcase $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' 80ba85709eSmrg autom4te touch the output file, or create a stub one 811d54945dSmrg automake touch all \`Makefile.in' files 821d54945dSmrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 831d54945dSmrg flex create \`lex.yy.c', if possible, from existing .c 841d54945dSmrg help2man touch the output file 851d54945dSmrg lex create \`lex.yy.c', if possible, from existing .c 861d54945dSmrg makeinfo touch the output file 871d54945dSmrg tar try tar, gnutar, gtar, then tar without non-portable flags 881d54945dSmrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 891d54945dSmrg 90ec713c28SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 91ec713c28Smrg\`g' are ignored when checking the name. 92ec713c28Smrg 931d54945dSmrgSend bug reports to <bug-automake@gnu.org>." 941d54945dSmrg exit $? 951d54945dSmrg ;; 961d54945dSmrg 971d54945dSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 981d54945dSmrg echo "missing $scriptversion (GNU Automake)" 991d54945dSmrg exit $? 1001d54945dSmrg ;; 1011d54945dSmrg 1021d54945dSmrg -*) 1031d54945dSmrg echo 1>&2 "$0: Unknown \`$1' option" 1041d54945dSmrg echo 1>&2 "Try \`$0 --help' for more information" 1051d54945dSmrg exit 1 1061d54945dSmrg ;; 1071d54945dSmrg 1081d54945dSmrgesac 1091d54945dSmrg 110ec713c28Smrg# normalize program name to check for. 111ec713c28Smrgprogram=`echo "$1" | sed ' 112ec713c28Smrg s/^gnu-//; t 113ec713c28Smrg s/^gnu//; t 114ec713c28Smrg s/^g//; t'` 115ec713c28Smrg 1161d54945dSmrg# Now exit if we have it, but it failed. Also exit now if we 1171d54945dSmrg# don't have it and --version was passed (most likely to detect 118ec713c28Smrg# the program). This is about non-GNU programs, so use $1 not 119ec713c28Smrg# $program. 120ba85709eSmrgcase $1 in 121ec713c28Smrg lex*|yacc*) 1221d54945dSmrg # Not GNU programs, they don't have --version. 1231d54945dSmrg ;; 1241d54945dSmrg 125ec713c28Smrg tar*) 1261d54945dSmrg if test -n "$run"; then 1271d54945dSmrg echo 1>&2 "ERROR: \`tar' requires --run" 1281d54945dSmrg exit 1 1291d54945dSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1301d54945dSmrg exit 1 1311d54945dSmrg fi 1321d54945dSmrg ;; 1331d54945dSmrg 1341d54945dSmrg *) 1351d54945dSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 1361d54945dSmrg # We have it, but it failed. 1371d54945dSmrg exit 1 1381d54945dSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1391d54945dSmrg # Could not run --version or --help. This is probably someone 1401d54945dSmrg # running `$TOOL --version' or `$TOOL --help' to check whether 1411d54945dSmrg # $TOOL exists and not knowing $TOOL uses missing. 1421d54945dSmrg exit 1 1431d54945dSmrg fi 1441d54945dSmrg ;; 1451d54945dSmrgesac 1461d54945dSmrg 1471d54945dSmrg# If it does not exist, or fails to run (possibly an outdated version), 1481d54945dSmrg# try to emulate it. 149ec713c28Smrgcase $program in 1501d54945dSmrg aclocal*) 1511d54945dSmrg echo 1>&2 "\ 1521d54945dSmrgWARNING: \`$1' is $msg. You should only need it if 1531d54945dSmrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 1541d54945dSmrg to install the \`Automake' and \`Perl' packages. Grab them from 1551d54945dSmrg any GNU archive site." 1561d54945dSmrg touch aclocal.m4 1571d54945dSmrg ;; 1581d54945dSmrg 159ec713c28Smrg autoconf*) 1601d54945dSmrg echo 1>&2 "\ 1611d54945dSmrgWARNING: \`$1' is $msg. You should only need it if 1621d54945dSmrg you modified \`${configure_ac}'. You might want to install the 1631d54945dSmrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 1641d54945dSmrg archive site." 1651d54945dSmrg touch configure 1661d54945dSmrg ;; 1671d54945dSmrg 168ec713c28Smrg autoheader*) 1691d54945dSmrg echo 1>&2 "\ 1701d54945dSmrgWARNING: \`$1' is $msg. You should only need it if 1711d54945dSmrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 1721d54945dSmrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 1731d54945dSmrg from any GNU archive site." 1741d54945dSmrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 1751d54945dSmrg test -z "$files" && files="config.h" 1761d54945dSmrg touch_files= 1771d54945dSmrg for f in $files; do 178ba85709eSmrg case $f in 1791d54945dSmrg *:*) touch_files="$touch_files "`echo "$f" | 1801d54945dSmrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 1811d54945dSmrg *) touch_files="$touch_files $f.in";; 1821d54945dSmrg esac 1831d54945dSmrg done 1841d54945dSmrg touch $touch_files 1851d54945dSmrg ;; 1861d54945dSmrg 1871d54945dSmrg automake*) 1881d54945dSmrg echo 1>&2 "\ 1891d54945dSmrgWARNING: \`$1' is $msg. You should only need it if 1901d54945dSmrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 1911d54945dSmrg You might want to install the \`Automake' and \`Perl' packages. 1921d54945dSmrg Grab them from any GNU archive site." 1931d54945dSmrg find . -type f -name Makefile.am -print | 1941d54945dSmrg sed 's/\.am$/.in/' | 1951d54945dSmrg while read f; do touch "$f"; done 1961d54945dSmrg ;; 1971d54945dSmrg 198ec713c28Smrg autom4te*) 1991d54945dSmrg echo 1>&2 "\ 2001d54945dSmrgWARNING: \`$1' is needed, but is $msg. 2011d54945dSmrg You might have modified some files without having the 2021d54945dSmrg proper tools for further handling them. 2031d54945dSmrg You can get \`$1' as part of \`Autoconf' from any GNU 2041d54945dSmrg archive site." 2051d54945dSmrg 206ba85709eSmrg file=`echo "$*" | sed -n "$sed_output"` 207ba85709eSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2081d54945dSmrg if test -f "$file"; then 2091d54945dSmrg touch $file 2101d54945dSmrg else 2111d54945dSmrg test -z "$file" || exec >$file 2121d54945dSmrg echo "#! /bin/sh" 2131d54945dSmrg echo "# Created by GNU Automake missing as a replacement of" 2141d54945dSmrg echo "# $ $@" 2151d54945dSmrg echo "exit 0" 2161d54945dSmrg chmod +x $file 2171d54945dSmrg exit 1 2181d54945dSmrg fi 2191d54945dSmrg ;; 2201d54945dSmrg 221ec713c28Smrg bison*|yacc*) 2221d54945dSmrg echo 1>&2 "\ 2231d54945dSmrgWARNING: \`$1' $msg. You should only need it if 2241d54945dSmrg you modified a \`.y' file. You may need the \`Bison' package 2251d54945dSmrg in order for those modifications to take effect. You can get 2261d54945dSmrg \`Bison' from any GNU archive site." 2271d54945dSmrg rm -f y.tab.c y.tab.h 228ba85709eSmrg if test $# -ne 1; then 2291d54945dSmrg eval LASTARG="\${$#}" 230ba85709eSmrg case $LASTARG in 2311d54945dSmrg *.y) 2321d54945dSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 233ba85709eSmrg if test -f "$SRCFILE"; then 2341d54945dSmrg cp "$SRCFILE" y.tab.c 2351d54945dSmrg fi 2361d54945dSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 237ba85709eSmrg if test -f "$SRCFILE"; then 2381d54945dSmrg cp "$SRCFILE" y.tab.h 2391d54945dSmrg fi 2401d54945dSmrg ;; 2411d54945dSmrg esac 2421d54945dSmrg fi 243ba85709eSmrg if test ! -f y.tab.h; then 2441d54945dSmrg echo >y.tab.h 2451d54945dSmrg fi 246ba85709eSmrg if test ! -f y.tab.c; then 2471d54945dSmrg echo 'main() { return 0; }' >y.tab.c 2481d54945dSmrg fi 2491d54945dSmrg ;; 2501d54945dSmrg 251ec713c28Smrg lex*|flex*) 2521d54945dSmrg echo 1>&2 "\ 2531d54945dSmrgWARNING: \`$1' is $msg. You should only need it if 2541d54945dSmrg you modified a \`.l' file. You may need the \`Flex' package 2551d54945dSmrg in order for those modifications to take effect. You can get 2561d54945dSmrg \`Flex' from any GNU archive site." 2571d54945dSmrg rm -f lex.yy.c 258ba85709eSmrg if test $# -ne 1; then 2591d54945dSmrg eval LASTARG="\${$#}" 260ba85709eSmrg case $LASTARG in 2611d54945dSmrg *.l) 2621d54945dSmrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 263ba85709eSmrg if test -f "$SRCFILE"; then 2641d54945dSmrg cp "$SRCFILE" lex.yy.c 2651d54945dSmrg fi 2661d54945dSmrg ;; 2671d54945dSmrg esac 2681d54945dSmrg fi 269ba85709eSmrg if test ! -f lex.yy.c; then 2701d54945dSmrg echo 'main() { return 0; }' >lex.yy.c 2711d54945dSmrg fi 2721d54945dSmrg ;; 2731d54945dSmrg 274ec713c28Smrg help2man*) 2751d54945dSmrg echo 1>&2 "\ 2761d54945dSmrgWARNING: \`$1' is $msg. You should only need it if 2771d54945dSmrg you modified a dependency of a manual page. You may need the 2781d54945dSmrg \`Help2man' package in order for those modifications to take 2791d54945dSmrg effect. You can get \`Help2man' from any GNU archive site." 2801d54945dSmrg 281ba85709eSmrg file=`echo "$*" | sed -n "$sed_output"` 282ba85709eSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 283ba85709eSmrg if test -f "$file"; then 2841d54945dSmrg touch $file 2851d54945dSmrg else 2861d54945dSmrg test -z "$file" || exec >$file 2871d54945dSmrg echo ".ab help2man is required to generate this page" 288ec713c28Smrg exit $? 2891d54945dSmrg fi 2901d54945dSmrg ;; 2911d54945dSmrg 292ec713c28Smrg makeinfo*) 2931d54945dSmrg echo 1>&2 "\ 2941d54945dSmrgWARNING: \`$1' is $msg. You should only need it if 2951d54945dSmrg you modified a \`.texi' or \`.texinfo' file, or any other file 2961d54945dSmrg indirectly affecting the aspect of the manual. The spurious 2971d54945dSmrg call might also be the consequence of using a buggy \`make' (AIX, 2981d54945dSmrg DU, IRIX). You might want to install the \`Texinfo' package or 2991d54945dSmrg the \`GNU make' package. Grab either from any GNU archive site." 3001d54945dSmrg # The file to touch is that specified with -o ... 301ba85709eSmrg file=`echo "$*" | sed -n "$sed_output"` 302ba85709eSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 3031d54945dSmrg if test -z "$file"; then 3041d54945dSmrg # ... or it is the one specified with @setfilename ... 3051d54945dSmrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 306ba85709eSmrg file=`sed -n ' 307ba85709eSmrg /^@setfilename/{ 308ba85709eSmrg s/.* \([^ ]*\) *$/\1/ 309ba85709eSmrg p 310ba85709eSmrg q 311ba85709eSmrg }' $infile` 3121d54945dSmrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 3131d54945dSmrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 3141d54945dSmrg fi 3151d54945dSmrg # If the file does not exist, the user really needs makeinfo; 3161d54945dSmrg # let's fail without touching anything. 3171d54945dSmrg test -f $file || exit 1 3181d54945dSmrg touch $file 3191d54945dSmrg ;; 3201d54945dSmrg 321ec713c28Smrg tar*) 3221d54945dSmrg shift 3231d54945dSmrg 3241d54945dSmrg # We have already tried tar in the generic part. 3251d54945dSmrg # Look for gnutar/gtar before invocation to avoid ugly error 3261d54945dSmrg # messages. 3271d54945dSmrg if (gnutar --version > /dev/null 2>&1); then 3281d54945dSmrg gnutar "$@" && exit 0 3291d54945dSmrg fi 3301d54945dSmrg if (gtar --version > /dev/null 2>&1); then 3311d54945dSmrg gtar "$@" && exit 0 3321d54945dSmrg fi 3331d54945dSmrg firstarg="$1" 3341d54945dSmrg if shift; then 335ba85709eSmrg case $firstarg in 3361d54945dSmrg *o*) 3371d54945dSmrg firstarg=`echo "$firstarg" | sed s/o//` 3381d54945dSmrg tar "$firstarg" "$@" && exit 0 3391d54945dSmrg ;; 3401d54945dSmrg esac 341ba85709eSmrg case $firstarg in 3421d54945dSmrg *h*) 3431d54945dSmrg firstarg=`echo "$firstarg" | sed s/h//` 3441d54945dSmrg tar "$firstarg" "$@" && exit 0 3451d54945dSmrg ;; 3461d54945dSmrg esac 3471d54945dSmrg fi 3481d54945dSmrg 3491d54945dSmrg echo 1>&2 "\ 3501d54945dSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 3511d54945dSmrg You may want to install GNU tar or Free paxutils, or check the 3521d54945dSmrg command line arguments." 3531d54945dSmrg exit 1 3541d54945dSmrg ;; 3551d54945dSmrg 3561d54945dSmrg *) 3571d54945dSmrg echo 1>&2 "\ 3581d54945dSmrgWARNING: \`$1' is needed, and is $msg. 3591d54945dSmrg You might have modified some files without having the 3601d54945dSmrg proper tools for further handling them. Check the \`README' file, 3611d54945dSmrg it often tells you about the needed prerequisites for installing 3621d54945dSmrg this package. You may also peek at any GNU archive site, in case 3631d54945dSmrg some other package would contain this missing \`$1' program." 3641d54945dSmrg exit 1 3651d54945dSmrg ;; 3661d54945dSmrgesac 3671d54945dSmrg 3681d54945dSmrgexit 0 3691d54945dSmrg 3701d54945dSmrg# Local variables: 3711d54945dSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 3721d54945dSmrg# time-stamp-start: "scriptversion=" 3731d54945dSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 374ec713c28Smrg# time-stamp-time-zone: "UTC" 375ec713c28Smrg# time-stamp-end: "; # UTC" 3761d54945dSmrg# End: 377