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