missing revision 6df26cac
16df26cacSmrg#! /bin/sh 26df26cacSmrg# Common stub for a few missing GNU programs while installing. 36df26cacSmrg 46df26cacSmrgscriptversion=2006-05-10.23 56df26cacSmrg 66df26cacSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 76df26cacSmrg# Free Software Foundation, Inc. 86df26cacSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 96df26cacSmrg 106df26cacSmrg# This program is free software; you can redistribute it and/or modify 116df26cacSmrg# it under the terms of the GNU General Public License as published by 126df26cacSmrg# the Free Software Foundation; either version 2, or (at your option) 136df26cacSmrg# any later version. 146df26cacSmrg 156df26cacSmrg# This program is distributed in the hope that it will be useful, 166df26cacSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 176df26cacSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 186df26cacSmrg# GNU General Public License for more details. 196df26cacSmrg 206df26cacSmrg# You should have received a copy of the GNU General Public License 216df26cacSmrg# along with this program; if not, write to the Free Software 226df26cacSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 236df26cacSmrg# 02110-1301, USA. 246df26cacSmrg 256df26cacSmrg# As a special exception to the GNU General Public License, if you 266df26cacSmrg# distribute this file as part of a program that contains a 276df26cacSmrg# configuration script generated by Autoconf, you may include it under 286df26cacSmrg# the same distribution terms that you use for the rest of that program. 296df26cacSmrg 306df26cacSmrgif test $# -eq 0; then 316df26cacSmrg echo 1>&2 "Try \`$0 --help' for more information" 326df26cacSmrg exit 1 336df26cacSmrgfi 346df26cacSmrg 356df26cacSmrgrun=: 366df26cacSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 376df26cacSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 386df26cacSmrg 396df26cacSmrg# In the cases where this matters, `missing' is being run in the 406df26cacSmrg# srcdir already. 416df26cacSmrgif test -f configure.ac; then 426df26cacSmrg configure_ac=configure.ac 436df26cacSmrgelse 446df26cacSmrg configure_ac=configure.in 456df26cacSmrgfi 466df26cacSmrg 476df26cacSmrgmsg="missing on your system" 486df26cacSmrg 496df26cacSmrgcase $1 in 506df26cacSmrg--run) 516df26cacSmrg # Try to run requested program, and just exit if it succeeds. 526df26cacSmrg run= 536df26cacSmrg shift 546df26cacSmrg "$@" && exit 0 556df26cacSmrg # Exit code 63 means version mismatch. This often happens 566df26cacSmrg # when the user try to use an ancient version of a tool on 576df26cacSmrg # a file that requires a minimum version. In this case we 586df26cacSmrg # we should proceed has if the program had been absent, or 596df26cacSmrg # if --run hadn't been passed. 606df26cacSmrg if test $? = 63; then 616df26cacSmrg run=: 626df26cacSmrg msg="probably too old" 636df26cacSmrg fi 646df26cacSmrg ;; 656df26cacSmrg 666df26cacSmrg -h|--h|--he|--hel|--help) 676df26cacSmrg echo "\ 686df26cacSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 696df26cacSmrg 706df26cacSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 716df26cacSmrgerror status if there is no known handling for PROGRAM. 726df26cacSmrg 736df26cacSmrgOptions: 746df26cacSmrg -h, --help display this help and exit 756df26cacSmrg -v, --version output version information and exit 766df26cacSmrg --run try to run the given command, and emulate it if it fails 776df26cacSmrg 786df26cacSmrgSupported PROGRAM values: 796df26cacSmrg aclocal touch file \`aclocal.m4' 806df26cacSmrg autoconf touch file \`configure' 816df26cacSmrg autoheader touch file \`config.h.in' 826df26cacSmrg autom4te touch the output file, or create a stub one 836df26cacSmrg automake touch all \`Makefile.in' files 846df26cacSmrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 856df26cacSmrg flex create \`lex.yy.c', if possible, from existing .c 866df26cacSmrg help2man touch the output file 876df26cacSmrg lex create \`lex.yy.c', if possible, from existing .c 886df26cacSmrg makeinfo touch the output file 896df26cacSmrg tar try tar, gnutar, gtar, then tar without non-portable flags 906df26cacSmrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 916df26cacSmrg 926df26cacSmrgSend bug reports to <bug-automake@gnu.org>." 936df26cacSmrg exit $? 946df26cacSmrg ;; 956df26cacSmrg 966df26cacSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 976df26cacSmrg echo "missing $scriptversion (GNU Automake)" 986df26cacSmrg exit $? 996df26cacSmrg ;; 1006df26cacSmrg 1016df26cacSmrg -*) 1026df26cacSmrg echo 1>&2 "$0: Unknown \`$1' option" 1036df26cacSmrg echo 1>&2 "Try \`$0 --help' for more information" 1046df26cacSmrg exit 1 1056df26cacSmrg ;; 1066df26cacSmrg 1076df26cacSmrgesac 1086df26cacSmrg 1096df26cacSmrg# Now exit if we have it, but it failed. Also exit now if we 1106df26cacSmrg# don't have it and --version was passed (most likely to detect 1116df26cacSmrg# the program). 1126df26cacSmrgcase $1 in 1136df26cacSmrg lex|yacc) 1146df26cacSmrg # Not GNU programs, they don't have --version. 1156df26cacSmrg ;; 1166df26cacSmrg 1176df26cacSmrg tar) 1186df26cacSmrg if test -n "$run"; then 1196df26cacSmrg echo 1>&2 "ERROR: \`tar' requires --run" 1206df26cacSmrg exit 1 1216df26cacSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1226df26cacSmrg exit 1 1236df26cacSmrg fi 1246df26cacSmrg ;; 1256df26cacSmrg 1266df26cacSmrg *) 1276df26cacSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 1286df26cacSmrg # We have it, but it failed. 1296df26cacSmrg exit 1 1306df26cacSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1316df26cacSmrg # Could not run --version or --help. This is probably someone 1326df26cacSmrg # running `$TOOL --version' or `$TOOL --help' to check whether 1336df26cacSmrg # $TOOL exists and not knowing $TOOL uses missing. 1346df26cacSmrg exit 1 1356df26cacSmrg fi 1366df26cacSmrg ;; 1376df26cacSmrgesac 1386df26cacSmrg 1396df26cacSmrg# If it does not exist, or fails to run (possibly an outdated version), 1406df26cacSmrg# try to emulate it. 1416df26cacSmrgcase $1 in 1426df26cacSmrg aclocal*) 1436df26cacSmrg echo 1>&2 "\ 1446df26cacSmrgWARNING: \`$1' is $msg. You should only need it if 1456df26cacSmrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 1466df26cacSmrg to install the \`Automake' and \`Perl' packages. Grab them from 1476df26cacSmrg any GNU archive site." 1486df26cacSmrg touch aclocal.m4 1496df26cacSmrg ;; 1506df26cacSmrg 1516df26cacSmrg autoconf) 1526df26cacSmrg echo 1>&2 "\ 1536df26cacSmrgWARNING: \`$1' is $msg. You should only need it if 1546df26cacSmrg you modified \`${configure_ac}'. You might want to install the 1556df26cacSmrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 1566df26cacSmrg archive site." 1576df26cacSmrg touch configure 1586df26cacSmrg ;; 1596df26cacSmrg 1606df26cacSmrg autoheader) 1616df26cacSmrg echo 1>&2 "\ 1626df26cacSmrgWARNING: \`$1' is $msg. You should only need it if 1636df26cacSmrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 1646df26cacSmrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 1656df26cacSmrg from any GNU archive site." 1666df26cacSmrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 1676df26cacSmrg test -z "$files" && files="config.h" 1686df26cacSmrg touch_files= 1696df26cacSmrg for f in $files; do 1706df26cacSmrg case $f in 1716df26cacSmrg *:*) touch_files="$touch_files "`echo "$f" | 1726df26cacSmrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 1736df26cacSmrg *) touch_files="$touch_files $f.in";; 1746df26cacSmrg esac 1756df26cacSmrg done 1766df26cacSmrg touch $touch_files 1776df26cacSmrg ;; 1786df26cacSmrg 1796df26cacSmrg automake*) 1806df26cacSmrg echo 1>&2 "\ 1816df26cacSmrgWARNING: \`$1' is $msg. You should only need it if 1826df26cacSmrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 1836df26cacSmrg You might want to install the \`Automake' and \`Perl' packages. 1846df26cacSmrg Grab them from any GNU archive site." 1856df26cacSmrg find . -type f -name Makefile.am -print | 1866df26cacSmrg sed 's/\.am$/.in/' | 1876df26cacSmrg while read f; do touch "$f"; done 1886df26cacSmrg ;; 1896df26cacSmrg 1906df26cacSmrg autom4te) 1916df26cacSmrg echo 1>&2 "\ 1926df26cacSmrgWARNING: \`$1' is needed, but is $msg. 1936df26cacSmrg You might have modified some files without having the 1946df26cacSmrg proper tools for further handling them. 1956df26cacSmrg You can get \`$1' as part of \`Autoconf' from any GNU 1966df26cacSmrg archive site." 1976df26cacSmrg 1986df26cacSmrg file=`echo "$*" | sed -n "$sed_output"` 1996df26cacSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2006df26cacSmrg if test -f "$file"; then 2016df26cacSmrg touch $file 2026df26cacSmrg else 2036df26cacSmrg test -z "$file" || exec >$file 2046df26cacSmrg echo "#! /bin/sh" 2056df26cacSmrg echo "# Created by GNU Automake missing as a replacement of" 2066df26cacSmrg echo "# $ $@" 2076df26cacSmrg echo "exit 0" 2086df26cacSmrg chmod +x $file 2096df26cacSmrg exit 1 2106df26cacSmrg fi 2116df26cacSmrg ;; 2126df26cacSmrg 2136df26cacSmrg bison|yacc) 2146df26cacSmrg echo 1>&2 "\ 2156df26cacSmrgWARNING: \`$1' $msg. You should only need it if 2166df26cacSmrg you modified a \`.y' file. You may need the \`Bison' package 2176df26cacSmrg in order for those modifications to take effect. You can get 2186df26cacSmrg \`Bison' from any GNU archive site." 2196df26cacSmrg rm -f y.tab.c y.tab.h 2206df26cacSmrg if test $# -ne 1; then 2216df26cacSmrg eval LASTARG="\${$#}" 2226df26cacSmrg case $LASTARG in 2236df26cacSmrg *.y) 2246df26cacSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 2256df26cacSmrg if test -f "$SRCFILE"; then 2266df26cacSmrg cp "$SRCFILE" y.tab.c 2276df26cacSmrg fi 2286df26cacSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 2296df26cacSmrg if test -f "$SRCFILE"; then 2306df26cacSmrg cp "$SRCFILE" y.tab.h 2316df26cacSmrg fi 2326df26cacSmrg ;; 2336df26cacSmrg esac 2346df26cacSmrg fi 2356df26cacSmrg if test ! -f y.tab.h; then 2366df26cacSmrg echo >y.tab.h 2376df26cacSmrg fi 2386df26cacSmrg if test ! -f y.tab.c; then 2396df26cacSmrg echo 'main() { return 0; }' >y.tab.c 2406df26cacSmrg fi 2416df26cacSmrg ;; 2426df26cacSmrg 2436df26cacSmrg lex|flex) 2446df26cacSmrg echo 1>&2 "\ 2456df26cacSmrgWARNING: \`$1' is $msg. You should only need it if 2466df26cacSmrg you modified a \`.l' file. You may need the \`Flex' package 2476df26cacSmrg in order for those modifications to take effect. You can get 2486df26cacSmrg \`Flex' from any GNU archive site." 2496df26cacSmrg rm -f lex.yy.c 2506df26cacSmrg if test $# -ne 1; then 2516df26cacSmrg eval LASTARG="\${$#}" 2526df26cacSmrg case $LASTARG in 2536df26cacSmrg *.l) 2546df26cacSmrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 2556df26cacSmrg if test -f "$SRCFILE"; then 2566df26cacSmrg cp "$SRCFILE" lex.yy.c 2576df26cacSmrg fi 2586df26cacSmrg ;; 2596df26cacSmrg esac 2606df26cacSmrg fi 2616df26cacSmrg if test ! -f lex.yy.c; then 2626df26cacSmrg echo 'main() { return 0; }' >lex.yy.c 2636df26cacSmrg fi 2646df26cacSmrg ;; 2656df26cacSmrg 2666df26cacSmrg help2man) 2676df26cacSmrg echo 1>&2 "\ 2686df26cacSmrgWARNING: \`$1' is $msg. You should only need it if 2696df26cacSmrg you modified a dependency of a manual page. You may need the 2706df26cacSmrg \`Help2man' package in order for those modifications to take 2716df26cacSmrg effect. You can get \`Help2man' from any GNU archive site." 2726df26cacSmrg 2736df26cacSmrg file=`echo "$*" | sed -n "$sed_output"` 2746df26cacSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2756df26cacSmrg if test -f "$file"; then 2766df26cacSmrg touch $file 2776df26cacSmrg else 2786df26cacSmrg test -z "$file" || exec >$file 2796df26cacSmrg echo ".ab help2man is required to generate this page" 2806df26cacSmrg exit 1 2816df26cacSmrg fi 2826df26cacSmrg ;; 2836df26cacSmrg 2846df26cacSmrg makeinfo) 2856df26cacSmrg echo 1>&2 "\ 2866df26cacSmrgWARNING: \`$1' is $msg. You should only need it if 2876df26cacSmrg you modified a \`.texi' or \`.texinfo' file, or any other file 2886df26cacSmrg indirectly affecting the aspect of the manual. The spurious 2896df26cacSmrg call might also be the consequence of using a buggy \`make' (AIX, 2906df26cacSmrg DU, IRIX). You might want to install the \`Texinfo' package or 2916df26cacSmrg the \`GNU make' package. Grab either from any GNU archive site." 2926df26cacSmrg # The file to touch is that specified with -o ... 2936df26cacSmrg file=`echo "$*" | sed -n "$sed_output"` 2946df26cacSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2956df26cacSmrg if test -z "$file"; then 2966df26cacSmrg # ... or it is the one specified with @setfilename ... 2976df26cacSmrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 2986df26cacSmrg file=`sed -n ' 2996df26cacSmrg /^@setfilename/{ 3006df26cacSmrg s/.* \([^ ]*\) *$/\1/ 3016df26cacSmrg p 3026df26cacSmrg q 3036df26cacSmrg }' $infile` 3046df26cacSmrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 3056df26cacSmrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 3066df26cacSmrg fi 3076df26cacSmrg # If the file does not exist, the user really needs makeinfo; 3086df26cacSmrg # let's fail without touching anything. 3096df26cacSmrg test -f $file || exit 1 3106df26cacSmrg touch $file 3116df26cacSmrg ;; 3126df26cacSmrg 3136df26cacSmrg tar) 3146df26cacSmrg shift 3156df26cacSmrg 3166df26cacSmrg # We have already tried tar in the generic part. 3176df26cacSmrg # Look for gnutar/gtar before invocation to avoid ugly error 3186df26cacSmrg # messages. 3196df26cacSmrg if (gnutar --version > /dev/null 2>&1); then 3206df26cacSmrg gnutar "$@" && exit 0 3216df26cacSmrg fi 3226df26cacSmrg if (gtar --version > /dev/null 2>&1); then 3236df26cacSmrg gtar "$@" && exit 0 3246df26cacSmrg fi 3256df26cacSmrg firstarg="$1" 3266df26cacSmrg if shift; then 3276df26cacSmrg case $firstarg in 3286df26cacSmrg *o*) 3296df26cacSmrg firstarg=`echo "$firstarg" | sed s/o//` 3306df26cacSmrg tar "$firstarg" "$@" && exit 0 3316df26cacSmrg ;; 3326df26cacSmrg esac 3336df26cacSmrg case $firstarg in 3346df26cacSmrg *h*) 3356df26cacSmrg firstarg=`echo "$firstarg" | sed s/h//` 3366df26cacSmrg tar "$firstarg" "$@" && exit 0 3376df26cacSmrg ;; 3386df26cacSmrg esac 3396df26cacSmrg fi 3406df26cacSmrg 3416df26cacSmrg echo 1>&2 "\ 3426df26cacSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 3436df26cacSmrg You may want to install GNU tar or Free paxutils, or check the 3446df26cacSmrg command line arguments." 3456df26cacSmrg exit 1 3466df26cacSmrg ;; 3476df26cacSmrg 3486df26cacSmrg *) 3496df26cacSmrg echo 1>&2 "\ 3506df26cacSmrgWARNING: \`$1' is needed, and is $msg. 3516df26cacSmrg You might have modified some files without having the 3526df26cacSmrg proper tools for further handling them. Check the \`README' file, 3536df26cacSmrg it often tells you about the needed prerequisites for installing 3546df26cacSmrg this package. You may also peek at any GNU archive site, in case 3556df26cacSmrg some other package would contain this missing \`$1' program." 3566df26cacSmrg exit 1 3576df26cacSmrg ;; 3586df26cacSmrgesac 3596df26cacSmrg 3606df26cacSmrgexit 0 3616df26cacSmrg 3626df26cacSmrg# Local variables: 3636df26cacSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 3646df26cacSmrg# time-stamp-start: "scriptversion=" 3656df26cacSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 3666df26cacSmrg# time-stamp-end: "$" 3676df26cacSmrg# End: 368