missing revision 2c7c4e3d
12c7c4e3dSmrg#! /bin/sh 22c7c4e3dSmrg# Common stub for a few missing GNU programs while installing. 32c7c4e3dSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. 42c7c4e3dSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 52c7c4e3dSmrg 62c7c4e3dSmrg# This program is free software; you can redistribute it and/or modify 72c7c4e3dSmrg# it under the terms of the GNU General Public License as published by 82c7c4e3dSmrg# the Free Software Foundation; either version 2, or (at your option) 92c7c4e3dSmrg# any later version. 102c7c4e3dSmrg 112c7c4e3dSmrg# This program is distributed in the hope that it will be useful, 122c7c4e3dSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 132c7c4e3dSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 142c7c4e3dSmrg# GNU General Public License for more details. 152c7c4e3dSmrg 162c7c4e3dSmrg# You should have received a copy of the GNU General Public License 172c7c4e3dSmrg# along with this program; if not, write to the Free Software 182c7c4e3dSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 192c7c4e3dSmrg# 02111-1307, USA. 202c7c4e3dSmrg 212c7c4e3dSmrg# As a special exception to the GNU General Public License, if you 222c7c4e3dSmrg# distribute this file as part of a program that contains a 232c7c4e3dSmrg# configuration script generated by Autoconf, you may include it under 242c7c4e3dSmrg# the same distribution terms that you use for the rest of that program. 252c7c4e3dSmrg 262c7c4e3dSmrgif test $# -eq 0; then 272c7c4e3dSmrg echo 1>&2 "Try \`$0 --help' for more information" 282c7c4e3dSmrg exit 1 292c7c4e3dSmrgfi 302c7c4e3dSmrg 312c7c4e3dSmrgrun=: 322c7c4e3dSmrg 332c7c4e3dSmrg# In the cases where this matters, `missing' is being run in the 342c7c4e3dSmrg# srcdir already. 352c7c4e3dSmrgif test -f configure.ac; then 362c7c4e3dSmrg configure_ac=configure.ac 372c7c4e3dSmrgelse 382c7c4e3dSmrg configure_ac=configure.in 392c7c4e3dSmrgfi 402c7c4e3dSmrg 412c7c4e3dSmrgcase "$1" in 422c7c4e3dSmrg--run) 432c7c4e3dSmrg # Try to run requested program, and just exit if it succeeds. 442c7c4e3dSmrg run= 452c7c4e3dSmrg shift 462c7c4e3dSmrg "$@" && exit 0 472c7c4e3dSmrg ;; 482c7c4e3dSmrgesac 492c7c4e3dSmrg 502c7c4e3dSmrg# If it does not exist, or fails to run (possibly an outdated version), 512c7c4e3dSmrg# try to emulate it. 522c7c4e3dSmrgcase "$1" in 532c7c4e3dSmrg 542c7c4e3dSmrg -h|--h|--he|--hel|--help) 552c7c4e3dSmrg echo "\ 562c7c4e3dSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 572c7c4e3dSmrg 582c7c4e3dSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 592c7c4e3dSmrgerror status if there is no known handling for PROGRAM. 602c7c4e3dSmrg 612c7c4e3dSmrgOptions: 622c7c4e3dSmrg -h, --help display this help and exit 632c7c4e3dSmrg -v, --version output version information and exit 642c7c4e3dSmrg --run try to run the given command, and emulate it if it fails 652c7c4e3dSmrg 662c7c4e3dSmrgSupported PROGRAM values: 672c7c4e3dSmrg aclocal touch file \`aclocal.m4' 682c7c4e3dSmrg autoconf touch file \`configure' 692c7c4e3dSmrg autoheader touch file \`config.h.in' 702c7c4e3dSmrg automake touch all \`Makefile.in' files 712c7c4e3dSmrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 722c7c4e3dSmrg flex create \`lex.yy.c', if possible, from existing .c 732c7c4e3dSmrg help2man touch the output file 742c7c4e3dSmrg lex create \`lex.yy.c', if possible, from existing .c 752c7c4e3dSmrg makeinfo touch the output file 762c7c4e3dSmrg tar try tar, gnutar, gtar, then tar without non-portable flags 772c7c4e3dSmrg yacc create \`y.tab.[ch]', if possible, from existing .[ch]" 782c7c4e3dSmrg ;; 792c7c4e3dSmrg 802c7c4e3dSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 812c7c4e3dSmrg echo "missing 0.4 - GNU automake" 822c7c4e3dSmrg ;; 832c7c4e3dSmrg 842c7c4e3dSmrg -*) 852c7c4e3dSmrg echo 1>&2 "$0: Unknown \`$1' option" 862c7c4e3dSmrg echo 1>&2 "Try \`$0 --help' for more information" 872c7c4e3dSmrg exit 1 882c7c4e3dSmrg ;; 892c7c4e3dSmrg 902c7c4e3dSmrg aclocal*) 912c7c4e3dSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 922c7c4e3dSmrg # We have it, but it failed. 932c7c4e3dSmrg exit 1 942c7c4e3dSmrg fi 952c7c4e3dSmrg 962c7c4e3dSmrg echo 1>&2 "\ 972c7c4e3dSmrgWARNING: \`$1' is missing on your system. You should only need it if 982c7c4e3dSmrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 992c7c4e3dSmrg to install the \`Automake' and \`Perl' packages. Grab them from 1002c7c4e3dSmrg any GNU archive site." 1012c7c4e3dSmrg touch aclocal.m4 1022c7c4e3dSmrg ;; 1032c7c4e3dSmrg 1042c7c4e3dSmrg autoconf) 1052c7c4e3dSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 1062c7c4e3dSmrg # We have it, but it failed. 1072c7c4e3dSmrg exit 1 1082c7c4e3dSmrg fi 1092c7c4e3dSmrg 1102c7c4e3dSmrg echo 1>&2 "\ 1112c7c4e3dSmrgWARNING: \`$1' is missing on your system. You should only need it if 1122c7c4e3dSmrg you modified \`${configure_ac}'. You might want to install the 1132c7c4e3dSmrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 1142c7c4e3dSmrg archive site." 1152c7c4e3dSmrg touch configure 1162c7c4e3dSmrg ;; 1172c7c4e3dSmrg 1182c7c4e3dSmrg autoheader) 1192c7c4e3dSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 1202c7c4e3dSmrg # We have it, but it failed. 1212c7c4e3dSmrg exit 1 1222c7c4e3dSmrg fi 1232c7c4e3dSmrg 1242c7c4e3dSmrg echo 1>&2 "\ 1252c7c4e3dSmrgWARNING: \`$1' is missing on your system. You should only need it if 1262c7c4e3dSmrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 1272c7c4e3dSmrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 1282c7c4e3dSmrg from any GNU archive site." 1292c7c4e3dSmrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 1302c7c4e3dSmrg test -z "$files" && files="config.h" 1312c7c4e3dSmrg touch_files= 1322c7c4e3dSmrg for f in $files; do 1332c7c4e3dSmrg case "$f" in 1342c7c4e3dSmrg *:*) touch_files="$touch_files "`echo "$f" | 1352c7c4e3dSmrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 1362c7c4e3dSmrg *) touch_files="$touch_files $f.in";; 1372c7c4e3dSmrg esac 1382c7c4e3dSmrg done 1392c7c4e3dSmrg touch $touch_files 1402c7c4e3dSmrg ;; 1412c7c4e3dSmrg 1422c7c4e3dSmrg automake*) 1432c7c4e3dSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 1442c7c4e3dSmrg # We have it, but it failed. 1452c7c4e3dSmrg exit 1 1462c7c4e3dSmrg fi 1472c7c4e3dSmrg 1482c7c4e3dSmrg echo 1>&2 "\ 1492c7c4e3dSmrgWARNING: \`$1' is missing on your system. You should only need it if 1502c7c4e3dSmrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 1512c7c4e3dSmrg You might want to install the \`Automake' and \`Perl' packages. 1522c7c4e3dSmrg Grab them from any GNU archive site." 1532c7c4e3dSmrg find . -type f -name Makefile.am -print | 1542c7c4e3dSmrg sed 's/\.am$/.in/' | 1552c7c4e3dSmrg while read f; do touch "$f"; done 1562c7c4e3dSmrg ;; 1572c7c4e3dSmrg 1582c7c4e3dSmrg autom4te) 1592c7c4e3dSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 1602c7c4e3dSmrg # We have it, but it failed. 1612c7c4e3dSmrg exit 1 1622c7c4e3dSmrg fi 1632c7c4e3dSmrg 1642c7c4e3dSmrg echo 1>&2 "\ 1652c7c4e3dSmrgWARNING: \`$1' is needed, and you do not seem to have it handy on your 1662c7c4e3dSmrg system. You might have modified some files without having the 1672c7c4e3dSmrg proper tools for further handling them. 1682c7c4e3dSmrg You can get \`$1' as part of \`Autoconf' from any GNU 1692c7c4e3dSmrg archive site." 1702c7c4e3dSmrg 1712c7c4e3dSmrg file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 1722c7c4e3dSmrg test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 1732c7c4e3dSmrg if test -f "$file"; then 1742c7c4e3dSmrg touch $file 1752c7c4e3dSmrg else 1762c7c4e3dSmrg test -z "$file" || exec >$file 1772c7c4e3dSmrg echo "#! /bin/sh" 1782c7c4e3dSmrg echo "# Created by GNU Automake missing as a replacement of" 1792c7c4e3dSmrg echo "# $ $@" 1802c7c4e3dSmrg echo "exit 0" 1812c7c4e3dSmrg chmod +x $file 1822c7c4e3dSmrg exit 1 1832c7c4e3dSmrg fi 1842c7c4e3dSmrg ;; 1852c7c4e3dSmrg 1862c7c4e3dSmrg bison|yacc) 1872c7c4e3dSmrg echo 1>&2 "\ 1882c7c4e3dSmrgWARNING: \`$1' is missing on your system. You should only need it if 1892c7c4e3dSmrg you modified a \`.y' file. You may need the \`Bison' package 1902c7c4e3dSmrg in order for those modifications to take effect. You can get 1912c7c4e3dSmrg \`Bison' from any GNU archive site." 1922c7c4e3dSmrg rm -f y.tab.c y.tab.h 1932c7c4e3dSmrg if [ $# -ne 1 ]; then 1942c7c4e3dSmrg eval LASTARG="\${$#}" 1952c7c4e3dSmrg case "$LASTARG" in 1962c7c4e3dSmrg *.y) 1972c7c4e3dSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 1982c7c4e3dSmrg if [ -f "$SRCFILE" ]; then 1992c7c4e3dSmrg cp "$SRCFILE" y.tab.c 2002c7c4e3dSmrg fi 2012c7c4e3dSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 2022c7c4e3dSmrg if [ -f "$SRCFILE" ]; then 2032c7c4e3dSmrg cp "$SRCFILE" y.tab.h 2042c7c4e3dSmrg fi 2052c7c4e3dSmrg ;; 2062c7c4e3dSmrg esac 2072c7c4e3dSmrg fi 2082c7c4e3dSmrg if [ ! -f y.tab.h ]; then 2092c7c4e3dSmrg echo >y.tab.h 2102c7c4e3dSmrg fi 2112c7c4e3dSmrg if [ ! -f y.tab.c ]; then 2122c7c4e3dSmrg echo 'main() { return 0; }' >y.tab.c 2132c7c4e3dSmrg fi 2142c7c4e3dSmrg ;; 2152c7c4e3dSmrg 2162c7c4e3dSmrg lex|flex) 2172c7c4e3dSmrg echo 1>&2 "\ 2182c7c4e3dSmrgWARNING: \`$1' is missing on your system. You should only need it if 2192c7c4e3dSmrg you modified a \`.l' file. You may need the \`Flex' package 2202c7c4e3dSmrg in order for those modifications to take effect. You can get 2212c7c4e3dSmrg \`Flex' from any GNU archive site." 2222c7c4e3dSmrg rm -f lex.yy.c 2232c7c4e3dSmrg if [ $# -ne 1 ]; then 2242c7c4e3dSmrg eval LASTARG="\${$#}" 2252c7c4e3dSmrg case "$LASTARG" in 2262c7c4e3dSmrg *.l) 2272c7c4e3dSmrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 2282c7c4e3dSmrg if [ -f "$SRCFILE" ]; then 2292c7c4e3dSmrg cp "$SRCFILE" lex.yy.c 2302c7c4e3dSmrg fi 2312c7c4e3dSmrg ;; 2322c7c4e3dSmrg esac 2332c7c4e3dSmrg fi 2342c7c4e3dSmrg if [ ! -f lex.yy.c ]; then 2352c7c4e3dSmrg echo 'main() { return 0; }' >lex.yy.c 2362c7c4e3dSmrg fi 2372c7c4e3dSmrg ;; 2382c7c4e3dSmrg 2392c7c4e3dSmrg help2man) 2402c7c4e3dSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 2412c7c4e3dSmrg # We have it, but it failed. 2422c7c4e3dSmrg exit 1 2432c7c4e3dSmrg fi 2442c7c4e3dSmrg 2452c7c4e3dSmrg echo 1>&2 "\ 2462c7c4e3dSmrgWARNING: \`$1' is missing on your system. You should only need it if 2472c7c4e3dSmrg you modified a dependency of a manual page. You may need the 2482c7c4e3dSmrg \`Help2man' package in order for those modifications to take 2492c7c4e3dSmrg effect. You can get \`Help2man' from any GNU archive site." 2502c7c4e3dSmrg 2512c7c4e3dSmrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 2522c7c4e3dSmrg if test -z "$file"; then 2532c7c4e3dSmrg file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 2542c7c4e3dSmrg fi 2552c7c4e3dSmrg if [ -f "$file" ]; then 2562c7c4e3dSmrg touch $file 2572c7c4e3dSmrg else 2582c7c4e3dSmrg test -z "$file" || exec >$file 2592c7c4e3dSmrg echo ".ab help2man is required to generate this page" 2602c7c4e3dSmrg exit 1 2612c7c4e3dSmrg fi 2622c7c4e3dSmrg ;; 2632c7c4e3dSmrg 2642c7c4e3dSmrg makeinfo) 2652c7c4e3dSmrg if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then 2662c7c4e3dSmrg # We have makeinfo, but it failed. 2672c7c4e3dSmrg exit 1 2682c7c4e3dSmrg fi 2692c7c4e3dSmrg 2702c7c4e3dSmrg echo 1>&2 "\ 2712c7c4e3dSmrgWARNING: \`$1' is missing on your system. You should only need it if 2722c7c4e3dSmrg you modified a \`.texi' or \`.texinfo' file, or any other file 2732c7c4e3dSmrg indirectly affecting the aspect of the manual. The spurious 2742c7c4e3dSmrg call might also be the consequence of using a buggy \`make' (AIX, 2752c7c4e3dSmrg DU, IRIX). You might want to install the \`Texinfo' package or 2762c7c4e3dSmrg the \`GNU make' package. Grab either from any GNU archive site." 2772c7c4e3dSmrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 2782c7c4e3dSmrg if test -z "$file"; then 2792c7c4e3dSmrg file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 2802c7c4e3dSmrg file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` 2812c7c4e3dSmrg fi 2822c7c4e3dSmrg touch $file 2832c7c4e3dSmrg ;; 2842c7c4e3dSmrg 2852c7c4e3dSmrg tar) 2862c7c4e3dSmrg shift 2872c7c4e3dSmrg if test -n "$run"; then 2882c7c4e3dSmrg echo 1>&2 "ERROR: \`tar' requires --run" 2892c7c4e3dSmrg exit 1 2902c7c4e3dSmrg fi 2912c7c4e3dSmrg 2922c7c4e3dSmrg # We have already tried tar in the generic part. 2932c7c4e3dSmrg # Look for gnutar/gtar before invocation to avoid ugly error 2942c7c4e3dSmrg # messages. 2952c7c4e3dSmrg if (gnutar --version > /dev/null 2>&1); then 2962c7c4e3dSmrg gnutar "$@" && exit 0 2972c7c4e3dSmrg fi 2982c7c4e3dSmrg if (gtar --version > /dev/null 2>&1); then 2992c7c4e3dSmrg gtar "$@" && exit 0 3002c7c4e3dSmrg fi 3012c7c4e3dSmrg firstarg="$1" 3022c7c4e3dSmrg if shift; then 3032c7c4e3dSmrg case "$firstarg" in 3042c7c4e3dSmrg *o*) 3052c7c4e3dSmrg firstarg=`echo "$firstarg" | sed s/o//` 3062c7c4e3dSmrg tar "$firstarg" "$@" && exit 0 3072c7c4e3dSmrg ;; 3082c7c4e3dSmrg esac 3092c7c4e3dSmrg case "$firstarg" in 3102c7c4e3dSmrg *h*) 3112c7c4e3dSmrg firstarg=`echo "$firstarg" | sed s/h//` 3122c7c4e3dSmrg tar "$firstarg" "$@" && exit 0 3132c7c4e3dSmrg ;; 3142c7c4e3dSmrg esac 3152c7c4e3dSmrg fi 3162c7c4e3dSmrg 3172c7c4e3dSmrg echo 1>&2 "\ 3182c7c4e3dSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 3192c7c4e3dSmrg You may want to install GNU tar or Free paxutils, or check the 3202c7c4e3dSmrg command line arguments." 3212c7c4e3dSmrg exit 1 3222c7c4e3dSmrg ;; 3232c7c4e3dSmrg 3242c7c4e3dSmrg *) 3252c7c4e3dSmrg echo 1>&2 "\ 3262c7c4e3dSmrgWARNING: \`$1' is needed, and you do not seem to have it handy on your 3272c7c4e3dSmrg system. You might have modified some files without having the 3282c7c4e3dSmrg proper tools for further handling them. Check the \`README' file, 3292c7c4e3dSmrg it often tells you about the needed prerequisites for installing 3302c7c4e3dSmrg this package. You may also peek at any GNU archive site, in case 3312c7c4e3dSmrg some other package would contain this missing \`$1' program." 3322c7c4e3dSmrg exit 1 3332c7c4e3dSmrg ;; 3342c7c4e3dSmrgesac 3352c7c4e3dSmrg 3362c7c4e3dSmrgexit 0 337