missing revision 8650bb69
12c7c4e3dSmrg#! /bin/sh 22c7c4e3dSmrg# Common stub for a few missing GNU programs while installing. 38650bb69Smrg 48650bb69Smrgscriptversion=2009-04-28.21; # UTC 58650bb69Smrg 68650bb69Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 78650bb69Smrg# 2008, 2009 Free Software Foundation, Inc. 82c7c4e3dSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 92c7c4e3dSmrg 102c7c4e3dSmrg# This program is free software; you can redistribute it and/or modify 112c7c4e3dSmrg# it under the terms of the GNU General Public License as published by 122c7c4e3dSmrg# the Free Software Foundation; either version 2, or (at your option) 132c7c4e3dSmrg# any later version. 142c7c4e3dSmrg 152c7c4e3dSmrg# This program is distributed in the hope that it will be useful, 162c7c4e3dSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 172c7c4e3dSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 182c7c4e3dSmrg# GNU General Public License for more details. 192c7c4e3dSmrg 202c7c4e3dSmrg# You should have received a copy of the GNU General Public License 218650bb69Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 222c7c4e3dSmrg 232c7c4e3dSmrg# As a special exception to the GNU General Public License, if you 242c7c4e3dSmrg# distribute this file as part of a program that contains a 252c7c4e3dSmrg# configuration script generated by Autoconf, you may include it under 262c7c4e3dSmrg# the same distribution terms that you use for the rest of that program. 272c7c4e3dSmrg 282c7c4e3dSmrgif test $# -eq 0; then 292c7c4e3dSmrg echo 1>&2 "Try \`$0 --help' for more information" 302c7c4e3dSmrg exit 1 312c7c4e3dSmrgfi 322c7c4e3dSmrg 332c7c4e3dSmrgrun=: 348650bb69Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 358650bb69Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 362c7c4e3dSmrg 372c7c4e3dSmrg# In the cases where this matters, `missing' is being run in the 382c7c4e3dSmrg# srcdir already. 392c7c4e3dSmrgif test -f configure.ac; then 402c7c4e3dSmrg configure_ac=configure.ac 412c7c4e3dSmrgelse 422c7c4e3dSmrg configure_ac=configure.in 432c7c4e3dSmrgfi 442c7c4e3dSmrg 458650bb69Smrgmsg="missing on your system" 468650bb69Smrg 478650bb69Smrgcase $1 in 482c7c4e3dSmrg--run) 492c7c4e3dSmrg # Try to run requested program, and just exit if it succeeds. 502c7c4e3dSmrg run= 512c7c4e3dSmrg shift 522c7c4e3dSmrg "$@" && exit 0 538650bb69Smrg # Exit code 63 means version mismatch. This often happens 548650bb69Smrg # when the user try to use an ancient version of a tool on 558650bb69Smrg # a file that requires a minimum version. In this case we 568650bb69Smrg # we should proceed has if the program had been absent, or 578650bb69Smrg # if --run hadn't been passed. 588650bb69Smrg if test $? = 63; then 598650bb69Smrg run=: 608650bb69Smrg msg="probably too old" 618650bb69Smrg fi 622c7c4e3dSmrg ;; 632c7c4e3dSmrg 642c7c4e3dSmrg -h|--h|--he|--hel|--help) 652c7c4e3dSmrg echo "\ 662c7c4e3dSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 672c7c4e3dSmrg 682c7c4e3dSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 692c7c4e3dSmrgerror status if there is no known handling for PROGRAM. 702c7c4e3dSmrg 712c7c4e3dSmrgOptions: 722c7c4e3dSmrg -h, --help display this help and exit 732c7c4e3dSmrg -v, --version output version information and exit 742c7c4e3dSmrg --run try to run the given command, and emulate it if it fails 752c7c4e3dSmrg 762c7c4e3dSmrgSupported PROGRAM values: 772c7c4e3dSmrg aclocal touch file \`aclocal.m4' 782c7c4e3dSmrg autoconf touch file \`configure' 792c7c4e3dSmrg autoheader touch file \`config.h.in' 808650bb69Smrg autom4te touch the output file, or create a stub one 812c7c4e3dSmrg automake touch all \`Makefile.in' files 822c7c4e3dSmrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 832c7c4e3dSmrg flex create \`lex.yy.c', if possible, from existing .c 842c7c4e3dSmrg help2man touch the output file 852c7c4e3dSmrg lex create \`lex.yy.c', if possible, from existing .c 862c7c4e3dSmrg makeinfo touch the output file 872c7c4e3dSmrg tar try tar, gnutar, gtar, then tar without non-portable flags 888650bb69Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 898650bb69Smrg 908650bb69SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 918650bb69Smrg\`g' are ignored when checking the name. 928650bb69Smrg 938650bb69SmrgSend bug reports to <bug-automake@gnu.org>." 948650bb69Smrg exit $? 952c7c4e3dSmrg ;; 962c7c4e3dSmrg 972c7c4e3dSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 988650bb69Smrg echo "missing $scriptversion (GNU Automake)" 998650bb69Smrg exit $? 1002c7c4e3dSmrg ;; 1012c7c4e3dSmrg 1022c7c4e3dSmrg -*) 1032c7c4e3dSmrg echo 1>&2 "$0: Unknown \`$1' option" 1042c7c4e3dSmrg echo 1>&2 "Try \`$0 --help' for more information" 1052c7c4e3dSmrg exit 1 1062c7c4e3dSmrg ;; 1072c7c4e3dSmrg 1088650bb69Smrgesac 1098650bb69Smrg 1108650bb69Smrg# normalize program name to check for. 1118650bb69Smrgprogram=`echo "$1" | sed ' 1128650bb69Smrg s/^gnu-//; t 1138650bb69Smrg s/^gnu//; t 1148650bb69Smrg s/^g//; t'` 1158650bb69Smrg 1168650bb69Smrg# Now exit if we have it, but it failed. Also exit now if we 1178650bb69Smrg# don't have it and --version was passed (most likely to detect 1188650bb69Smrg# the program). This is about non-GNU programs, so use $1 not 1198650bb69Smrg# $program. 1208650bb69Smrgcase $1 in 1218650bb69Smrg lex*|yacc*) 1228650bb69Smrg # Not GNU programs, they don't have --version. 1238650bb69Smrg ;; 1248650bb69Smrg 1258650bb69Smrg tar*) 1268650bb69Smrg if test -n "$run"; then 1278650bb69Smrg echo 1>&2 "ERROR: \`tar' requires --run" 1288650bb69Smrg exit 1 1298650bb69Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1308650bb69Smrg exit 1 1318650bb69Smrg fi 1328650bb69Smrg ;; 1338650bb69Smrg 1348650bb69Smrg *) 1352c7c4e3dSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 1362c7c4e3dSmrg # We have it, but it failed. 1372c7c4e3dSmrg exit 1 1388650bb69Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1398650bb69Smrg # Could not run --version or --help. This is probably someone 1408650bb69Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 1418650bb69Smrg # $TOOL exists and not knowing $TOOL uses missing. 1428650bb69Smrg exit 1 1432c7c4e3dSmrg fi 1448650bb69Smrg ;; 1458650bb69Smrgesac 1462c7c4e3dSmrg 1478650bb69Smrg# If it does not exist, or fails to run (possibly an outdated version), 1488650bb69Smrg# try to emulate it. 1498650bb69Smrgcase $program in 1508650bb69Smrg aclocal*) 1512c7c4e3dSmrg echo 1>&2 "\ 1528650bb69SmrgWARNING: \`$1' is $msg. You should only need it if 1532c7c4e3dSmrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 1542c7c4e3dSmrg to install the \`Automake' and \`Perl' packages. Grab them from 1552c7c4e3dSmrg any GNU archive site." 1562c7c4e3dSmrg touch aclocal.m4 1572c7c4e3dSmrg ;; 1582c7c4e3dSmrg 1598650bb69Smrg autoconf*) 1602c7c4e3dSmrg echo 1>&2 "\ 1618650bb69SmrgWARNING: \`$1' is $msg. You should only need it if 1622c7c4e3dSmrg you modified \`${configure_ac}'. You might want to install the 1632c7c4e3dSmrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 1642c7c4e3dSmrg archive site." 1652c7c4e3dSmrg touch configure 1662c7c4e3dSmrg ;; 1672c7c4e3dSmrg 1688650bb69Smrg autoheader*) 1692c7c4e3dSmrg echo 1>&2 "\ 1708650bb69SmrgWARNING: \`$1' is $msg. You should only need it if 1712c7c4e3dSmrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 1722c7c4e3dSmrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 1732c7c4e3dSmrg from any GNU archive site." 1742c7c4e3dSmrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 1752c7c4e3dSmrg test -z "$files" && files="config.h" 1762c7c4e3dSmrg touch_files= 1772c7c4e3dSmrg for f in $files; do 1788650bb69Smrg case $f in 1792c7c4e3dSmrg *:*) touch_files="$touch_files "`echo "$f" | 1802c7c4e3dSmrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 1812c7c4e3dSmrg *) touch_files="$touch_files $f.in";; 1822c7c4e3dSmrg esac 1832c7c4e3dSmrg done 1842c7c4e3dSmrg touch $touch_files 1852c7c4e3dSmrg ;; 1862c7c4e3dSmrg 1872c7c4e3dSmrg automake*) 1882c7c4e3dSmrg echo 1>&2 "\ 1898650bb69SmrgWARNING: \`$1' is $msg. You should only need it if 1902c7c4e3dSmrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 1912c7c4e3dSmrg You might want to install the \`Automake' and \`Perl' packages. 1922c7c4e3dSmrg Grab them from any GNU archive site." 1932c7c4e3dSmrg find . -type f -name Makefile.am -print | 1942c7c4e3dSmrg sed 's/\.am$/.in/' | 1952c7c4e3dSmrg while read f; do touch "$f"; done 1962c7c4e3dSmrg ;; 1972c7c4e3dSmrg 1988650bb69Smrg autom4te*) 1992c7c4e3dSmrg echo 1>&2 "\ 2008650bb69SmrgWARNING: \`$1' is needed, but is $msg. 2018650bb69Smrg You might have modified some files without having the 2022c7c4e3dSmrg proper tools for further handling them. 2032c7c4e3dSmrg You can get \`$1' as part of \`Autoconf' from any GNU 2042c7c4e3dSmrg archive site." 2052c7c4e3dSmrg 2068650bb69Smrg file=`echo "$*" | sed -n "$sed_output"` 2078650bb69Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2082c7c4e3dSmrg if test -f "$file"; then 2092c7c4e3dSmrg touch $file 2102c7c4e3dSmrg else 2112c7c4e3dSmrg test -z "$file" || exec >$file 2122c7c4e3dSmrg echo "#! /bin/sh" 2132c7c4e3dSmrg echo "# Created by GNU Automake missing as a replacement of" 2142c7c4e3dSmrg echo "# $ $@" 2152c7c4e3dSmrg echo "exit 0" 2162c7c4e3dSmrg chmod +x $file 2172c7c4e3dSmrg exit 1 2182c7c4e3dSmrg fi 2192c7c4e3dSmrg ;; 2202c7c4e3dSmrg 2218650bb69Smrg bison*|yacc*) 2222c7c4e3dSmrg echo 1>&2 "\ 2238650bb69SmrgWARNING: \`$1' $msg. You should only need it if 2242c7c4e3dSmrg you modified a \`.y' file. You may need the \`Bison' package 2252c7c4e3dSmrg in order for those modifications to take effect. You can get 2262c7c4e3dSmrg \`Bison' from any GNU archive site." 2272c7c4e3dSmrg rm -f y.tab.c y.tab.h 2288650bb69Smrg if test $# -ne 1; then 2292c7c4e3dSmrg eval LASTARG="\${$#}" 2308650bb69Smrg case $LASTARG in 2312c7c4e3dSmrg *.y) 2322c7c4e3dSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 2338650bb69Smrg if test -f "$SRCFILE"; then 2342c7c4e3dSmrg cp "$SRCFILE" y.tab.c 2352c7c4e3dSmrg fi 2362c7c4e3dSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 2378650bb69Smrg if test -f "$SRCFILE"; then 2382c7c4e3dSmrg cp "$SRCFILE" y.tab.h 2392c7c4e3dSmrg fi 2402c7c4e3dSmrg ;; 2412c7c4e3dSmrg esac 2422c7c4e3dSmrg fi 2438650bb69Smrg if test ! -f y.tab.h; then 2442c7c4e3dSmrg echo >y.tab.h 2452c7c4e3dSmrg fi 2468650bb69Smrg if test ! -f y.tab.c; then 2472c7c4e3dSmrg echo 'main() { return 0; }' >y.tab.c 2482c7c4e3dSmrg fi 2492c7c4e3dSmrg ;; 2502c7c4e3dSmrg 2518650bb69Smrg lex*|flex*) 2522c7c4e3dSmrg echo 1>&2 "\ 2538650bb69SmrgWARNING: \`$1' is $msg. You should only need it if 2542c7c4e3dSmrg you modified a \`.l' file. You may need the \`Flex' package 2552c7c4e3dSmrg in order for those modifications to take effect. You can get 2562c7c4e3dSmrg \`Flex' from any GNU archive site." 2572c7c4e3dSmrg rm -f lex.yy.c 2588650bb69Smrg if test $# -ne 1; then 2592c7c4e3dSmrg eval LASTARG="\${$#}" 2608650bb69Smrg case $LASTARG in 2612c7c4e3dSmrg *.l) 2622c7c4e3dSmrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 2638650bb69Smrg if test -f "$SRCFILE"; then 2642c7c4e3dSmrg cp "$SRCFILE" lex.yy.c 2652c7c4e3dSmrg fi 2662c7c4e3dSmrg ;; 2672c7c4e3dSmrg esac 2682c7c4e3dSmrg fi 2698650bb69Smrg if test ! -f lex.yy.c; then 2702c7c4e3dSmrg echo 'main() { return 0; }' >lex.yy.c 2712c7c4e3dSmrg fi 2722c7c4e3dSmrg ;; 2732c7c4e3dSmrg 2748650bb69Smrg help2man*) 2752c7c4e3dSmrg echo 1>&2 "\ 2768650bb69SmrgWARNING: \`$1' is $msg. You should only need it if 2772c7c4e3dSmrg you modified a dependency of a manual page. You may need the 2782c7c4e3dSmrg \`Help2man' package in order for those modifications to take 2792c7c4e3dSmrg effect. You can get \`Help2man' from any GNU archive site." 2802c7c4e3dSmrg 2818650bb69Smrg file=`echo "$*" | sed -n "$sed_output"` 2828650bb69Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2838650bb69Smrg if test -f "$file"; then 2842c7c4e3dSmrg touch $file 2852c7c4e3dSmrg else 2862c7c4e3dSmrg test -z "$file" || exec >$file 2872c7c4e3dSmrg echo ".ab help2man is required to generate this page" 2888650bb69Smrg exit $? 2892c7c4e3dSmrg fi 2902c7c4e3dSmrg ;; 2912c7c4e3dSmrg 2928650bb69Smrg makeinfo*) 2932c7c4e3dSmrg echo 1>&2 "\ 2948650bb69SmrgWARNING: \`$1' is $msg. You should only need it if 2952c7c4e3dSmrg you modified a \`.texi' or \`.texinfo' file, or any other file 2962c7c4e3dSmrg indirectly affecting the aspect of the manual. The spurious 2972c7c4e3dSmrg call might also be the consequence of using a buggy \`make' (AIX, 2982c7c4e3dSmrg DU, IRIX). You might want to install the \`Texinfo' package or 2992c7c4e3dSmrg the \`GNU make' package. Grab either from any GNU archive site." 3008650bb69Smrg # The file to touch is that specified with -o ... 3018650bb69Smrg file=`echo "$*" | sed -n "$sed_output"` 3028650bb69Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 3032c7c4e3dSmrg if test -z "$file"; then 3048650bb69Smrg # ... or it is the one specified with @setfilename ... 3058650bb69Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 3068650bb69Smrg file=`sed -n ' 3078650bb69Smrg /^@setfilename/{ 3088650bb69Smrg s/.* \([^ ]*\) *$/\1/ 3098650bb69Smrg p 3108650bb69Smrg q 3118650bb69Smrg }' $infile` 3128650bb69Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 3138650bb69Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 3142c7c4e3dSmrg fi 3158650bb69Smrg # If the file does not exist, the user really needs makeinfo; 3168650bb69Smrg # let's fail without touching anything. 3178650bb69Smrg test -f $file || exit 1 3182c7c4e3dSmrg touch $file 3192c7c4e3dSmrg ;; 3202c7c4e3dSmrg 3218650bb69Smrg tar*) 3222c7c4e3dSmrg shift 3232c7c4e3dSmrg 3242c7c4e3dSmrg # We have already tried tar in the generic part. 3252c7c4e3dSmrg # Look for gnutar/gtar before invocation to avoid ugly error 3262c7c4e3dSmrg # messages. 3272c7c4e3dSmrg if (gnutar --version > /dev/null 2>&1); then 3282c7c4e3dSmrg gnutar "$@" && exit 0 3292c7c4e3dSmrg fi 3302c7c4e3dSmrg if (gtar --version > /dev/null 2>&1); then 3312c7c4e3dSmrg gtar "$@" && exit 0 3322c7c4e3dSmrg fi 3332c7c4e3dSmrg firstarg="$1" 3342c7c4e3dSmrg if shift; then 3358650bb69Smrg case $firstarg in 3362c7c4e3dSmrg *o*) 3372c7c4e3dSmrg firstarg=`echo "$firstarg" | sed s/o//` 3382c7c4e3dSmrg tar "$firstarg" "$@" && exit 0 3392c7c4e3dSmrg ;; 3402c7c4e3dSmrg esac 3418650bb69Smrg case $firstarg in 3422c7c4e3dSmrg *h*) 3432c7c4e3dSmrg firstarg=`echo "$firstarg" | sed s/h//` 3442c7c4e3dSmrg tar "$firstarg" "$@" && exit 0 3452c7c4e3dSmrg ;; 3462c7c4e3dSmrg esac 3472c7c4e3dSmrg fi 3482c7c4e3dSmrg 3492c7c4e3dSmrg echo 1>&2 "\ 3502c7c4e3dSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 3512c7c4e3dSmrg You may want to install GNU tar or Free paxutils, or check the 3522c7c4e3dSmrg command line arguments." 3532c7c4e3dSmrg exit 1 3542c7c4e3dSmrg ;; 3552c7c4e3dSmrg 3562c7c4e3dSmrg *) 3572c7c4e3dSmrg echo 1>&2 "\ 3588650bb69SmrgWARNING: \`$1' is needed, and is $msg. 3598650bb69Smrg You might have modified some files without having the 3602c7c4e3dSmrg proper tools for further handling them. Check the \`README' file, 3612c7c4e3dSmrg it often tells you about the needed prerequisites for installing 3622c7c4e3dSmrg this package. You may also peek at any GNU archive site, in case 3632c7c4e3dSmrg some other package would contain this missing \`$1' program." 3642c7c4e3dSmrg exit 1 3652c7c4e3dSmrg ;; 3662c7c4e3dSmrgesac 3672c7c4e3dSmrg 3682c7c4e3dSmrgexit 0 3698650bb69Smrg 3708650bb69Smrg# Local variables: 3718650bb69Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 3728650bb69Smrg# time-stamp-start: "scriptversion=" 3738650bb69Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 3748650bb69Smrg# time-stamp-time-zone: "UTC" 3758650bb69Smrg# time-stamp-end: "; # UTC" 3768650bb69Smrg# End: 377