missing revision 5dfecf96
15dfecf96Smrg#! /bin/sh 25dfecf96Smrg# Common stub for a few missing GNU programs while installing. 35dfecf96Smrg 45dfecf96Smrgscriptversion=2005-06-08.21 55dfecf96Smrg 65dfecf96Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 75dfecf96Smrg# Free Software Foundation, Inc. 85dfecf96Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 95dfecf96Smrg 105dfecf96Smrg# This program is free software; you can redistribute it and/or modify 115dfecf96Smrg# it under the terms of the GNU General Public License as published by 125dfecf96Smrg# the Free Software Foundation; either version 2, or (at your option) 135dfecf96Smrg# any later version. 145dfecf96Smrg 155dfecf96Smrg# This program is distributed in the hope that it will be useful, 165dfecf96Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 175dfecf96Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 185dfecf96Smrg# GNU General Public License for more details. 195dfecf96Smrg 205dfecf96Smrg# You should have received a copy of the GNU General Public License 215dfecf96Smrg# along with this program; if not, write to the Free Software 225dfecf96Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 235dfecf96Smrg# 02110-1301, USA. 245dfecf96Smrg 255dfecf96Smrg# As a special exception to the GNU General Public License, if you 265dfecf96Smrg# distribute this file as part of a program that contains a 275dfecf96Smrg# configuration script generated by Autoconf, you may include it under 285dfecf96Smrg# the same distribution terms that you use for the rest of that program. 295dfecf96Smrg 305dfecf96Smrgif test $# -eq 0; then 315dfecf96Smrg echo 1>&2 "Try \`$0 --help' for more information" 325dfecf96Smrg exit 1 335dfecf96Smrgfi 345dfecf96Smrg 355dfecf96Smrgrun=: 365dfecf96Smrg 375dfecf96Smrg# In the cases where this matters, `missing' is being run in the 385dfecf96Smrg# srcdir already. 395dfecf96Smrgif test -f configure.ac; then 405dfecf96Smrg configure_ac=configure.ac 415dfecf96Smrgelse 425dfecf96Smrg configure_ac=configure.in 435dfecf96Smrgfi 445dfecf96Smrg 455dfecf96Smrgmsg="missing on your system" 465dfecf96Smrg 475dfecf96Smrgcase "$1" in 485dfecf96Smrg--run) 495dfecf96Smrg # Try to run requested program, and just exit if it succeeds. 505dfecf96Smrg run= 515dfecf96Smrg shift 525dfecf96Smrg "$@" && exit 0 535dfecf96Smrg # Exit code 63 means version mismatch. This often happens 545dfecf96Smrg # when the user try to use an ancient version of a tool on 555dfecf96Smrg # a file that requires a minimum version. In this case we 565dfecf96Smrg # we should proceed has if the program had been absent, or 575dfecf96Smrg # if --run hadn't been passed. 585dfecf96Smrg if test $? = 63; then 595dfecf96Smrg run=: 605dfecf96Smrg msg="probably too old" 615dfecf96Smrg fi 625dfecf96Smrg ;; 635dfecf96Smrg 645dfecf96Smrg -h|--h|--he|--hel|--help) 655dfecf96Smrg echo "\ 665dfecf96Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 675dfecf96Smrg 685dfecf96SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 695dfecf96Smrgerror status if there is no known handling for PROGRAM. 705dfecf96Smrg 715dfecf96SmrgOptions: 725dfecf96Smrg -h, --help display this help and exit 735dfecf96Smrg -v, --version output version information and exit 745dfecf96Smrg --run try to run the given command, and emulate it if it fails 755dfecf96Smrg 765dfecf96SmrgSupported PROGRAM values: 775dfecf96Smrg aclocal touch file \`aclocal.m4' 785dfecf96Smrg autoconf touch file \`configure' 795dfecf96Smrg autoheader touch file \`config.h.in' 805dfecf96Smrg automake touch all \`Makefile.in' files 815dfecf96Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 825dfecf96Smrg flex create \`lex.yy.c', if possible, from existing .c 835dfecf96Smrg help2man touch the output file 845dfecf96Smrg lex create \`lex.yy.c', if possible, from existing .c 855dfecf96Smrg makeinfo touch the output file 865dfecf96Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 875dfecf96Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 885dfecf96Smrg 895dfecf96SmrgSend bug reports to <bug-automake@gnu.org>." 905dfecf96Smrg exit $? 915dfecf96Smrg ;; 925dfecf96Smrg 935dfecf96Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 945dfecf96Smrg echo "missing $scriptversion (GNU Automake)" 955dfecf96Smrg exit $? 965dfecf96Smrg ;; 975dfecf96Smrg 985dfecf96Smrg -*) 995dfecf96Smrg echo 1>&2 "$0: Unknown \`$1' option" 1005dfecf96Smrg echo 1>&2 "Try \`$0 --help' for more information" 1015dfecf96Smrg exit 1 1025dfecf96Smrg ;; 1035dfecf96Smrg 1045dfecf96Smrgesac 1055dfecf96Smrg 1065dfecf96Smrg# Now exit if we have it, but it failed. Also exit now if we 1075dfecf96Smrg# don't have it and --version was passed (most likely to detect 1085dfecf96Smrg# the program). 1095dfecf96Smrgcase "$1" in 1105dfecf96Smrg lex|yacc) 1115dfecf96Smrg # Not GNU programs, they don't have --version. 1125dfecf96Smrg ;; 1135dfecf96Smrg 1145dfecf96Smrg tar) 1155dfecf96Smrg if test -n "$run"; then 1165dfecf96Smrg echo 1>&2 "ERROR: \`tar' requires --run" 1175dfecf96Smrg exit 1 1185dfecf96Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1195dfecf96Smrg exit 1 1205dfecf96Smrg fi 1215dfecf96Smrg ;; 1225dfecf96Smrg 1235dfecf96Smrg *) 1245dfecf96Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 1255dfecf96Smrg # We have it, but it failed. 1265dfecf96Smrg exit 1 1275dfecf96Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1285dfecf96Smrg # Could not run --version or --help. This is probably someone 1295dfecf96Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 1305dfecf96Smrg # $TOOL exists and not knowing $TOOL uses missing. 1315dfecf96Smrg exit 1 1325dfecf96Smrg fi 1335dfecf96Smrg ;; 1345dfecf96Smrgesac 1355dfecf96Smrg 1365dfecf96Smrg# If it does not exist, or fails to run (possibly an outdated version), 1375dfecf96Smrg# try to emulate it. 1385dfecf96Smrgcase "$1" in 1395dfecf96Smrg aclocal*) 1405dfecf96Smrg echo 1>&2 "\ 1415dfecf96SmrgWARNING: \`$1' is $msg. You should only need it if 1425dfecf96Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 1435dfecf96Smrg to install the \`Automake' and \`Perl' packages. Grab them from 1445dfecf96Smrg any GNU archive site." 1455dfecf96Smrg touch aclocal.m4 1465dfecf96Smrg ;; 1475dfecf96Smrg 1485dfecf96Smrg autoconf) 1495dfecf96Smrg echo 1>&2 "\ 1505dfecf96SmrgWARNING: \`$1' is $msg. You should only need it if 1515dfecf96Smrg you modified \`${configure_ac}'. You might want to install the 1525dfecf96Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 1535dfecf96Smrg archive site." 1545dfecf96Smrg touch configure 1555dfecf96Smrg ;; 1565dfecf96Smrg 1575dfecf96Smrg autoheader) 1585dfecf96Smrg echo 1>&2 "\ 1595dfecf96SmrgWARNING: \`$1' is $msg. You should only need it if 1605dfecf96Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 1615dfecf96Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 1625dfecf96Smrg from any GNU archive site." 1635dfecf96Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 1645dfecf96Smrg test -z "$files" && files="config.h" 1655dfecf96Smrg touch_files= 1665dfecf96Smrg for f in $files; do 1675dfecf96Smrg case "$f" in 1685dfecf96Smrg *:*) touch_files="$touch_files "`echo "$f" | 1695dfecf96Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 1705dfecf96Smrg *) touch_files="$touch_files $f.in";; 1715dfecf96Smrg esac 1725dfecf96Smrg done 1735dfecf96Smrg touch $touch_files 1745dfecf96Smrg ;; 1755dfecf96Smrg 1765dfecf96Smrg automake*) 1775dfecf96Smrg echo 1>&2 "\ 1785dfecf96SmrgWARNING: \`$1' is $msg. You should only need it if 1795dfecf96Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 1805dfecf96Smrg You might want to install the \`Automake' and \`Perl' packages. 1815dfecf96Smrg Grab them from any GNU archive site." 1825dfecf96Smrg find . -type f -name Makefile.am -print | 1835dfecf96Smrg sed 's/\.am$/.in/' | 1845dfecf96Smrg while read f; do touch "$f"; done 1855dfecf96Smrg ;; 1865dfecf96Smrg 1875dfecf96Smrg autom4te) 1885dfecf96Smrg echo 1>&2 "\ 1895dfecf96SmrgWARNING: \`$1' is needed, but is $msg. 1905dfecf96Smrg You might have modified some files without having the 1915dfecf96Smrg proper tools for further handling them. 1925dfecf96Smrg You can get \`$1' as part of \`Autoconf' from any GNU 1935dfecf96Smrg archive site." 1945dfecf96Smrg 1955dfecf96Smrg file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 1965dfecf96Smrg test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 1975dfecf96Smrg if test -f "$file"; then 1985dfecf96Smrg touch $file 1995dfecf96Smrg else 2005dfecf96Smrg test -z "$file" || exec >$file 2015dfecf96Smrg echo "#! /bin/sh" 2025dfecf96Smrg echo "# Created by GNU Automake missing as a replacement of" 2035dfecf96Smrg echo "# $ $@" 2045dfecf96Smrg echo "exit 0" 2055dfecf96Smrg chmod +x $file 2065dfecf96Smrg exit 1 2075dfecf96Smrg fi 2085dfecf96Smrg ;; 2095dfecf96Smrg 2105dfecf96Smrg bison|yacc) 2115dfecf96Smrg echo 1>&2 "\ 2125dfecf96SmrgWARNING: \`$1' $msg. You should only need it if 2135dfecf96Smrg you modified a \`.y' file. You may need the \`Bison' package 2145dfecf96Smrg in order for those modifications to take effect. You can get 2155dfecf96Smrg \`Bison' from any GNU archive site." 2165dfecf96Smrg rm -f y.tab.c y.tab.h 2175dfecf96Smrg if [ $# -ne 1 ]; then 2185dfecf96Smrg eval LASTARG="\${$#}" 2195dfecf96Smrg case "$LASTARG" in 2205dfecf96Smrg *.y) 2215dfecf96Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 2225dfecf96Smrg if [ -f "$SRCFILE" ]; then 2235dfecf96Smrg cp "$SRCFILE" y.tab.c 2245dfecf96Smrg fi 2255dfecf96Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 2265dfecf96Smrg if [ -f "$SRCFILE" ]; then 2275dfecf96Smrg cp "$SRCFILE" y.tab.h 2285dfecf96Smrg fi 2295dfecf96Smrg ;; 2305dfecf96Smrg esac 2315dfecf96Smrg fi 2325dfecf96Smrg if [ ! -f y.tab.h ]; then 2335dfecf96Smrg echo >y.tab.h 2345dfecf96Smrg fi 2355dfecf96Smrg if [ ! -f y.tab.c ]; then 2365dfecf96Smrg echo 'main() { return 0; }' >y.tab.c 2375dfecf96Smrg fi 2385dfecf96Smrg ;; 2395dfecf96Smrg 2405dfecf96Smrg lex|flex) 2415dfecf96Smrg echo 1>&2 "\ 2425dfecf96SmrgWARNING: \`$1' is $msg. You should only need it if 2435dfecf96Smrg you modified a \`.l' file. You may need the \`Flex' package 2445dfecf96Smrg in order for those modifications to take effect. You can get 2455dfecf96Smrg \`Flex' from any GNU archive site." 2465dfecf96Smrg rm -f lex.yy.c 2475dfecf96Smrg if [ $# -ne 1 ]; then 2485dfecf96Smrg eval LASTARG="\${$#}" 2495dfecf96Smrg case "$LASTARG" in 2505dfecf96Smrg *.l) 2515dfecf96Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 2525dfecf96Smrg if [ -f "$SRCFILE" ]; then 2535dfecf96Smrg cp "$SRCFILE" lex.yy.c 2545dfecf96Smrg fi 2555dfecf96Smrg ;; 2565dfecf96Smrg esac 2575dfecf96Smrg fi 2585dfecf96Smrg if [ ! -f lex.yy.c ]; then 2595dfecf96Smrg echo 'main() { return 0; }' >lex.yy.c 2605dfecf96Smrg fi 2615dfecf96Smrg ;; 2625dfecf96Smrg 2635dfecf96Smrg help2man) 2645dfecf96Smrg echo 1>&2 "\ 2655dfecf96SmrgWARNING: \`$1' is $msg. You should only need it if 2665dfecf96Smrg you modified a dependency of a manual page. You may need the 2675dfecf96Smrg \`Help2man' package in order for those modifications to take 2685dfecf96Smrg effect. You can get \`Help2man' from any GNU archive site." 2695dfecf96Smrg 2705dfecf96Smrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 2715dfecf96Smrg if test -z "$file"; then 2725dfecf96Smrg file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 2735dfecf96Smrg fi 2745dfecf96Smrg if [ -f "$file" ]; then 2755dfecf96Smrg touch $file 2765dfecf96Smrg else 2775dfecf96Smrg test -z "$file" || exec >$file 2785dfecf96Smrg echo ".ab help2man is required to generate this page" 2795dfecf96Smrg exit 1 2805dfecf96Smrg fi 2815dfecf96Smrg ;; 2825dfecf96Smrg 2835dfecf96Smrg makeinfo) 2845dfecf96Smrg echo 1>&2 "\ 2855dfecf96SmrgWARNING: \`$1' is $msg. You should only need it if 2865dfecf96Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 2875dfecf96Smrg indirectly affecting the aspect of the manual. The spurious 2885dfecf96Smrg call might also be the consequence of using a buggy \`make' (AIX, 2895dfecf96Smrg DU, IRIX). You might want to install the \`Texinfo' package or 2905dfecf96Smrg the \`GNU make' package. Grab either from any GNU archive site." 2915dfecf96Smrg # The file to touch is that specified with -o ... 2925dfecf96Smrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 2935dfecf96Smrg if test -z "$file"; then 2945dfecf96Smrg # ... or it is the one specified with @setfilename ... 2955dfecf96Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 2965dfecf96Smrg file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` 2975dfecf96Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 2985dfecf96Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 2995dfecf96Smrg fi 3005dfecf96Smrg # If the file does not exist, the user really needs makeinfo; 3015dfecf96Smrg # let's fail without touching anything. 3025dfecf96Smrg test -f $file || exit 1 3035dfecf96Smrg touch $file 3045dfecf96Smrg ;; 3055dfecf96Smrg 3065dfecf96Smrg tar) 3075dfecf96Smrg shift 3085dfecf96Smrg 3095dfecf96Smrg # We have already tried tar in the generic part. 3105dfecf96Smrg # Look for gnutar/gtar before invocation to avoid ugly error 3115dfecf96Smrg # messages. 3125dfecf96Smrg if (gnutar --version > /dev/null 2>&1); then 3135dfecf96Smrg gnutar "$@" && exit 0 3145dfecf96Smrg fi 3155dfecf96Smrg if (gtar --version > /dev/null 2>&1); then 3165dfecf96Smrg gtar "$@" && exit 0 3175dfecf96Smrg fi 3185dfecf96Smrg firstarg="$1" 3195dfecf96Smrg if shift; then 3205dfecf96Smrg case "$firstarg" in 3215dfecf96Smrg *o*) 3225dfecf96Smrg firstarg=`echo "$firstarg" | sed s/o//` 3235dfecf96Smrg tar "$firstarg" "$@" && exit 0 3245dfecf96Smrg ;; 3255dfecf96Smrg esac 3265dfecf96Smrg case "$firstarg" in 3275dfecf96Smrg *h*) 3285dfecf96Smrg firstarg=`echo "$firstarg" | sed s/h//` 3295dfecf96Smrg tar "$firstarg" "$@" && exit 0 3305dfecf96Smrg ;; 3315dfecf96Smrg esac 3325dfecf96Smrg fi 3335dfecf96Smrg 3345dfecf96Smrg echo 1>&2 "\ 3355dfecf96SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 3365dfecf96Smrg You may want to install GNU tar or Free paxutils, or check the 3375dfecf96Smrg command line arguments." 3385dfecf96Smrg exit 1 3395dfecf96Smrg ;; 3405dfecf96Smrg 3415dfecf96Smrg *) 3425dfecf96Smrg echo 1>&2 "\ 3435dfecf96SmrgWARNING: \`$1' is needed, and is $msg. 3445dfecf96Smrg You might have modified some files without having the 3455dfecf96Smrg proper tools for further handling them. Check the \`README' file, 3465dfecf96Smrg it often tells you about the needed prerequisites for installing 3475dfecf96Smrg this package. You may also peek at any GNU archive site, in case 3485dfecf96Smrg some other package would contain this missing \`$1' program." 3495dfecf96Smrg exit 1 3505dfecf96Smrg ;; 3515dfecf96Smrgesac 3525dfecf96Smrg 3535dfecf96Smrgexit 0 3545dfecf96Smrg 3555dfecf96Smrg# Local variables: 3565dfecf96Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 3575dfecf96Smrg# time-stamp-start: "scriptversion=" 3585dfecf96Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 3595dfecf96Smrg# time-stamp-end: "$" 3605dfecf96Smrg# End: 361