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