missing revision 9f606849
19f606849Smrg#! /bin/sh 29f606849Smrg# Common stub for a few missing GNU programs while installing. 39f606849Smrg 49f606849Smrgscriptversion=2006-05-10.23 59f606849Smrg 69f606849Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 79f606849Smrg# Free Software Foundation, Inc. 89f606849Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 99f606849Smrg 109f606849Smrg# This program is free software; you can redistribute it and/or modify 119f606849Smrg# it under the terms of the GNU General Public License as published by 129f606849Smrg# the Free Software Foundation; either version 2, or (at your option) 139f606849Smrg# any later version. 149f606849Smrg 159f606849Smrg# This program is distributed in the hope that it will be useful, 169f606849Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 179f606849Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 189f606849Smrg# GNU General Public License for more details. 199f606849Smrg 209f606849Smrg# You should have received a copy of the GNU General Public License 219f606849Smrg# along with this program; if not, write to the Free Software 229f606849Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 239f606849Smrg# 02110-1301, USA. 249f606849Smrg 259f606849Smrg# As a special exception to the GNU General Public License, if you 269f606849Smrg# distribute this file as part of a program that contains a 279f606849Smrg# configuration script generated by Autoconf, you may include it under 289f606849Smrg# the same distribution terms that you use for the rest of that program. 299f606849Smrg 309f606849Smrgif test $# -eq 0; then 319f606849Smrg echo 1>&2 "Try \`$0 --help' for more information" 329f606849Smrg exit 1 339f606849Smrgfi 349f606849Smrg 359f606849Smrgrun=: 369f606849Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 379f606849Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 389f606849Smrg 399f606849Smrg# In the cases where this matters, `missing' is being run in the 409f606849Smrg# srcdir already. 419f606849Smrgif test -f configure.ac; then 429f606849Smrg configure_ac=configure.ac 439f606849Smrgelse 449f606849Smrg configure_ac=configure.in 459f606849Smrgfi 469f606849Smrg 479f606849Smrgmsg="missing on your system" 489f606849Smrg 499f606849Smrgcase $1 in 509f606849Smrg--run) 519f606849Smrg # Try to run requested program, and just exit if it succeeds. 529f606849Smrg run= 539f606849Smrg shift 549f606849Smrg "$@" && exit 0 559f606849Smrg # Exit code 63 means version mismatch. This often happens 569f606849Smrg # when the user try to use an ancient version of a tool on 579f606849Smrg # a file that requires a minimum version. In this case we 589f606849Smrg # we should proceed has if the program had been absent, or 599f606849Smrg # if --run hadn't been passed. 609f606849Smrg if test $? = 63; then 619f606849Smrg run=: 629f606849Smrg msg="probably too old" 639f606849Smrg fi 649f606849Smrg ;; 659f606849Smrg 669f606849Smrg -h|--h|--he|--hel|--help) 679f606849Smrg echo "\ 689f606849Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 699f606849Smrg 709f606849SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 719f606849Smrgerror status if there is no known handling for PROGRAM. 729f606849Smrg 739f606849SmrgOptions: 749f606849Smrg -h, --help display this help and exit 759f606849Smrg -v, --version output version information and exit 769f606849Smrg --run try to run the given command, and emulate it if it fails 779f606849Smrg 789f606849SmrgSupported PROGRAM values: 799f606849Smrg aclocal touch file \`aclocal.m4' 809f606849Smrg autoconf touch file \`configure' 819f606849Smrg autoheader touch file \`config.h.in' 829f606849Smrg autom4te touch the output file, or create a stub one 839f606849Smrg automake touch all \`Makefile.in' files 849f606849Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 859f606849Smrg flex create \`lex.yy.c', if possible, from existing .c 869f606849Smrg help2man touch the output file 879f606849Smrg lex create \`lex.yy.c', if possible, from existing .c 889f606849Smrg makeinfo touch the output file 899f606849Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 909f606849Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 919f606849Smrg 929f606849SmrgSend bug reports to <bug-automake@gnu.org>." 939f606849Smrg exit $? 949f606849Smrg ;; 959f606849Smrg 969f606849Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 979f606849Smrg echo "missing $scriptversion (GNU Automake)" 989f606849Smrg exit $? 999f606849Smrg ;; 1009f606849Smrg 1019f606849Smrg -*) 1029f606849Smrg echo 1>&2 "$0: Unknown \`$1' option" 1039f606849Smrg echo 1>&2 "Try \`$0 --help' for more information" 1049f606849Smrg exit 1 1059f606849Smrg ;; 1069f606849Smrg 1079f606849Smrgesac 1089f606849Smrg 1099f606849Smrg# Now exit if we have it, but it failed. Also exit now if we 1109f606849Smrg# don't have it and --version was passed (most likely to detect 1119f606849Smrg# the program). 1129f606849Smrgcase $1 in 1139f606849Smrg lex|yacc) 1149f606849Smrg # Not GNU programs, they don't have --version. 1159f606849Smrg ;; 1169f606849Smrg 1179f606849Smrg tar) 1189f606849Smrg if test -n "$run"; then 1199f606849Smrg echo 1>&2 "ERROR: \`tar' requires --run" 1209f606849Smrg exit 1 1219f606849Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1229f606849Smrg exit 1 1239f606849Smrg fi 1249f606849Smrg ;; 1259f606849Smrg 1269f606849Smrg *) 1279f606849Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 1289f606849Smrg # We have it, but it failed. 1299f606849Smrg exit 1 1309f606849Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1319f606849Smrg # Could not run --version or --help. This is probably someone 1329f606849Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 1339f606849Smrg # $TOOL exists and not knowing $TOOL uses missing. 1349f606849Smrg exit 1 1359f606849Smrg fi 1369f606849Smrg ;; 1379f606849Smrgesac 1389f606849Smrg 1399f606849Smrg# If it does not exist, or fails to run (possibly an outdated version), 1409f606849Smrg# try to emulate it. 1419f606849Smrgcase $1 in 1429f606849Smrg aclocal*) 1439f606849Smrg echo 1>&2 "\ 1449f606849SmrgWARNING: \`$1' is $msg. You should only need it if 1459f606849Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 1469f606849Smrg to install the \`Automake' and \`Perl' packages. Grab them from 1479f606849Smrg any GNU archive site." 1489f606849Smrg touch aclocal.m4 1499f606849Smrg ;; 1509f606849Smrg 1519f606849Smrg autoconf) 1529f606849Smrg echo 1>&2 "\ 1539f606849SmrgWARNING: \`$1' is $msg. You should only need it if 1549f606849Smrg you modified \`${configure_ac}'. You might want to install the 1559f606849Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 1569f606849Smrg archive site." 1579f606849Smrg touch configure 1589f606849Smrg ;; 1599f606849Smrg 1609f606849Smrg autoheader) 1619f606849Smrg echo 1>&2 "\ 1629f606849SmrgWARNING: \`$1' is $msg. You should only need it if 1639f606849Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 1649f606849Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 1659f606849Smrg from any GNU archive site." 1669f606849Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 1679f606849Smrg test -z "$files" && files="config.h" 1689f606849Smrg touch_files= 1699f606849Smrg for f in $files; do 1709f606849Smrg case $f in 1719f606849Smrg *:*) touch_files="$touch_files "`echo "$f" | 1729f606849Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 1739f606849Smrg *) touch_files="$touch_files $f.in";; 1749f606849Smrg esac 1759f606849Smrg done 1769f606849Smrg touch $touch_files 1779f606849Smrg ;; 1789f606849Smrg 1799f606849Smrg automake*) 1809f606849Smrg echo 1>&2 "\ 1819f606849SmrgWARNING: \`$1' is $msg. You should only need it if 1829f606849Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 1839f606849Smrg You might want to install the \`Automake' and \`Perl' packages. 1849f606849Smrg Grab them from any GNU archive site." 1859f606849Smrg find . -type f -name Makefile.am -print | 1869f606849Smrg sed 's/\.am$/.in/' | 1879f606849Smrg while read f; do touch "$f"; done 1889f606849Smrg ;; 1899f606849Smrg 1909f606849Smrg autom4te) 1919f606849Smrg echo 1>&2 "\ 1929f606849SmrgWARNING: \`$1' is needed, but is $msg. 1939f606849Smrg You might have modified some files without having the 1949f606849Smrg proper tools for further handling them. 1959f606849Smrg You can get \`$1' as part of \`Autoconf' from any GNU 1969f606849Smrg archive site." 1979f606849Smrg 1989f606849Smrg file=`echo "$*" | sed -n "$sed_output"` 1999f606849Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2009f606849Smrg if test -f "$file"; then 2019f606849Smrg touch $file 2029f606849Smrg else 2039f606849Smrg test -z "$file" || exec >$file 2049f606849Smrg echo "#! /bin/sh" 2059f606849Smrg echo "# Created by GNU Automake missing as a replacement of" 2069f606849Smrg echo "# $ $@" 2079f606849Smrg echo "exit 0" 2089f606849Smrg chmod +x $file 2099f606849Smrg exit 1 2109f606849Smrg fi 2119f606849Smrg ;; 2129f606849Smrg 2139f606849Smrg bison|yacc) 2149f606849Smrg echo 1>&2 "\ 2159f606849SmrgWARNING: \`$1' $msg. You should only need it if 2169f606849Smrg you modified a \`.y' file. You may need the \`Bison' package 2179f606849Smrg in order for those modifications to take effect. You can get 2189f606849Smrg \`Bison' from any GNU archive site." 2199f606849Smrg rm -f y.tab.c y.tab.h 2209f606849Smrg if test $# -ne 1; then 2219f606849Smrg eval LASTARG="\${$#}" 2229f606849Smrg case $LASTARG in 2239f606849Smrg *.y) 2249f606849Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 2259f606849Smrg if test -f "$SRCFILE"; then 2269f606849Smrg cp "$SRCFILE" y.tab.c 2279f606849Smrg fi 2289f606849Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 2299f606849Smrg if test -f "$SRCFILE"; then 2309f606849Smrg cp "$SRCFILE" y.tab.h 2319f606849Smrg fi 2329f606849Smrg ;; 2339f606849Smrg esac 2349f606849Smrg fi 2359f606849Smrg if test ! -f y.tab.h; then 2369f606849Smrg echo >y.tab.h 2379f606849Smrg fi 2389f606849Smrg if test ! -f y.tab.c; then 2399f606849Smrg echo 'main() { return 0; }' >y.tab.c 2409f606849Smrg fi 2419f606849Smrg ;; 2429f606849Smrg 2439f606849Smrg lex|flex) 2449f606849Smrg echo 1>&2 "\ 2459f606849SmrgWARNING: \`$1' is $msg. You should only need it if 2469f606849Smrg you modified a \`.l' file. You may need the \`Flex' package 2479f606849Smrg in order for those modifications to take effect. You can get 2489f606849Smrg \`Flex' from any GNU archive site." 2499f606849Smrg rm -f lex.yy.c 2509f606849Smrg if test $# -ne 1; then 2519f606849Smrg eval LASTARG="\${$#}" 2529f606849Smrg case $LASTARG in 2539f606849Smrg *.l) 2549f606849Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 2559f606849Smrg if test -f "$SRCFILE"; then 2569f606849Smrg cp "$SRCFILE" lex.yy.c 2579f606849Smrg fi 2589f606849Smrg ;; 2599f606849Smrg esac 2609f606849Smrg fi 2619f606849Smrg if test ! -f lex.yy.c; then 2629f606849Smrg echo 'main() { return 0; }' >lex.yy.c 2639f606849Smrg fi 2649f606849Smrg ;; 2659f606849Smrg 2669f606849Smrg help2man) 2679f606849Smrg echo 1>&2 "\ 2689f606849SmrgWARNING: \`$1' is $msg. You should only need it if 2699f606849Smrg you modified a dependency of a manual page. You may need the 2709f606849Smrg \`Help2man' package in order for those modifications to take 2719f606849Smrg effect. You can get \`Help2man' from any GNU archive site." 2729f606849Smrg 2739f606849Smrg file=`echo "$*" | sed -n "$sed_output"` 2749f606849Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2759f606849Smrg if test -f "$file"; then 2769f606849Smrg touch $file 2779f606849Smrg else 2789f606849Smrg test -z "$file" || exec >$file 2799f606849Smrg echo ".ab help2man is required to generate this page" 2809f606849Smrg exit 1 2819f606849Smrg fi 2829f606849Smrg ;; 2839f606849Smrg 2849f606849Smrg makeinfo) 2859f606849Smrg echo 1>&2 "\ 2869f606849SmrgWARNING: \`$1' is $msg. You should only need it if 2879f606849Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 2889f606849Smrg indirectly affecting the aspect of the manual. The spurious 2899f606849Smrg call might also be the consequence of using a buggy \`make' (AIX, 2909f606849Smrg DU, IRIX). You might want to install the \`Texinfo' package or 2919f606849Smrg the \`GNU make' package. Grab either from any GNU archive site." 2929f606849Smrg # The file to touch is that specified with -o ... 2939f606849Smrg file=`echo "$*" | sed -n "$sed_output"` 2949f606849Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2959f606849Smrg if test -z "$file"; then 2969f606849Smrg # ... or it is the one specified with @setfilename ... 2979f606849Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 2989f606849Smrg file=`sed -n ' 2999f606849Smrg /^@setfilename/{ 3009f606849Smrg s/.* \([^ ]*\) *$/\1/ 3019f606849Smrg p 3029f606849Smrg q 3039f606849Smrg }' $infile` 3049f606849Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 3059f606849Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 3069f606849Smrg fi 3079f606849Smrg # If the file does not exist, the user really needs makeinfo; 3089f606849Smrg # let's fail without touching anything. 3099f606849Smrg test -f $file || exit 1 3109f606849Smrg touch $file 3119f606849Smrg ;; 3129f606849Smrg 3139f606849Smrg tar) 3149f606849Smrg shift 3159f606849Smrg 3169f606849Smrg # We have already tried tar in the generic part. 3179f606849Smrg # Look for gnutar/gtar before invocation to avoid ugly error 3189f606849Smrg # messages. 3199f606849Smrg if (gnutar --version > /dev/null 2>&1); then 3209f606849Smrg gnutar "$@" && exit 0 3219f606849Smrg fi 3229f606849Smrg if (gtar --version > /dev/null 2>&1); then 3239f606849Smrg gtar "$@" && exit 0 3249f606849Smrg fi 3259f606849Smrg firstarg="$1" 3269f606849Smrg if shift; then 3279f606849Smrg case $firstarg in 3289f606849Smrg *o*) 3299f606849Smrg firstarg=`echo "$firstarg" | sed s/o//` 3309f606849Smrg tar "$firstarg" "$@" && exit 0 3319f606849Smrg ;; 3329f606849Smrg esac 3339f606849Smrg case $firstarg in 3349f606849Smrg *h*) 3359f606849Smrg firstarg=`echo "$firstarg" | sed s/h//` 3369f606849Smrg tar "$firstarg" "$@" && exit 0 3379f606849Smrg ;; 3389f606849Smrg esac 3399f606849Smrg fi 3409f606849Smrg 3419f606849Smrg echo 1>&2 "\ 3429f606849SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 3439f606849Smrg You may want to install GNU tar or Free paxutils, or check the 3449f606849Smrg command line arguments." 3459f606849Smrg exit 1 3469f606849Smrg ;; 3479f606849Smrg 3489f606849Smrg *) 3499f606849Smrg echo 1>&2 "\ 3509f606849SmrgWARNING: \`$1' is needed, and is $msg. 3519f606849Smrg You might have modified some files without having the 3529f606849Smrg proper tools for further handling them. Check the \`README' file, 3539f606849Smrg it often tells you about the needed prerequisites for installing 3549f606849Smrg this package. You may also peek at any GNU archive site, in case 3559f606849Smrg some other package would contain this missing \`$1' program." 3569f606849Smrg exit 1 3579f606849Smrg ;; 3589f606849Smrgesac 3599f606849Smrg 3609f606849Smrgexit 0 3619f606849Smrg 3629f606849Smrg# Local variables: 3639f606849Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 3649f606849Smrg# time-stamp-start: "scriptversion=" 3659f606849Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 3669f606849Smrg# time-stamp-end: "$" 3679f606849Smrg# End: 368