missing revision a6844aab
12c393a42Smrg#! /bin/sh 22c393a42Smrg# Common stub for a few missing GNU programs while installing. 32c393a42Smrg 4a6844aabSmrgscriptversion=2009-04-28.21; # UTC 52c393a42Smrg 6a6844aabSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 7a6844aabSmrg# 2008, 2009 Free Software Foundation, Inc. 82c393a42Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 92c393a42Smrg 102c393a42Smrg# This program is free software; you can redistribute it and/or modify 112c393a42Smrg# it under the terms of the GNU General Public License as published by 122c393a42Smrg# the Free Software Foundation; either version 2, or (at your option) 132c393a42Smrg# any later version. 142c393a42Smrg 152c393a42Smrg# This program is distributed in the hope that it will be useful, 162c393a42Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 172c393a42Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 182c393a42Smrg# GNU General Public License for more details. 192c393a42Smrg 202c393a42Smrg# You should have received a copy of the GNU General Public License 21a6844aabSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 222c393a42Smrg 232c393a42Smrg# As a special exception to the GNU General Public License, if you 242c393a42Smrg# distribute this file as part of a program that contains a 252c393a42Smrg# configuration script generated by Autoconf, you may include it under 262c393a42Smrg# the same distribution terms that you use for the rest of that program. 272c393a42Smrg 282c393a42Smrgif test $# -eq 0; then 292c393a42Smrg echo 1>&2 "Try \`$0 --help' for more information" 302c393a42Smrg exit 1 312c393a42Smrgfi 322c393a42Smrg 332c393a42Smrgrun=: 34a6844aabSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 35a6844aabSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 362c393a42Smrg 372c393a42Smrg# In the cases where this matters, `missing' is being run in the 382c393a42Smrg# srcdir already. 392c393a42Smrgif test -f configure.ac; then 402c393a42Smrg configure_ac=configure.ac 412c393a42Smrgelse 422c393a42Smrg configure_ac=configure.in 432c393a42Smrgfi 442c393a42Smrg 452c393a42Smrgmsg="missing on your system" 462c393a42Smrg 47a6844aabSmrgcase $1 in 482c393a42Smrg--run) 492c393a42Smrg # Try to run requested program, and just exit if it succeeds. 502c393a42Smrg run= 512c393a42Smrg shift 522c393a42Smrg "$@" && exit 0 532c393a42Smrg # Exit code 63 means version mismatch. This often happens 542c393a42Smrg # when the user try to use an ancient version of a tool on 552c393a42Smrg # a file that requires a minimum version. In this case we 562c393a42Smrg # we should proceed has if the program had been absent, or 572c393a42Smrg # if --run hadn't been passed. 582c393a42Smrg if test $? = 63; then 592c393a42Smrg run=: 602c393a42Smrg msg="probably too old" 612c393a42Smrg fi 622c393a42Smrg ;; 632c393a42Smrg 642c393a42Smrg -h|--h|--he|--hel|--help) 652c393a42Smrg echo "\ 662c393a42Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 672c393a42Smrg 682c393a42SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 692c393a42Smrgerror status if there is no known handling for PROGRAM. 702c393a42Smrg 712c393a42SmrgOptions: 722c393a42Smrg -h, --help display this help and exit 732c393a42Smrg -v, --version output version information and exit 742c393a42Smrg --run try to run the given command, and emulate it if it fails 752c393a42Smrg 762c393a42SmrgSupported PROGRAM values: 772c393a42Smrg aclocal touch file \`aclocal.m4' 782c393a42Smrg autoconf touch file \`configure' 792c393a42Smrg autoheader touch file \`config.h.in' 80a6844aabSmrg autom4te touch the output file, or create a stub one 812c393a42Smrg automake touch all \`Makefile.in' files 822c393a42Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 832c393a42Smrg flex create \`lex.yy.c', if possible, from existing .c 842c393a42Smrg help2man touch the output file 852c393a42Smrg lex create \`lex.yy.c', if possible, from existing .c 862c393a42Smrg makeinfo touch the output file 872c393a42Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 882c393a42Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 892c393a42Smrg 90a6844aabSmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 91a6844aabSmrg\`g' are ignored when checking the name. 92a6844aabSmrg 932c393a42SmrgSend bug reports to <bug-automake@gnu.org>." 942c393a42Smrg exit $? 952c393a42Smrg ;; 962c393a42Smrg 972c393a42Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 982c393a42Smrg echo "missing $scriptversion (GNU Automake)" 992c393a42Smrg exit $? 1002c393a42Smrg ;; 1012c393a42Smrg 1022c393a42Smrg -*) 1032c393a42Smrg echo 1>&2 "$0: Unknown \`$1' option" 1042c393a42Smrg echo 1>&2 "Try \`$0 --help' for more information" 1052c393a42Smrg exit 1 1062c393a42Smrg ;; 1072c393a42Smrg 1082c393a42Smrgesac 1092c393a42Smrg 110a6844aabSmrg# normalize program name to check for. 111a6844aabSmrgprogram=`echo "$1" | sed ' 112a6844aabSmrg s/^gnu-//; t 113a6844aabSmrg s/^gnu//; t 114a6844aabSmrg s/^g//; t'` 115a6844aabSmrg 1162c393a42Smrg# Now exit if we have it, but it failed. Also exit now if we 1172c393a42Smrg# don't have it and --version was passed (most likely to detect 118a6844aabSmrg# the program). This is about non-GNU programs, so use $1 not 119a6844aabSmrg# $program. 120a6844aabSmrgcase $1 in 121a6844aabSmrg lex*|yacc*) 1222c393a42Smrg # Not GNU programs, they don't have --version. 1232c393a42Smrg ;; 1242c393a42Smrg 125a6844aabSmrg tar*) 1262c393a42Smrg if test -n "$run"; then 1272c393a42Smrg echo 1>&2 "ERROR: \`tar' requires --run" 1282c393a42Smrg exit 1 1292c393a42Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1302c393a42Smrg exit 1 1312c393a42Smrg fi 1322c393a42Smrg ;; 1332c393a42Smrg 1342c393a42Smrg *) 1352c393a42Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 1362c393a42Smrg # We have it, but it failed. 1372c393a42Smrg exit 1 1382c393a42Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1392c393a42Smrg # Could not run --version or --help. This is probably someone 1402c393a42Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 1412c393a42Smrg # $TOOL exists and not knowing $TOOL uses missing. 1422c393a42Smrg exit 1 1432c393a42Smrg fi 1442c393a42Smrg ;; 1452c393a42Smrgesac 1462c393a42Smrg 1472c393a42Smrg# If it does not exist, or fails to run (possibly an outdated version), 1482c393a42Smrg# try to emulate it. 149a6844aabSmrgcase $program in 1502c393a42Smrg aclocal*) 1512c393a42Smrg echo 1>&2 "\ 1522c393a42SmrgWARNING: \`$1' is $msg. You should only need it if 1532c393a42Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 1542c393a42Smrg to install the \`Automake' and \`Perl' packages. Grab them from 1552c393a42Smrg any GNU archive site." 1562c393a42Smrg touch aclocal.m4 1572c393a42Smrg ;; 1582c393a42Smrg 159a6844aabSmrg autoconf*) 1602c393a42Smrg echo 1>&2 "\ 1612c393a42SmrgWARNING: \`$1' is $msg. You should only need it if 1622c393a42Smrg you modified \`${configure_ac}'. You might want to install the 1632c393a42Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 1642c393a42Smrg archive site." 1652c393a42Smrg touch configure 1662c393a42Smrg ;; 1672c393a42Smrg 168a6844aabSmrg autoheader*) 1692c393a42Smrg echo 1>&2 "\ 1702c393a42SmrgWARNING: \`$1' is $msg. You should only need it if 1712c393a42Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 1722c393a42Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 1732c393a42Smrg from any GNU archive site." 1742c393a42Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 1752c393a42Smrg test -z "$files" && files="config.h" 1762c393a42Smrg touch_files= 1772c393a42Smrg for f in $files; do 178a6844aabSmrg case $f in 1792c393a42Smrg *:*) touch_files="$touch_files "`echo "$f" | 1802c393a42Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 1812c393a42Smrg *) touch_files="$touch_files $f.in";; 1822c393a42Smrg esac 1832c393a42Smrg done 1842c393a42Smrg touch $touch_files 1852c393a42Smrg ;; 1862c393a42Smrg 1872c393a42Smrg automake*) 1882c393a42Smrg echo 1>&2 "\ 1892c393a42SmrgWARNING: \`$1' is $msg. You should only need it if 1902c393a42Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 1912c393a42Smrg You might want to install the \`Automake' and \`Perl' packages. 1922c393a42Smrg Grab them from any GNU archive site." 1932c393a42Smrg find . -type f -name Makefile.am -print | 1942c393a42Smrg sed 's/\.am$/.in/' | 1952c393a42Smrg while read f; do touch "$f"; done 1962c393a42Smrg ;; 1972c393a42Smrg 198a6844aabSmrg autom4te*) 1992c393a42Smrg echo 1>&2 "\ 2002c393a42SmrgWARNING: \`$1' is needed, but is $msg. 2012c393a42Smrg You might have modified some files without having the 2022c393a42Smrg proper tools for further handling them. 2032c393a42Smrg You can get \`$1' as part of \`Autoconf' from any GNU 2042c393a42Smrg archive site." 2052c393a42Smrg 206a6844aabSmrg file=`echo "$*" | sed -n "$sed_output"` 207a6844aabSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2082c393a42Smrg if test -f "$file"; then 2092c393a42Smrg touch $file 2102c393a42Smrg else 2112c393a42Smrg test -z "$file" || exec >$file 2122c393a42Smrg echo "#! /bin/sh" 2132c393a42Smrg echo "# Created by GNU Automake missing as a replacement of" 2142c393a42Smrg echo "# $ $@" 2152c393a42Smrg echo "exit 0" 2162c393a42Smrg chmod +x $file 2172c393a42Smrg exit 1 2182c393a42Smrg fi 2192c393a42Smrg ;; 2202c393a42Smrg 221a6844aabSmrg bison*|yacc*) 2222c393a42Smrg echo 1>&2 "\ 2232c393a42SmrgWARNING: \`$1' $msg. You should only need it if 2242c393a42Smrg you modified a \`.y' file. You may need the \`Bison' package 2252c393a42Smrg in order for those modifications to take effect. You can get 2262c393a42Smrg \`Bison' from any GNU archive site." 2272c393a42Smrg rm -f y.tab.c y.tab.h 228a6844aabSmrg if test $# -ne 1; then 2292c393a42Smrg eval LASTARG="\${$#}" 230a6844aabSmrg case $LASTARG in 2312c393a42Smrg *.y) 2322c393a42Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 233a6844aabSmrg if test -f "$SRCFILE"; then 2342c393a42Smrg cp "$SRCFILE" y.tab.c 2352c393a42Smrg fi 2362c393a42Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 237a6844aabSmrg if test -f "$SRCFILE"; then 2382c393a42Smrg cp "$SRCFILE" y.tab.h 2392c393a42Smrg fi 2402c393a42Smrg ;; 2412c393a42Smrg esac 2422c393a42Smrg fi 243a6844aabSmrg if test ! -f y.tab.h; then 2442c393a42Smrg echo >y.tab.h 2452c393a42Smrg fi 246a6844aabSmrg if test ! -f y.tab.c; then 2472c393a42Smrg echo 'main() { return 0; }' >y.tab.c 2482c393a42Smrg fi 2492c393a42Smrg ;; 2502c393a42Smrg 251a6844aabSmrg lex*|flex*) 2522c393a42Smrg echo 1>&2 "\ 2532c393a42SmrgWARNING: \`$1' is $msg. You should only need it if 2542c393a42Smrg you modified a \`.l' file. You may need the \`Flex' package 2552c393a42Smrg in order for those modifications to take effect. You can get 2562c393a42Smrg \`Flex' from any GNU archive site." 2572c393a42Smrg rm -f lex.yy.c 258a6844aabSmrg if test $# -ne 1; then 2592c393a42Smrg eval LASTARG="\${$#}" 260a6844aabSmrg case $LASTARG in 2612c393a42Smrg *.l) 2622c393a42Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 263a6844aabSmrg if test -f "$SRCFILE"; then 2642c393a42Smrg cp "$SRCFILE" lex.yy.c 2652c393a42Smrg fi 2662c393a42Smrg ;; 2672c393a42Smrg esac 2682c393a42Smrg fi 269a6844aabSmrg if test ! -f lex.yy.c; then 2702c393a42Smrg echo 'main() { return 0; }' >lex.yy.c 2712c393a42Smrg fi 2722c393a42Smrg ;; 2732c393a42Smrg 274a6844aabSmrg help2man*) 2752c393a42Smrg echo 1>&2 "\ 2762c393a42SmrgWARNING: \`$1' is $msg. You should only need it if 2772c393a42Smrg you modified a dependency of a manual page. You may need the 2782c393a42Smrg \`Help2man' package in order for those modifications to take 2792c393a42Smrg effect. You can get \`Help2man' from any GNU archive site." 2802c393a42Smrg 281a6844aabSmrg file=`echo "$*" | sed -n "$sed_output"` 282a6844aabSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 283a6844aabSmrg if test -f "$file"; then 2842c393a42Smrg touch $file 2852c393a42Smrg else 2862c393a42Smrg test -z "$file" || exec >$file 2872c393a42Smrg echo ".ab help2man is required to generate this page" 288a6844aabSmrg exit $? 2892c393a42Smrg fi 2902c393a42Smrg ;; 2912c393a42Smrg 292a6844aabSmrg makeinfo*) 2932c393a42Smrg echo 1>&2 "\ 2942c393a42SmrgWARNING: \`$1' is $msg. You should only need it if 2952c393a42Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 2962c393a42Smrg indirectly affecting the aspect of the manual. The spurious 2972c393a42Smrg call might also be the consequence of using a buggy \`make' (AIX, 2982c393a42Smrg DU, IRIX). You might want to install the \`Texinfo' package or 2992c393a42Smrg the \`GNU make' package. Grab either from any GNU archive site." 3002c393a42Smrg # The file to touch is that specified with -o ... 301a6844aabSmrg file=`echo "$*" | sed -n "$sed_output"` 302a6844aabSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 3032c393a42Smrg if test -z "$file"; then 3042c393a42Smrg # ... or it is the one specified with @setfilename ... 3052c393a42Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 306a6844aabSmrg file=`sed -n ' 307a6844aabSmrg /^@setfilename/{ 308a6844aabSmrg s/.* \([^ ]*\) *$/\1/ 309a6844aabSmrg p 310a6844aabSmrg q 311a6844aabSmrg }' $infile` 3122c393a42Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 3132c393a42Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 3142c393a42Smrg fi 3152c393a42Smrg # If the file does not exist, the user really needs makeinfo; 3162c393a42Smrg # let's fail without touching anything. 3172c393a42Smrg test -f $file || exit 1 3182c393a42Smrg touch $file 3192c393a42Smrg ;; 3202c393a42Smrg 321a6844aabSmrg tar*) 3222c393a42Smrg shift 3232c393a42Smrg 3242c393a42Smrg # We have already tried tar in the generic part. 3252c393a42Smrg # Look for gnutar/gtar before invocation to avoid ugly error 3262c393a42Smrg # messages. 3272c393a42Smrg if (gnutar --version > /dev/null 2>&1); then 3282c393a42Smrg gnutar "$@" && exit 0 3292c393a42Smrg fi 3302c393a42Smrg if (gtar --version > /dev/null 2>&1); then 3312c393a42Smrg gtar "$@" && exit 0 3322c393a42Smrg fi 3332c393a42Smrg firstarg="$1" 3342c393a42Smrg if shift; then 335a6844aabSmrg case $firstarg in 3362c393a42Smrg *o*) 3372c393a42Smrg firstarg=`echo "$firstarg" | sed s/o//` 3382c393a42Smrg tar "$firstarg" "$@" && exit 0 3392c393a42Smrg ;; 3402c393a42Smrg esac 341a6844aabSmrg case $firstarg in 3422c393a42Smrg *h*) 3432c393a42Smrg firstarg=`echo "$firstarg" | sed s/h//` 3442c393a42Smrg tar "$firstarg" "$@" && exit 0 3452c393a42Smrg ;; 3462c393a42Smrg esac 3472c393a42Smrg fi 3482c393a42Smrg 3492c393a42Smrg echo 1>&2 "\ 3502c393a42SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 3512c393a42Smrg You may want to install GNU tar or Free paxutils, or check the 3522c393a42Smrg command line arguments." 3532c393a42Smrg exit 1 3542c393a42Smrg ;; 3552c393a42Smrg 3562c393a42Smrg *) 3572c393a42Smrg echo 1>&2 "\ 3582c393a42SmrgWARNING: \`$1' is needed, and is $msg. 3592c393a42Smrg You might have modified some files without having the 3602c393a42Smrg proper tools for further handling them. Check the \`README' file, 3612c393a42Smrg it often tells you about the needed prerequisites for installing 3622c393a42Smrg this package. You may also peek at any GNU archive site, in case 3632c393a42Smrg some other package would contain this missing \`$1' program." 3642c393a42Smrg exit 1 3652c393a42Smrg ;; 3662c393a42Smrgesac 3672c393a42Smrg 3682c393a42Smrgexit 0 3692c393a42Smrg 3702c393a42Smrg# Local variables: 3712c393a42Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 3722c393a42Smrg# time-stamp-start: "scriptversion=" 3732c393a42Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 374a6844aabSmrg# time-stamp-time-zone: "UTC" 375a6844aabSmrg# time-stamp-end: "; # UTC" 3762c393a42Smrg# End: 377