missing revision b62cc08c
19fe995a9Smrg#! /bin/sh 29fe995a9Smrg# Common stub for a few missing GNU programs while installing. 39fe995a9Smrg 4b62cc08cSmrgscriptversion=2009-04-28.21; # UTC 59fe995a9Smrg 6b62cc08cSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 7b62cc08cSmrg# 2008, 2009 Free Software Foundation, Inc. 89fe995a9Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 99fe995a9Smrg 109fe995a9Smrg# This program is free software; you can redistribute it and/or modify 119fe995a9Smrg# it under the terms of the GNU General Public License as published by 129fe995a9Smrg# the Free Software Foundation; either version 2, or (at your option) 139fe995a9Smrg# any later version. 149fe995a9Smrg 159fe995a9Smrg# This program is distributed in the hope that it will be useful, 169fe995a9Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 179fe995a9Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 189fe995a9Smrg# GNU General Public License for more details. 199fe995a9Smrg 209fe995a9Smrg# You should have received a copy of the GNU General Public License 21b62cc08cSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 229fe995a9Smrg 239fe995a9Smrg# As a special exception to the GNU General Public License, if you 249fe995a9Smrg# distribute this file as part of a program that contains a 259fe995a9Smrg# configuration script generated by Autoconf, you may include it under 269fe995a9Smrg# the same distribution terms that you use for the rest of that program. 279fe995a9Smrg 289fe995a9Smrgif test $# -eq 0; then 299fe995a9Smrg echo 1>&2 "Try \`$0 --help' for more information" 309fe995a9Smrg exit 1 319fe995a9Smrgfi 329fe995a9Smrg 339fe995a9Smrgrun=: 349fe995a9Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 359fe995a9Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 369fe995a9Smrg 379fe995a9Smrg# In the cases where this matters, `missing' is being run in the 389fe995a9Smrg# srcdir already. 399fe995a9Smrgif test -f configure.ac; then 409fe995a9Smrg configure_ac=configure.ac 419fe995a9Smrgelse 429fe995a9Smrg configure_ac=configure.in 439fe995a9Smrgfi 449fe995a9Smrg 459fe995a9Smrgmsg="missing on your system" 469fe995a9Smrg 479fe995a9Smrgcase $1 in 489fe995a9Smrg--run) 499fe995a9Smrg # Try to run requested program, and just exit if it succeeds. 509fe995a9Smrg run= 519fe995a9Smrg shift 529fe995a9Smrg "$@" && exit 0 539fe995a9Smrg # Exit code 63 means version mismatch. This often happens 549fe995a9Smrg # when the user try to use an ancient version of a tool on 559fe995a9Smrg # a file that requires a minimum version. In this case we 569fe995a9Smrg # we should proceed has if the program had been absent, or 579fe995a9Smrg # if --run hadn't been passed. 589fe995a9Smrg if test $? = 63; then 599fe995a9Smrg run=: 609fe995a9Smrg msg="probably too old" 619fe995a9Smrg fi 629fe995a9Smrg ;; 639fe995a9Smrg 649fe995a9Smrg -h|--h|--he|--hel|--help) 659fe995a9Smrg echo "\ 669fe995a9Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 679fe995a9Smrg 689fe995a9SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 699fe995a9Smrgerror status if there is no known handling for PROGRAM. 709fe995a9Smrg 719fe995a9SmrgOptions: 729fe995a9Smrg -h, --help display this help and exit 739fe995a9Smrg -v, --version output version information and exit 749fe995a9Smrg --run try to run the given command, and emulate it if it fails 759fe995a9Smrg 769fe995a9SmrgSupported PROGRAM values: 779fe995a9Smrg aclocal touch file \`aclocal.m4' 789fe995a9Smrg autoconf touch file \`configure' 799fe995a9Smrg autoheader touch file \`config.h.in' 809fe995a9Smrg autom4te touch the output file, or create a stub one 819fe995a9Smrg automake touch all \`Makefile.in' files 829fe995a9Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 839fe995a9Smrg flex create \`lex.yy.c', if possible, from existing .c 849fe995a9Smrg help2man touch the output file 859fe995a9Smrg lex create \`lex.yy.c', if possible, from existing .c 869fe995a9Smrg makeinfo touch the output file 879fe995a9Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 889fe995a9Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 899fe995a9Smrg 90b62cc08cSmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 91b62cc08cSmrg\`g' are ignored when checking the name. 92b62cc08cSmrg 939fe995a9SmrgSend bug reports to <bug-automake@gnu.org>." 949fe995a9Smrg exit $? 959fe995a9Smrg ;; 969fe995a9Smrg 979fe995a9Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 989fe995a9Smrg echo "missing $scriptversion (GNU Automake)" 999fe995a9Smrg exit $? 1009fe995a9Smrg ;; 1019fe995a9Smrg 1029fe995a9Smrg -*) 1039fe995a9Smrg echo 1>&2 "$0: Unknown \`$1' option" 1049fe995a9Smrg echo 1>&2 "Try \`$0 --help' for more information" 1059fe995a9Smrg exit 1 1069fe995a9Smrg ;; 1079fe995a9Smrg 1089fe995a9Smrgesac 1099fe995a9Smrg 110b62cc08cSmrg# normalize program name to check for. 111b62cc08cSmrgprogram=`echo "$1" | sed ' 112b62cc08cSmrg s/^gnu-//; t 113b62cc08cSmrg s/^gnu//; t 114b62cc08cSmrg s/^g//; t'` 115b62cc08cSmrg 1169fe995a9Smrg# Now exit if we have it, but it failed. Also exit now if we 1179fe995a9Smrg# don't have it and --version was passed (most likely to detect 118b62cc08cSmrg# the program). This is about non-GNU programs, so use $1 not 119b62cc08cSmrg# $program. 1209fe995a9Smrgcase $1 in 121b62cc08cSmrg lex*|yacc*) 1229fe995a9Smrg # Not GNU programs, they don't have --version. 1239fe995a9Smrg ;; 1249fe995a9Smrg 125b62cc08cSmrg tar*) 1269fe995a9Smrg if test -n "$run"; then 1279fe995a9Smrg echo 1>&2 "ERROR: \`tar' requires --run" 1289fe995a9Smrg exit 1 1299fe995a9Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1309fe995a9Smrg exit 1 1319fe995a9Smrg fi 1329fe995a9Smrg ;; 1339fe995a9Smrg 1349fe995a9Smrg *) 1359fe995a9Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 1369fe995a9Smrg # We have it, but it failed. 1379fe995a9Smrg exit 1 1389fe995a9Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1399fe995a9Smrg # Could not run --version or --help. This is probably someone 1409fe995a9Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 1419fe995a9Smrg # $TOOL exists and not knowing $TOOL uses missing. 1429fe995a9Smrg exit 1 1439fe995a9Smrg fi 1449fe995a9Smrg ;; 1459fe995a9Smrgesac 1469fe995a9Smrg 1479fe995a9Smrg# If it does not exist, or fails to run (possibly an outdated version), 1489fe995a9Smrg# try to emulate it. 149b62cc08cSmrgcase $program in 1509fe995a9Smrg aclocal*) 1519fe995a9Smrg echo 1>&2 "\ 1529fe995a9SmrgWARNING: \`$1' is $msg. You should only need it if 1539fe995a9Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 1549fe995a9Smrg to install the \`Automake' and \`Perl' packages. Grab them from 1559fe995a9Smrg any GNU archive site." 1569fe995a9Smrg touch aclocal.m4 1579fe995a9Smrg ;; 1589fe995a9Smrg 159b62cc08cSmrg autoconf*) 1609fe995a9Smrg echo 1>&2 "\ 1619fe995a9SmrgWARNING: \`$1' is $msg. You should only need it if 1629fe995a9Smrg you modified \`${configure_ac}'. You might want to install the 1639fe995a9Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 1649fe995a9Smrg archive site." 1659fe995a9Smrg touch configure 1669fe995a9Smrg ;; 1679fe995a9Smrg 168b62cc08cSmrg autoheader*) 1699fe995a9Smrg echo 1>&2 "\ 1709fe995a9SmrgWARNING: \`$1' is $msg. You should only need it if 1719fe995a9Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 1729fe995a9Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 1739fe995a9Smrg from any GNU archive site." 1749fe995a9Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 1759fe995a9Smrg test -z "$files" && files="config.h" 1769fe995a9Smrg touch_files= 1779fe995a9Smrg for f in $files; do 1789fe995a9Smrg case $f in 1799fe995a9Smrg *:*) touch_files="$touch_files "`echo "$f" | 1809fe995a9Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 1819fe995a9Smrg *) touch_files="$touch_files $f.in";; 1829fe995a9Smrg esac 1839fe995a9Smrg done 1849fe995a9Smrg touch $touch_files 1859fe995a9Smrg ;; 1869fe995a9Smrg 1879fe995a9Smrg automake*) 1889fe995a9Smrg echo 1>&2 "\ 1899fe995a9SmrgWARNING: \`$1' is $msg. You should only need it if 1909fe995a9Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 1919fe995a9Smrg You might want to install the \`Automake' and \`Perl' packages. 1929fe995a9Smrg Grab them from any GNU archive site." 1939fe995a9Smrg find . -type f -name Makefile.am -print | 1949fe995a9Smrg sed 's/\.am$/.in/' | 1959fe995a9Smrg while read f; do touch "$f"; done 1969fe995a9Smrg ;; 1979fe995a9Smrg 198b62cc08cSmrg autom4te*) 1999fe995a9Smrg echo 1>&2 "\ 2009fe995a9SmrgWARNING: \`$1' is needed, but is $msg. 2019fe995a9Smrg You might have modified some files without having the 2029fe995a9Smrg proper tools for further handling them. 2039fe995a9Smrg You can get \`$1' as part of \`Autoconf' from any GNU 2049fe995a9Smrg archive site." 2059fe995a9Smrg 2069fe995a9Smrg file=`echo "$*" | sed -n "$sed_output"` 2079fe995a9Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2089fe995a9Smrg if test -f "$file"; then 2099fe995a9Smrg touch $file 2109fe995a9Smrg else 2119fe995a9Smrg test -z "$file" || exec >$file 2129fe995a9Smrg echo "#! /bin/sh" 2139fe995a9Smrg echo "# Created by GNU Automake missing as a replacement of" 2149fe995a9Smrg echo "# $ $@" 2159fe995a9Smrg echo "exit 0" 2169fe995a9Smrg chmod +x $file 2179fe995a9Smrg exit 1 2189fe995a9Smrg fi 2199fe995a9Smrg ;; 2209fe995a9Smrg 221b62cc08cSmrg bison*|yacc*) 2229fe995a9Smrg echo 1>&2 "\ 2239fe995a9SmrgWARNING: \`$1' $msg. You should only need it if 2249fe995a9Smrg you modified a \`.y' file. You may need the \`Bison' package 2259fe995a9Smrg in order for those modifications to take effect. You can get 2269fe995a9Smrg \`Bison' from any GNU archive site." 2279fe995a9Smrg rm -f y.tab.c y.tab.h 2289fe995a9Smrg if test $# -ne 1; then 2299fe995a9Smrg eval LASTARG="\${$#}" 2309fe995a9Smrg case $LASTARG in 2319fe995a9Smrg *.y) 2329fe995a9Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 2339fe995a9Smrg if test -f "$SRCFILE"; then 2349fe995a9Smrg cp "$SRCFILE" y.tab.c 2359fe995a9Smrg fi 2369fe995a9Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 2379fe995a9Smrg if test -f "$SRCFILE"; then 2389fe995a9Smrg cp "$SRCFILE" y.tab.h 2399fe995a9Smrg fi 2409fe995a9Smrg ;; 2419fe995a9Smrg esac 2429fe995a9Smrg fi 2439fe995a9Smrg if test ! -f y.tab.h; then 2449fe995a9Smrg echo >y.tab.h 2459fe995a9Smrg fi 2469fe995a9Smrg if test ! -f y.tab.c; then 2479fe995a9Smrg echo 'main() { return 0; }' >y.tab.c 2489fe995a9Smrg fi 2499fe995a9Smrg ;; 2509fe995a9Smrg 251b62cc08cSmrg lex*|flex*) 2529fe995a9Smrg echo 1>&2 "\ 2539fe995a9SmrgWARNING: \`$1' is $msg. You should only need it if 2549fe995a9Smrg you modified a \`.l' file. You may need the \`Flex' package 2559fe995a9Smrg in order for those modifications to take effect. You can get 2569fe995a9Smrg \`Flex' from any GNU archive site." 2579fe995a9Smrg rm -f lex.yy.c 2589fe995a9Smrg if test $# -ne 1; then 2599fe995a9Smrg eval LASTARG="\${$#}" 2609fe995a9Smrg case $LASTARG in 2619fe995a9Smrg *.l) 2629fe995a9Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 2639fe995a9Smrg if test -f "$SRCFILE"; then 2649fe995a9Smrg cp "$SRCFILE" lex.yy.c 2659fe995a9Smrg fi 2669fe995a9Smrg ;; 2679fe995a9Smrg esac 2689fe995a9Smrg fi 2699fe995a9Smrg if test ! -f lex.yy.c; then 2709fe995a9Smrg echo 'main() { return 0; }' >lex.yy.c 2719fe995a9Smrg fi 2729fe995a9Smrg ;; 2739fe995a9Smrg 274b62cc08cSmrg help2man*) 2759fe995a9Smrg echo 1>&2 "\ 2769fe995a9SmrgWARNING: \`$1' is $msg. You should only need it if 2779fe995a9Smrg you modified a dependency of a manual page. You may need the 2789fe995a9Smrg \`Help2man' package in order for those modifications to take 2799fe995a9Smrg effect. You can get \`Help2man' from any GNU archive site." 2809fe995a9Smrg 2819fe995a9Smrg file=`echo "$*" | sed -n "$sed_output"` 2829fe995a9Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2839fe995a9Smrg if test -f "$file"; then 2849fe995a9Smrg touch $file 2859fe995a9Smrg else 2869fe995a9Smrg test -z "$file" || exec >$file 2879fe995a9Smrg echo ".ab help2man is required to generate this page" 288b62cc08cSmrg exit $? 2899fe995a9Smrg fi 2909fe995a9Smrg ;; 2919fe995a9Smrg 292b62cc08cSmrg makeinfo*) 2939fe995a9Smrg echo 1>&2 "\ 2949fe995a9SmrgWARNING: \`$1' is $msg. You should only need it if 2959fe995a9Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 2969fe995a9Smrg indirectly affecting the aspect of the manual. The spurious 2979fe995a9Smrg call might also be the consequence of using a buggy \`make' (AIX, 2989fe995a9Smrg DU, IRIX). You might want to install the \`Texinfo' package or 2999fe995a9Smrg the \`GNU make' package. Grab either from any GNU archive site." 3009fe995a9Smrg # The file to touch is that specified with -o ... 3019fe995a9Smrg file=`echo "$*" | sed -n "$sed_output"` 3029fe995a9Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 3039fe995a9Smrg if test -z "$file"; then 3049fe995a9Smrg # ... or it is the one specified with @setfilename ... 3059fe995a9Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 3069fe995a9Smrg file=`sed -n ' 3079fe995a9Smrg /^@setfilename/{ 3089fe995a9Smrg s/.* \([^ ]*\) *$/\1/ 3099fe995a9Smrg p 3109fe995a9Smrg q 3119fe995a9Smrg }' $infile` 3129fe995a9Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 3139fe995a9Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 3149fe995a9Smrg fi 3159fe995a9Smrg # If the file does not exist, the user really needs makeinfo; 3169fe995a9Smrg # let's fail without touching anything. 3179fe995a9Smrg test -f $file || exit 1 3189fe995a9Smrg touch $file 3199fe995a9Smrg ;; 3209fe995a9Smrg 321b62cc08cSmrg tar*) 3229fe995a9Smrg shift 3239fe995a9Smrg 3249fe995a9Smrg # We have already tried tar in the generic part. 3259fe995a9Smrg # Look for gnutar/gtar before invocation to avoid ugly error 3269fe995a9Smrg # messages. 3279fe995a9Smrg if (gnutar --version > /dev/null 2>&1); then 3289fe995a9Smrg gnutar "$@" && exit 0 3299fe995a9Smrg fi 3309fe995a9Smrg if (gtar --version > /dev/null 2>&1); then 3319fe995a9Smrg gtar "$@" && exit 0 3329fe995a9Smrg fi 3339fe995a9Smrg firstarg="$1" 3349fe995a9Smrg if shift; then 3359fe995a9Smrg case $firstarg in 3369fe995a9Smrg *o*) 3379fe995a9Smrg firstarg=`echo "$firstarg" | sed s/o//` 3389fe995a9Smrg tar "$firstarg" "$@" && exit 0 3399fe995a9Smrg ;; 3409fe995a9Smrg esac 3419fe995a9Smrg case $firstarg in 3429fe995a9Smrg *h*) 3439fe995a9Smrg firstarg=`echo "$firstarg" | sed s/h//` 3449fe995a9Smrg tar "$firstarg" "$@" && exit 0 3459fe995a9Smrg ;; 3469fe995a9Smrg esac 3479fe995a9Smrg fi 3489fe995a9Smrg 3499fe995a9Smrg echo 1>&2 "\ 3509fe995a9SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 3519fe995a9Smrg You may want to install GNU tar or Free paxutils, or check the 3529fe995a9Smrg command line arguments." 3539fe995a9Smrg exit 1 3549fe995a9Smrg ;; 3559fe995a9Smrg 3569fe995a9Smrg *) 3579fe995a9Smrg echo 1>&2 "\ 3589fe995a9SmrgWARNING: \`$1' is needed, and is $msg. 3599fe995a9Smrg You might have modified some files without having the 3609fe995a9Smrg proper tools for further handling them. Check the \`README' file, 3619fe995a9Smrg it often tells you about the needed prerequisites for installing 3629fe995a9Smrg this package. You may also peek at any GNU archive site, in case 3639fe995a9Smrg some other package would contain this missing \`$1' program." 3649fe995a9Smrg exit 1 3659fe995a9Smrg ;; 3669fe995a9Smrgesac 3679fe995a9Smrg 3689fe995a9Smrgexit 0 3699fe995a9Smrg 3709fe995a9Smrg# Local variables: 3719fe995a9Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 3729fe995a9Smrg# time-stamp-start: "scriptversion=" 3739fe995a9Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 374b62cc08cSmrg# time-stamp-time-zone: "UTC" 375b62cc08cSmrg# time-stamp-end: "; # UTC" 3769fe995a9Smrg# End: 377